如何在购物车页面中获取批量?

时间:2021-04-12 07:21:20
$quote = Mage::getSingleton('checkout/session')->getQuote();
        $cartItems  = $quote->getAllVisibleItems();
        foreach ($cartItems as $item) {
            $productId = $item->getProductId();
            $product = Mage::getModel('catalog/product')->load($productId);
        }
        $batch_qty = $product->getBatchQty();

Through this code i can get the batch quantity, same way i need to get the batch quantity in the cart page how can i get this ?

通过这段代码,我可以得到批量,我需要获得购物车页面中的批量,我怎么能得到这个?

In the cart page i can see the

在购物车页面,我可以看到

$_item = $this->getItem();
$isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();

also product name echo $this->escapeHtml($this->getProductName()) why i am not getting batch quantity, i give $_item->getBatchQty(); but it is nothing retrieves.

还有产品名称echo $ this-> escapeHtml($ this-> getProductName())为什么我没有得到批量,我给$ _item-> getBatchQty();但它没有任何回收。

1 个解决方案

#1


$batchQty = Mage::getModel('catalog/product')->load($_item->getProduct()->getId())->getBatchQty()

Using this method I got the batch quantity.

使用这种方法,我得到了批量。

#1


$batchQty = Mage::getModel('catalog/product')->load($_item->getProduct()->getId())->getBatchQty()

Using this method I got the batch quantity.

使用这种方法,我得到了批量。