Main menu
WalkswithMeJoomlaHow to load hikashop product variant dynamically

How to load hikashop product variant dynamically

How to load hikashop product variant dynamically ? When you’re using hikashop product variant with color , size combinations you may face some issues, with color or size not loading dynamically. like an example you may have three color Red,Blue and Green. also Red have two size 4 and 5 , Blue has one size 3 and Green has , 3,4 and 5.

In this scenario when the variant is displayed as dropdown , you may see all the sizes are available for all the colors ! its a bug, not really but it lack the loading of size variant based on the selected color variant. So how to resolve without any core modifications ?

You can see some thread already in hikashop forum this one and this there are some suggestion to alter the core files or use table layout instead of dropdown , but here I will suggest an alternate option without any core file modifications.

Yep, this is awesome and you can manage your hikashop product variant dynamically with an Ajax plugin , all is just use the following code section in your template override file of product page and just install my plugin .

Use the below code at the end of show_default_product.php inside your template override file, usually it can be found in  templates/{YOUR_TEMPLATE}/html/com_hikashop/product


<script type="text/javascript">
jQuery(document).ready(function(){
if(jQuery('.hikashop_product_characteristics_table select').length == 2){
jQuery('.hikashop_product_characteristics_table select:first').on('change',function(){
var data = "product_id=<?php echo $_REQUEST['cid']; ?>&characteristic_id="+this.value;
jQuery.ajax({
type: "POST",
url: "index.php?option=com_ajax&plugin=wwmhikavariantfix&format=raw",
data: data,
success: function(data){
if(data !== 0){
jQuery('.hikashop_product_characteristics_table select:last').html(data);
jQuery('.hikashop_product_characteristics_table select:last').trigger('change');
}
}
});
});
}
})
</script>

Then just install my hikashopvariantfix plugin to fix the hikashop product variant dynamically load. The plugin is available with a Coffee price. and you can just install it via Joomla extension manager and just activate it.

BuyNow

 

4 thoughts on “How to load hikashop product variant dynamically

  1. Hello, i’m interested in buying this plugin for an ecommerce website that I’m building but I have some questions:

    – Is it compatible with the new Hikashop 3.0?
    – Is there a demo to show to my client how the dinamic variants will work?

    1. Hello,

      It should compatible with new version.
      There is no demo at this time, the working is quite straight . Suppose you have a color and size variants. by default hikashop don’t have a filter like once you choose a color only available sizes are shown in the second dropdown. This plugin does that.
      If you have any doubt for integration I’m happy to help.

  2. Hi, I bought your plugin but I’m feeling very daft now that I can’t get it working :D

    I’ve installed the plugin and published it but I can’t find the show_default_product.php file to add your javascript code to. I’ve got the business version of Hikashop. I’ve tried creating the php file but still not getting it to work.

    Cheers,
    Nicole

    1. Hello,

      You can add the script in any of the files that related to product page.
      If the show_default_product.php not found in your template directory you can just copy the files from hikashop components -> views -> product folder.
      or add the script at the end of template index.php.
      still you have issue with integration , Please send me a temp FTP access you can use my contact form.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
FacebookTwitterGoogle+RSS