Pop up information when user click on add to cart button

  • Posts: 252
  • Thank you received: 1
1 year 4 months ago #354011

-- url of the page with the problem -- : bloominggreens.com.tw/zh/
-- HikaShop version -- : 4.7.5
-- Joomla version -- : 3.10
-- PHP version -- : 7.8
-- Browser(s) name and version -- : chrome

Hi,
We want to show a pop up message when user click on add to cart button in product page for some products.
But we can't find the add to card button in my show_default or add to cart view to add the javascript code, would you tell me how do I do this.

Thanks in advance

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

  • Posts: 83007
  • Thank you received: 13400
  • MODERATOR
1 year 4 months ago #354017

Hi,

There is already a pop up message displayed by default when the user clicks on an add to cart button in HikaShop.
So I'm not sure what you're trying to do.
I tried to look at the situation on your website, but I couldn't see any add to cart buttons.
Could you provide more information on the situation and a way to check what happens when the add to cart button is clicked on on your website ?

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

  • Posts: 252
  • Thank you received: 1
1 year 4 months ago #354020

Thank you for the quick reply.

We have a special product that is a combination of other products. The user needs to choose 12 items from the same category. We have developed a module for this, but we need to check if the user has selected the correct number of products when they press the "Add to Cart" button. If the user hasn't selected the right number of products, we will display a message to them, otherwise, the process will proceed as usual with other products.

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

  • Posts: 83007
  • Thank you received: 13400
  • MODERATOR
1 year 4 months ago #354024

Hi,

Can you provide the URL of the page with that add to cart button ? It will be necessary to check the situation to be able to tell you what JS code would be necessary.

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

  • Posts: 252
  • Thank you received: 1
1 year 4 months ago #354210

Hi,
This is the url :
testlorena.diggo.com.tw/zh/hots/12/produ...ramel-cocoa-cup.html

when user click the 'Add to cart', we need to verify if the correct number of products was selected.
Thanks for helping.

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

  • Posts: 83007
  • Thank you received: 13400
  • MODERATOR
1 year 4 months ago #354212

Hi,

I think the best is to create a view override for product / quantity via the menu Display>Views and change the line:

$attributes = ' class="' . $css_button . ' ' . $css_button_cart. '" onclick="if(window.hikashop.addToCart) { return window.hikashop.addToCart(this); }" data-addToCart="'.$this->row->product_id.'" data-addTo-div="hikashop_product_form" data-addTo-class="add_in_progress"';
In the onclick attribute, you can add a call to your javascript function in order to check that the correct number of products is selected and only call window.hikashop.addToCart if that's the case.

The following user(s) said Thank You: twscott

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

Time to create page: 0.066 seconds
Powered by Kunena Forum