Hi,
I am a newbie and I am getting so crazy !!
I need to get "Minimum Quantity" on category list page !!
I have found some code on GG but nothing works!!
Does anyone can give my a hand on that?
Thank you
Best
Hi Tsoang,
Below this function you get minimum qty
$productQuantity = Mage::getModel("cataloginventory/stock_item")->loadByProduct($_product->getId()); $productQuantity->getMinSaleQty();
To change the default quantity
Hi Magikvishal,
Thank you for your help.
Where should I add this code? In which file?
Thx
Hi Magikvishal,
Thank you for your help.
Where should I add this code? In which file?
Thx
Hi @tsoang
myPakage == rwd
myTheme == default
For your purpose, Goto below path and edit list.phtml file: Magento_root/app/design/frontend/myPakage/myTheme/template/catalog/product/list.phtml
Edit the file and Add your code you require to display on frontend.
Hi magentoresolve,
Thank you for your answer!!
I have added the following code:
$productQuantity = Mage::getModel("cataloginventory/stock_item")->loadByProduct($_product->getId()); $productQuantity->getMinSaleQty();
But its doesn't work. on List view the code appear on the frontend !! :-( and on grid view just nothing.
I have also setup the minimum qty on backend !!
Is there a PHP something to add on the list.phtml with the code?
thank you for your help
Hi @tsoang
Please replace your code with below code after check frontend listing page grid view.
$productQuantity = Mage::getModel("cataloginventory/stock_item")->loadByProduct($_product->getId()); echo $productQuantity->getMinSaleQty();
hi magentoresolve
I am getting juts so crazy!! it does not work!!
Below a sreenshot!! and on grid mode just nothing!!
You need to edit app/design/frontend/default/YourTheme/template/catalog/product/list.phtml file
Find the below given line
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
And just replace it with,
<form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form_<?php echo $_product->getId()?>"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
<?php if(!$_product->isGrouped()): ?>
<label for="qty"><?php echo $this->__('Qty') ?>:</label>
<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo ($this->getMinimalQty($_product)?$this->getMinimalQty($_product):1) ?>" />
<?php endif; ?>
<button type="button" onclick="this.form.submit()"><span><span><span><?php echo $this->__('Add to Cart') ?></span></span></span></button>
</form>
Go to Admin Panel -> System -> Configuration -> Inventory-> Product Stock Options from the Menu
Click on Add Minimum Qty button (next to Minimum Qty Allowed in Shopping Cart option)
Choose Customer Group: ALL GROUPS as you want this to be applied to all users
Enter 1(any value you want) for Minimum Qty
Save Config
Hi kitharington
Thank you for your answer, the thing is I have a different qty for each product!
Does your method will work in this case?
thanks