제품 양 장바구니에 대한 모든 하나의 제품[마감]
-
12-12-2019 - |
문제
$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 사용하십시오 getAllVisibleItems
대 getAllItems
한 없음 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>";
제휴하지 않습니다 magento.stackexchange