Clear cart on language change, possible?

  • Posts: 88
  • Thank you received: 19
7 years 8 months ago #264564

Hi

Would it be possible to create a function that clears the cart, if the user changes language?

Thanks :-)

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

  • Posts: 88
  • Thank you received: 19
7 years 8 months ago #264587

I've created this function to delete the cart - may be there's a better solution, but it works

if ($_SESSION['CartLang'] != $_COOKIE[JApplication::getHash('language')]) :
	
	$_SESSION['CartLang'] = JFactory::getLanguage()->getTag();
	
	$session_id = JFactory::getSession()->getId();
	
	$db = JFactory::getDbo(); 
	$query = "DELETE FROM #__hikashop_cart WHERE session_id='$session_id'";
	$db->setQuery($query);
	$result = $db->execute();
	
endif;

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 8 months ago #264566

Hi,

If you find the right trigger in Joomla to be notified when the language is changing ; for sure you can then include the HikaShop helper and call the HikaShop cart class to clean the cart.
www.hikashop.com/support/documentation/6...r-documentation.html

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.

Time to create page: 0.052 seconds
Powered by Kunena Forum