Php 无法取消设置或清除joomla virtuemart购物车会话变量
我创建了一个按钮,我想在点击事件时重置购物车。保存购物车值的会话变量为Php 无法取消设置或清除joomla virtuemart购物车会话变量,php,joomla,virtuemart,Php,Joomla,Virtuemart,我创建了一个按钮,我想在点击事件时重置购物车。保存购物车值的会话变量为 print_r(unserialize($_SESSION['__vm']['vmcart'])); 我试过了 $session->clear('__vm','vmcart'); 但是它对我不起作用对不起,因为VM 2应该是另一种解决方案! 在文件/components/com_virtuemart/cart/default_pricelist.php中添加链接: <a href="<?=JRoute
print_r(unserialize($_SESSION['__vm']['vmcart']));
我试过了
$session->clear('__vm','vmcart');
但是它对我不起作用对不起,因为VM 2应该是另一种解决方案! 在文件/components/com_virtuemart/cart/default_pricelist.php中添加链接:
<a href="<?=JRoute::_( 'index.php?option=com_virtuemart&view=cart&task=deleteCart' ) ?>">Clear cart</a>
在components/com_virtuemart/helpers/cart.php中
public function removeCart() {
if (!empty($this->products)) {
foreach ( $this->products as $key => $val ) {
unset($this->products[$key]);
$this->setCartIntoSession();
}
return true;
}
}
请试一试!如果有些东西不起作用,请告诉我-当然有帮助 你能指出文件路径吗?我找不到任何这样名字的文件!我很高兴能帮助你!
public function removeCart() {
if (!empty($this->products)) {
foreach ( $this->products as $key => $val ) {
unset($this->products[$key]);
$this->setCartIntoSession();
}
return true;
}
}