Add to cart redirect

  • Posts: 56
  • Thank you received: 1
2 years 5 months ago #347140

The add to cart in product detail page, after click will redirect to the cart page, is it any way to stop the redirect to cart? Just want it to have the product added into cart and stay on the same page.

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

  • Posts: 83746
  • Thank you received: 13552
  • MODERATOR
2 years 5 months ago #347147

That should be the default behavior to stay on the same page.
I see two potential reasons for that to not happen:
- The "HikaShop cart notification" plugin has been disabled, or has been configured to redirect on successful add to cart. So please chekc that plugin in the Joomla plugins manager.
- There is a javascript error on the page which leads to the add to cart to work in "fallback" mode and in that case a redirection to the checkout is mandatory after the add to cart. We would need a link to a product page to be able to check on that.

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

  • Posts: 56
  • Thank you received: 1
2 years 5 months ago #347179

Hikashop cart notification has turned on and applied with the webpage option.
ezfun.satumalaysiahosting.com/mall/epide...-adult-502-promotion This is the product link.

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

  • Posts: 83746
  • Thank you received: 13552
  • MODERATOR
2 years 5 months ago #347183

Hi,

From what I can see on your link, the issue is that you've activated the redirect on success setting of the HikaShop cart notification plugin.
Turn that setting off and it will stay on the same page.

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

  • Posts: 56
  • Thank you received: 1
2 years 5 months ago #347190



The setting is set as no redirect, but still have this redirect to cart issue.

Attachments:

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

  • Posts: 83746
  • Thank you received: 13552
  • MODERATOR
2 years 5 months ago #347191

Hi,

Ok. I looked deeper into it and I think it's falling back to redirecting because it can't display the notification box. And I think it can't display the notification box because of the javascript error on the page:
i.imgur.com/Fu0QBw4.png
That javascript error stops the proper initialisation of the rest of the javascript on the page.
I looked on that line 907 and this is the code generating the error:

<script>
	if (document.getElementById('hikashop_product_characteristic_30').value == 32){
		document.getElementById('add_to_cart_btn').style.pointerEvents = 'none';
	}

	$("#hikashop_product_characteristic_30").on("change",function(){
		if (document.getElementById('hikashop_product_characteristic_30').value == 32){
		document.getElementById('add_to_cart_btn').style.pointerEvents = 'none';
	}
	});
</script>
That code seems to have been added with a view override but it doesn't check if the element with the id hikashop_product_characteristic_30 is on the page before using it. And since the product on your link doesn't have that element (because it doesn't have any characteristic) it creates that error.
The line:
if (document.getElementById('hikashop_product_characteristic_30').value == 32){
should be changed to:
if (document.getElementById('hikashop_product_characteristic_30') && document.getElementById('hikashop_product_characteristic_30').value == 32){
to avoid the error and it should hopefully fix the problem.

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

  • Posts: 56
  • Thank you received: 1
2 years 5 months ago #347231

Have revised the coding according to your reply, but it still redirect to cart page.
ezfun.satumalaysiahosting.com/mall/epide...-adult-502-promotion

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

  • Posts: 83746
  • Thank you received: 13552
  • MODERATOR
2 years 5 months ago #347240

Hi,

Indeed. I hadn't seen, but you're actually using HikaShop 4.4.5. Could you please update your HikaShop ? We've made significant changes to the notification mechanism since then and it might help. If you still have the issue after the update, please provide a FTP access.

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

Time to create page: 0.073 seconds
Powered by Kunena Forum