2016-12-05 104 views
0

我無法從用戶報價中刪除商品。無法從magento中的用戶報價中刪除商品

var_dump($product->getQty(), $product_id, $item->getQty()); 
$quote->removeItem($item->getId())->save(); 

if ($quote->collectTotals()->save()) { 
    var_dump(($quote->getId()), $item->getQty(), 'p'); 
    $_quote = Mage::getModel('sales/quote')->loadByCustomer($customer); 

    $_product = Mage::getModel('catalog/product')->load($product_id); 
    var_dump(($_quote->getId()), $_product->getQty()); 
    $_quote->addProduct($_product, new Varien_Object($params)); 
    $quote->collectTotals()->save(); 

輸出:

NULL string(4) "1465" int(100) string(4) "3325" int(100) string(1) "p" string(4) "3325" NULL {"status":"The requested quantity for \"Lava Lite 14.5\" Zebra Print Lava Lamp, Hot Pink Wax\" is not available."} 

請幫我

回答

0

嘗試

$cartHelper = Mage::helper('checkout/cart'); 
$items = $cartHelper->getCart()->getItems();   
foreach ($items as $item) 
{ 
    $itemId = $item->getItemId(); 
    $cartHelper->getCart()->removeItem($itemId)->save(); 
} 
相關問題