<?php echo $up_qty = $this->getProductDefaultQty() * 1 ?> //get selected quantity.
<?php $m_id = $_product->getId();
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($m_id);
$p_stock = $stock->getQty();//get total quantity.
?>
<select name="qty" id="qty" class="input-text qty" >
<?php
for($i=1; $i<=$p_stock; $i++) { ?>
<option <?php if($p_stock==$up_qty) {?> select="selected"<?php } ?>><?php echo $i; ?> </option>
<?php } ?>
</select>
<?php $m_id = $_product->getId();
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($m_id);
$p_stock = $stock->getQty();//get total quantity.
?>
<select name="qty" id="qty" class="input-text qty" >
<?php
for($i=1; $i<=$p_stock; $i++) { ?>
<option <?php if($p_stock==$up_qty) {?> select="selected"<?php } ?>><?php echo $i; ?> </option>
<?php } ?>
</select>
No comments:
Post a Comment