Add to cart html without popup

  • Posts: 1119
  • Thank you received: 114
7 years 6 months ago #268586

Hi,

I would like to add gift wrap button in checkout cart view. Code looks something like this:

<a class="btn btn-primary hikashop_cart_input_button  " rel="nofollow" href="/product/updatecart/add-1/cid-5049" onclick="if(window.hikashop.addToCart) { return window.hikashop.addToCart(this); }" data-addtocart="5049" data-addto-div="hikashop_product_form" data-addto-class="add_in_progress">Add to cart</a>

All works fine and product is added to cart. However I would like to get rid of the popup message there. Is there a way to do this?
I have tried to add this ( &Popup=0 ) at the end of href but it didn't work.

Kind Regards

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
7 years 6 months ago #268595

Hi,

Since we don't know if you have in add to cart legacy or not, or how is the page, it's hard to say anything.
We don't even know if the addToCart function is being used, or if it uses the href link when you click on the button (only one of the two is necessary). We do both in order to have a fallback when things are not working properly.
I would recommend something simpler like this:
<a class="btn btn-primary hikashop_cart_input_button " rel="nofollow" href="/product/updatecart/add-1/cid-5049/checkout-1">Add to cart</a>
and if that doesn't help, adding a return_url parameter to the URL so that you can indicate the URL where you want to be redirected might help.

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

  • Posts: 1119
  • Thank you received: 114
7 years 6 months ago #268671

Hi,

1. We use new checkout and new add to cart system with cart notify plugin + vex popup.

I have added such code to checkout show_block_vcart view:

<a class="btn btn-primary hikashop_cart_input_button" rel="nofollow" href="/product/updatecart/add-1/cid-5093" onclick="if(window.hikashop.addToCart) { return window.hikashop.addToCart(this); }" data-addtocart="5093">Add to cart</a>

It seems i cant remove anything from this code or it wont work properly.

The only issue is that on click i get vex popup. So as a work around i also have added such css:
.view-checkout .vex {display:none;}
body.view-checkout.vex-open {overflow:visible !important;}

It works fine but maybe there is a proper way to disable vex popup adding some code to element??

If i use only this:
<a class="btn btn-primary hikashop_cart_input_button" rel="nofollow" href="/checkout/product/updatecart/add-1/cid-5093">Add to cart</a>

Page refreshes and product is added to cart without any popup. However i would like to use ajax solution above as it looks better and loads faster...

2. Another thing. Maybe it would be possible to add some feature to hikashop module it self. So you could choose to display a popup when product is added or not. Example, if you have some module which displays extra products in checkout a popup sometimes isnt welcome.

Kind Regards

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
7 years 6 months ago #268678

Hi,

1. So my proposition did work :) But yes it requires a page refresh.
To have the ajax add to cart without the popup would require modifying the javascript of the notification system and it's not easy at all. I would recommend sticking with the CSS workaround if that works.

2. We'll see. For now no one else requested that so to me, it looks more like a custom need than something that should be in standard.

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

Time to create page: 0.058 seconds
Powered by Kunena Forum