Skip to main content

Clear cart on language change, possible?

9 years 8 months ago #264564 by dyvel
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.

9 years 8 months ago #264587 by dyvel
I've created this function to delete the cart - may be there's a better solution, but it works
Code:
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.

9 years 8 months ago #264566 by Jerome
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.

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

Time to create page: 0.038 seconds
Powered by Kunena Forum