- Posts: 88
- Thank you received: 20
Clear cart on language change, possible?
9 years 6 months ago #264564
by dyvel
Clear cart on language change, possible? was created by dyvel
Hi
Would it be possible to create a function that clears the cart, if the user changes language?
Thanks
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 6 months ago #264587
by dyvel
Replied by dyvel on topic Clear cart on language change, possible?
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 6 months ago #264566
by Jerome
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.
Replied by Jerome on topic Clear cart on language change, possible?
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,
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.185 seconds