Skip to main content

cart does not update

More
11 years 2 weeks ago #214467 by florcar
cart does not update was created by florcar
-- url of the page with the problem -- : flatize.fabulosa.ch
-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.4
-- PHP version -- : 5.4.44

Hi

My problem is maybe cache related. I have jotcache and excluded com_hikashop but it doesnt work. The cart wont update after pressing empty cart button. The product seems to be still in the cart.

I have seen that in new Version of hikashop the cache is cleaned after updating the cart. I have custom code in cart of view checkout with hikashop 2.3.2 so this file was not updated. Can I insert the missing code manually?

Regards
florcar

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

More
11 years 2 weeks ago #214477 by nicolas
Replied by nicolas on topic cart does not update
Hi,

I don't see that this is the issue.
The cart clearing button has not been made to support the Joomla caching yet. It will be in the next version of HikaShop.
In the mean time, you can edit the file components/com_hikashop/controllers/cart.php and add the code:
Code:
if(HIKASHOP_J30){ $plugin = JPluginHelper::getPlugin('system', 'cache'); $params = new JRegistry(@$plugin->params); $options = array( 'defaultgroup' => 'page', 'browsercache' => $params->get('browsercache', false), 'caching' => false, ); $cache = JCache::getInstance('page', $options); //$cache_key = JUri::getInstance()->toString(); $cache->clean(); }
after the line:
Code:
public function cleancart() {

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

More
11 years 2 weeks ago #214585 by florcar
Replied by florcar on topic cart does not update
Hi Nicolas
Ah ok I see. But when deleting single item in cart the cache is cleaned?
About the code. I dont see a function like cleancart. Is it maybe:
Code:
function delete(){ //delete a cart with the id given
?
Or is it in the root administrator/components/com_hikashop/controllers/cart.php ?
Best regards

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

More
11 years 2 weeks ago #214606 by nicolas
Replied by nicolas on topic cart does not update
Hi,

No, it's the function cleancart, not delete.
You're probably looking at the file administrator/components/com_hikashop/controllers/cart.php while I told you to look instead at the file components/com_hikashop/controllers/cart.php

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

More
11 years 2 weeks ago #214662 by florcar
Replied by florcar on topic cart does not update
Hi
I was looking at this file first. But there is no such function. Really, see attached file.

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

More
11 years 2 weeks ago #214850 by nicolas
Replied by nicolas on topic cart does not update
Hi,

My bad, it's the file components/com_hikashop/controllers/product.php

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

More
11 years 2 weeks ago - 11 years 2 weeks ago #214855 by florcar
Replied by florcar on topic cart does not update
Hi
Ok but the function is not public. Do I have to change that?
Code:
function cleancart(){
Edit:
Tried to insert the code but it didnt work
Last edit: 11 years 2 weeks ago by florcar. Reason: Tried the code

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

More
11 years 2 weeks ago #214866 by nicolas
Replied by nicolas on topic cart does not update
Hi,

What do you mean by "it didn't work" ? You got an error ? It doesn't change anything ? What code do you have now ? Could you do a screenshot ?

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

More
11 years 2 weeks ago #214911 by florcar
Replied by florcar on topic cart does not update
Hi

I inserted the code as you posted it right under function cleancart(){
I didnt get an error but it did not change anything.
Here is what I tryed:
Code:
function cleancart(){ if(HIKASHOP_J30){ $plugin = JPluginHelper::getPlugin('system', 'cache'); $params = new JRegistry(@$plugin->params); $options = array( 'defaultgroup' => 'page', 'browsercache' => $params->get('browsercache', false), 'caching' => false, ); $cache = JCache::getInstance('page', $options); //$cache_key = JUri::getInstance()->toString(); $cache->clean(); } $class = hikashop_get('class.cart'); if($class->hasCart()){ $class->delete($class->cart->cart_id); }

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

More
11 years 2 weeks ago #214949 by Xavier
Replied by Xavier on topic cart does not update
Hi,

Please try to replace the content of the function cleancart() by:
Code:
public function cleancart() { $cartClass = hikashop_get('class.cart'); if($cartClass->hasCart()) $cartClass->delete($cartClass->cart->cart_id); $url = JRequest::getVar('return_url',''); if(empty($url)) { $url = JRequest::getVar('url',''); $url = urldecode($url); } else { $url = base64_decode(urldecode($url)); } if(HIKASHOP_J30){ $plugin = JPluginHelper::getPlugin('system', 'cache'); $params = new JRegistry(@$plugin->params); $options = array( 'defaultgroup' => 'page', 'browsercache' => $params->get('browsercache', false), 'caching' => false, ); $cache = JCache::getInstance('page', $options); //$cache_key = JUri::getInstance()->toString(); $cache->clean(); } if(empty($url)) { echo '<html><head><script type="text/javascript">history.go(-1);</script></head><body></body></html>'; exit; } if(strpos($url, 'tmpl=component') !== false || strpos($url, 'tmpl-component') !== false) { if(!empty($_SERVER['HTTP_REFERER'])) { $app = JFactory::getApplication(); $app->redirect($_SERVER['HTTP_REFERER']); } else { echo '<html><head><script type="text/javascript">history.back();</script></head><body></body></html>'; exit; } } if(hikashop_disallowUrlRedirect($url)) return false; $this->setRedirect($url); }

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

More
11 years 2 weeks ago #215047 by florcar
Replied by florcar on topic cart does not update
Hi Xavier

Thanks for the code.
I replaced it and tried but unfortunately it doesnt work. :dry:
Deleting each product seperately worked allready before but the «WARENKORB LEEREN» («clean cart») doesent delete the items in cart.
I now disabled the button clean cart and think the customers can live with deleting each product seperately :)
As Nicolas mentioned is this modification part of a future update. Maybe it will work then :)

Thanks for the support and best regards

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

Time to create page: 0.239 seconds
Powered by Kunena Forum