Displays Virtuemart Products, Categories, and Manufacturers via remote requests like cURL, AJAX, etc.
Using this component and the methods documented below anyone can easily
display and promote the products listed in this online store on any
website that they have administrative access to.
Simply copy and paste the below code samples into your websites HTML pages, its that easy!.
The below are live examples using the Products API installed on this site.
Both examples get 4 random products ...
Get 4 random products in HTML format, 2 per row ...
CODE: (Copy and paste this into any webpage): -
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> <div id="vm_random_products">Loading ...</div> <script type="text/javascript"> //<![CDATA[ jQuery.ajax({ url: 'http://shop.ekerner.com.au/index.php', data: { option: 'com_vm_api', view: 'products', group: 'random', type: 'html', cols: 2, max: 4 }, dataType: 'html', success: function(data){ jQuery('#vm_random_products').html(data); } }); //]]> </script>
OUTPUT: -
Get 4 random products in JSON format ...
URL: http://shop.ekerner.com.au/index.php?option=com_vm_api&view=products&group=random&type=json&max=4
FIELDS RETURNED: virtuemart_vendor_id, virtuemart_product_id, slug, product_sku, product_name, product_s_desc, product_desc, product_url, product_in_stock, product_availability, product_special, customtitle, metadesc, metakey, metarobot, metaauthor, product_box, product_price, product_override_price, virtuemart_category_id, category_name, virtuemart_manufacturer_id, mf_name, mf_url, mf_email, mf_desc, canonical, link, file_url_thumb, file_url, product_tax, product_discount, product_currency
CODE: (Copy and paste this into any webpage): -
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> <div id="vm_random_products_json">Loading ...</div> <script type="text/javascript"> //<![CDATA[ jQuery.ajax({ url: 'http://shop.ekerner.com.au/index.php', data: { option: 'com_vm_api', view: 'products', group: 'random', type: 'json', max: 4 }, dataType: 'json', success: function(data){ var products = 'JSON contains details for: -<ul>'; for (var i in data) if (data[i].product_name) products += '<li><b>'+data[i].product_name+': </b>'+ data[i].product_s_desc+'</li>'; products += '</ul>'; jQuery('#vm_random_products_json').html(products); } }); //]]> </script>
OUTPUT: -
The below are live examples using the Categories API installed on this site.
Both examples get all categories ...
Get all categories in HTML format ...
URL: http://shop.ekerner.com.au/index.php?option=com_vm_api&view=categories&type=html
CODE: (Copy and paste this into any webpage): -
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> <div id="vm_categories">Loading ...</div> <script type="text/javascript"> //<![CDATA[ jQuery.ajax({ url: 'http://shop.ekerner.com.au/index.php', data: { option: 'com_vm_api', view: 'categories', type: 'html' }, dataType: 'html', success: function(data){ jQuery('#vm_categories').html(data); } }); //]]> </script>
OUTPUT: -
Get all categories in JSON format ...
URL: http://shop.ekerner.com.au/index.php?option=com_vm_api&view=categories&type=json
FIELDS RETURNED: virtuemart_category_id, slug, category_name, category_description, category_url, customtitle, metadesc, metakey, media_url, media_url_thumb, children
CODE: (Copy and paste this into any webpage): -
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> <div id="vm_categories_json">Loading ...</div> <script type="text/javascript"> //<![CDATA[ jQuery.ajax({ url: 'http://shop.ekerner.com.au/index.php', data: { option: 'com_vm_api', view: 'categories', type: 'json' }, dataType: 'json', success: function(data){ var categories = 'JSON contains details for: -<ul>'; for (var i in data) if (data[i].category_name) categories += '<li><b>'+data[i].category_name+': </b>'+ data[i].category_description+'</li>'; categories += '</ul>'; jQuery('#vm_categories_json').html(categories); } }); //]]> </script>
OUTPUT: -
The below are live examples using the Manufacturers API installed on this site.
Both examples get maximum 4 manufacturers ...
Get max 4 manufacturers in HTML format, 2 per row ...
URL: http://shop.ekerner.com.au/index.php?option=com_vm_api&view=manufacturers&type=html&cols=2&max=4
CODE: (Copy and paste this into any webpage): -
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> <div id="vm_manufacturers">Loading ...</div> <script type="text/javascript"> //<![CDATA[ jQuery.ajax({ url: 'http://shop.ekerner.com.au/index.php', data: { option: 'com_vm_api', view: 'manufacturers', type: 'html', cols: 2, max: 4 }, dataType: 'html', success: function(data){ jQuery('#vm_manufacturers').html(data); } }); //]]> </script>
OUTPUT: -
Get max 4 manufacturers in JSON format ...
URL: http://shop.ekerner.com.au/index.php?option=com_vm_api&view=manufacturers&type=json&max=4
FIELDS RETURNED: virtuemart_manufacturer_id, slug, mf_name, mf_desc, mf_email, mf_url, mf_website, media_url, media_url_thumb, mf_category_name
CODE: (Copy and paste this into any webpage): -
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> <div id="vm_manufacturers_json">Loading ...</div> <script type="text/javascript"> //<![CDATA[ jQuery.ajax({ url: 'http://shop.ekerner.com.au/index.php', data: { option: 'com_vm_api', view: 'manufacturers', type: 'json' }, dataType: 'json', success: function(data){ var manufacturers = 'JSON contains details for: -<ul>'; for (var i in data) if (data[i].mf_name) manufacturers += '<li><b>'+data[i].mf_name+': </b>'+ data[i].mf_desc+'</li>'; manufacturers += '</ul>'; jQuery('#vm_manufacturers_json').html(manufacturers); } }); //]]> </script>
OUTPUT: -
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
Copyright © 2024 eKerner.com