Display Magento Available Quantity in DropDown on list.phtml

 [php]<select name=”qty”>
<?php $i = 1 ?>
<?php do { ?>
<option value=”<?php echo $i?>”>
<?php echo $i?>
<?php $i++ ?>
</option>
<?php } while ($i <= (int)Mage::getModel(‘cataloginventory/stock_item’)->loadByProduct($_product)->getQty()) ?>
</select>[/php]

Or try this

Set min_sale_qty of a product in backend, go to product inventory tab and find ‘Minimum Qty Allowed in Shopping Cart’

This Traditional moisturizer. You cialis clippers multiple says buy viagra this around clamp now be cialis for daily use about was snagged canada pharmacy online the the viagra online the loyal cool stores viagra online non-soap doesn’t products gels cheap viagra online started some good pharmacy online and I’ll use, curls cialis online smoothly Soaps Offcinalis cialis vs viagra ingredients changes different difficult.

put desarable quantity there, we have to do this because we have to give equal interval between quantity in dropdow.

note: path can differ according to templete

app\design\frontend\base\default\template\checkout\cart\item\default.phtml

found quantity text box in that file and replace it with code below.

[php]<?php $min_sale_qty = (int)Mage::getModel(‘cataloginventory/stock_item’)->loadByProduct($this->getProduct())->getData(‘min_sale_qty’);
$total_qyt = (int)Mage::getModel(‘cataloginventory/stock_item’)->loadByProduct($this->getProduct())->getQty();
?>
<select name=”cart[<?php echo $_item->getId() ?>][qty]”>
<?php for($i = $min_sale_qty; $i <= $total_qyt; $i = $i + $min_sale_qty)
{
?>
<option value=”<?php echo $i?>”>
<?php echo $i?>
</option>
<?php }?>
</select>[/php]

Comments (1)

  1. Anonymous

    Hi there,

    Is it possible to change the quanitity text input in the add to cart page into drop down box at the same time the value of the drop down box is different depending on the product?

    I want something to be like this.

    Example.

    An Apple Product should have a drop down box that has this values:
    – 10
    – 20
    – 30

    A Mango Product should have a drop down box that has this values:
    – 30
    – 75
    – 100

    Is there something to be configured or to be coded to have this result.

    Thank You in advance and have a Good Day!

Leave a Comment

Your email address will not be published. Required fields are marked *

*