module product list quantity change not working

  • Posts: 52
  • Thank you received: 4
3 years 4 weeks ago #331092

Hello,

I have placed a product list module with my frontpage for desktop view, and 2 more for tablet/mobile.

Module Name: module_shop_category_sample_desktop

Everything works, except the input field (quantity changer) when carousel is enabled.

When disabled, input works.

I have sent you login details for frontend/backend.

Could you take a look?

Please Log in or Create an account to join the conversation.

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
3 years 4 weeks ago #331094

Hello,

Did you sent the details via the "contact us" form ?
Because I have no trace of it.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 52
  • Thank you received: 4
3 years 3 weeks ago #331131

Hello,

I have sent login details (maybe 2 days ago) with contact form, but I forgot to activate the admin user :)
Support is looking into 2 column layout for 375px with module product list, but that is another forum post.

While I have tested some myself, I noticed this strange behaviour with the quantity input fields (module product list with start page).

I have activated the admin user now, and you should be able to login (htaccess/joomla).

Please Log in or Create an account to join the conversation.

  • Posts: 81509
  • Thank you received: 13064
  • MODERATOR
3 years 3 weeks ago #331148

Hi,

If you check the console of your browser on your homepage, you can see that you have elements with the same id on the page:
i.imgur.com/4xpCPRY.png
So I suppose it comes form those 3 modules, and the way they are added to the page.
What you could try to do to circumvent the issue is to add the line:
<?php $this->ajax = true; ?>
at the beginning of the layouts / quantity view file via the menu Display>Views.
That will force adding an extra prefix to the id of the inputs which might help.

The following user(s) said Thank You: knuffiwuffi

Please Log in or Create an account to join the conversation.

  • Posts: 52
  • Thank you received: 4
3 years 3 weeks ago #331159

tried it, but does nothing.
We can't have multiple product list modules on the same page?

Yes, all 3 modules will fetch the same products from the same category.
One module for each viewport (dektop-5col, tablet-4col, mobile-2col).

Looks like the duplicates generate the same IDs for input fields?
I only noticed this with carousel enabled (which I would like to use live).

Last edit: 3 years 3 weeks ago by knuffiwuffi.

Please Log in or Create an account to join the conversation.

  • Posts: 81509
  • Thank you received: 13064
  • MODERATOR
3 years 3 weeks ago #331201

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.

The following user(s) said Thank You: knuffiwuffi

Please Log in or Create an account to join the conversation.

  • Posts: 52
  • Thank you received: 4
3 years 3 weeks ago #331207

Yes. Using Balbooa Gridbox PageBuilder.
I can add modules with pages.

I have contacted the Team to see if they see something on their end.
I really don't want to go without carousel, since it would save much space.

Please Log in or Create an account to join the conversation.

  • Posts: 52
  • Thank you received: 4
3 years 3 weeks ago #331208

I have tried your second code with Display > View.
Not working.

This is only with carousel mode enabled.

Please Log in or Create an account to join the conversation.

  • Posts: 81509
  • Thank you received: 13064
  • MODERATOR
3 years 3 weeks ago #331221

Hi,

I looked at the situation again and I think it's because of this:
stackoverflow.com/questions/33119078/clo...tems-in-owl-carousel
The carousel system we're using will clone the elements when you have the loop system activated.
change the code:

loop:true,
to:
loop:false,
in the file product / carousel and it should then work properly.

The following user(s) said Thank You: knuffiwuffi

Please Log in or Create an account to join the conversation.

  • Posts: 52
  • Thank you received: 4
3 years 3 weeks ago #331225

Thank you so much for looking into this.
It is working!

Backend > Display > View > product / carousel.php

	hkjQuery('#hikashop_carousel_<?php echo $mainDivName; ?>').owlCarousel({
    	loop:false,

Please Log in or Create an account to join the conversation.

  • Posts: 52
  • Thank you received: 4
3 years 3 weeks ago #331236

Closed.

Attachments:
Last edit: 3 years 3 weeks ago by knuffiwuffi.

Please Log in or Create an account to join the conversation.

Time to create page: 0.076 seconds
Powered by Kunena Forum