문제

    $cart = Mage::getModel('checkout/cart')->getQuote();
    $cartTotal =$cart->getGrandTotal();
    $cartItems = $cart->getAllItems();
            foreach ($cartItems as $item) 
            {
                $_product = $item->getProduct();
                $id=$_product->getId();
                $qty = $_product->getQty(); //get product Qty
                $image=$_product->getImageUrl();
            }
도움이 되었습니까?

해결책

Vaibhav 사용하십시오 getAllVisibleItemsgetAllItems

한 없음 qty 의 카트 항목을 얻을 필요가 사용하여 getQty()

$cart = Mage::getModel('checkout/cart')->getQuote();
$cartTotal =$cart->getGrandTotal();
$cartItems = $cart->getAllVisibleItems();
foreach ($cartItems as $item) 
{
    $_product = $item->getProduct();
    $id=$_product->getId();
    $qty =  $item->getQty(); //get item qty

}

current product qty 당신이 필요로드 product model by sku 다음 inventory 주체

$_producObject = Mage::getModel('catalog/product')->loadByAttribute('sku',$item->getSku());
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_producObject);
echo "<pre>"; 
print_r($stock->getData()); 
echo "</pre>";
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top