Magento:如何获得产品“最小销售数量”显示

时间:2012-08-21 00:33:27

标签: magento

下面的代码中的Magento 1.7我试图将产品属性“购物车中允许的最小数量”显示在前端。我错过了什么?感谢

<dl class="product-sku">
                    <dt><?php echo $this->__('Product SKU') ?>:</dt>
                    <dd><?php echo $_helper->productAttribute($_product, $_product->getSKU(), 'sku') ?></dd>

                    <dt><?php echo $this->__('Dimensions') ?>:</dt>
                    <dd><?php echo $_helper->productAttribute($_product, $_product->getDimensions(), 'dimensions') ?></dd>

                    <dt><?php echo $this->__('Configuration') ?>:</dt>
                    <dd><?php echo $_helper->productAttribute($_product, $_product->getConfiguration(), 'configuration') ?></dd>

                    <dt><?php echo $this->__('Minimum Purchase Quantity') ?>:</dt>
                    <dd><?php echo $_helper->productAttribute($_product, $_product->getMinSaleQty(), 'min_sale_qty') ?></dd>
                </dl>    

2 个答案:

答案 0 :(得分:13)

这应该有效:

$productQuantity = Mage::getModel("cataloginventory/stock_item")
->loadByProduct($_product->getId());

你的最低数量就在这里......

$productQuantity->getMinSaleQty();

答案 1 :(得分:0)

已加载的产品模型包含# This entry meant for .htaccess file RewriteEngine on RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} / [NC] RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L,NE] RewriteRule (.*) /index.php [L] # RewriteRule (.*) /folder/path [L] ,用于处理库存和库存信息。我喜欢处理此问题的方法是:

Mage_CatalogInventory_Model_Stock_Item Object