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">
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;
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');

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.



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>