Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get product min sale quantity on product list view?

When I tried following code, it will just print empty string. How can I get product min sale quantity on this page?

catalog/product/list.phtml

<?php echo $_product->getStockItem()->getMinSaleQty(); ?>
like image 612
newbie Avatar asked Dec 28 '22 07:12

newbie


2 Answers

This code solved my problem, because I use quantity increments:

$productData = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product);
$qtyIncrements = $productData->getQtyIncrements();
like image 192
newbie Avatar answered Mar 09 '23 00:03

newbie


$_stock_data = $product->getStockItem()->getData();

$_qtde_min = (intval($_stock_data['min_sale_qty'])) ? intval($_stock_data['min_sale_qty']) : 1;
like image 42
Hilton Gonçalves Avatar answered Mar 09 '23 01:03

Hilton Gonçalves