magento,清空购物车中所有的产品和session
程序员文章站
2024-01-09 09:06:04
...
在购物车中清除所有产品代码:
foreach( Mage::getSingleton('checkout/session')->getQuote()->getItemsCollection() as $item ){ Mage::getSingleton('checkout/cart')->removeItem( $item->getId() )->save(); }
清除购物车所有session:
Mage::getSingleton(‘checkout/session’)->clear();