cancel
Showing results for 
Search instead for 
Did you mean: 

get minimum quantity display on list page

get minimum quantity display on list page

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

9 REPLIES

Re: get minimum quantity display on list page

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

  1. Go to Admin Panel -> System -> Configuration -> Inventory-> Product Stock Options from the Menu
  2. Click on Add Minimum Qty button (next to Minimum Qty Allowed in Shopping Cart option)
  3. Choose Customer Group: ALL GROUPS as you want this to be applied to all users
  4. Enter 1(any value you want) for Minimum Qty
  5. Save Config

 

Re: get minimum quantity display on list page

Hi Magikvishal,

 

Thank you for your help.

 

Where should I add this code? In which file?

 

Thx

 

Re: get minimum quantity display on list page

Hi Magikvishal,

 

Thank you for your help.

 

Where should I add this code? In which file?

 

Thx

Re: get minimum quantity display on list page

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.

Query solved? Accept as Solution.Thanks
Eric Baily

Re: get minimum quantity display on list page

Hi

 

 

 

 

 

 

 

Re: get minimum quantity display on list page

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();
Query solved? Accept as Solution.Thanks
Eric Baily

Re: get minimum quantity display on list page

hi

 

I am getting juts so crazy!! it does not work!!

Below a sreenshot!! and on grid mode just nothing!!

Screen Shot 2016-06-21 at 14.58.17.jpg

Re: get minimum quantity display on list page

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

Re: get minimum quantity display on list page

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