Hi,
We can have multiple products listing on the same page. I tried that on my end and it works just fine.
The way it works is that in the file administrator/components/helpers/cart.php, you have a static counter variable:
static $hk_show_quantity_counter = 0;
And each time a view file has to display a quantity input field, it will call the function getQuantityCounter of that cart.php file to get the counter.
This function will do two things:
- increment the counter
- return the counter
That way, even when different modules of the same page display quantity input fields of the same products, we can be sure that the counter will be unique to each quantity input field.
The fact that this counter is "reset" between each module on your page indicates that the way the modules are displayed on the page contradicts with the way the counter is used in HikaShop.
So for example, if you have three areas on the page and the 3 modules area are loaded by javascript on the page with 3 separate AJAX requests, the mechanism I describe above wouldn't work as the counter would start at 0 for each AJAX request and thus each module.
Now I don't know how these 3 modules are added to the page on your website but I suppose it's not done with a normal Joomla position via the Joomla modules manager but with some kind of page builder, so the problem is not really in HikaShop.
What you can try is to add the code:
if(isset($this->params)) {
$id = $this->params->get('main_div_name', '') . $id;
after the line :
$id = 'hikashop_product_quantity_field_'.$quantity_counter;
in the file show_quantity.php via the menu Display>Views.
That way, on top of having the counter in the id (which should already guarantee the uniqueness of the id), you add the "main div name" of the module which contains the module id and which should hopefully make the id of the input unique on the page, regardless of how the module is displayed, with the drawback that the id will be very long.