如何在下拉菜单Magento中显示产品数量
我想在下拉列表中显示产品数量,如10,20,30,根据magento中的产品,请帮助我做什么 请帮忙如何在下拉菜单Magento中显示产品数量,magento,Magento,我想在下拉列表中显示产品数量,如10,20,30,根据magento中的产品,请帮助我做什么 请帮忙 谢谢我建议您为您的产品创建一个新的数字自定义属性,以便您可以为每个产品定义packsize/order倍数。然后转到这个文件 app/design/frontend/YOURFOLDER/YOURTHEME/template/catalog/product/view/addtocart.phtml 在此文件中,找到此代码 <?php if(!$_product->isGrouped
谢谢我建议您为您的产品创建一个新的数字自定义属性,以便您可以为每个产品定义packsize/order倍数。然后转到这个文件
app/design/frontend/YOURFOLDER/YOURTHEME/template/catalog/product/view/addtocart.phtml
在此文件中,找到此代码
<?php if(!$_product->isGrouped()): ?>
<label for="qty"><?php echo $this->__('Qty:') ?></label>
<input type="text" name="qty" id="qty" maxlength="12" value="1<?php //echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
<?php endif; ?>
到目前为止你试过什么?请提供一些代码,我们可以使用。这听起来很简单,请显示一些努力!
<?php if(!$_product->isGrouped()): ?>
<label for="qty"><?php echo $this->__('Qty:') ?></label>
<?php
$qtymultiple = $_product->getData('your_attribute_code'); // Add your attribute_id here
if(($qtymultiple == 1) || (!$qtymultiple)) { // No need to anything ?>
<input type="text" name="qty" id="qty" maxlength="12" value="1<?php //echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
<?php } else { //qty multiple requirement ?>
<select name="qty" id="qty" maxlength="12">
<?php
$countme = 1;
while ($countme < 101) { // Define how many multiples of the number to offer
echo '<option value="'.($qtymultiple*$countme).'">'.($qtymultiple*$countme).'</option>';
$countme++;
} ?>
</select>
<?php } ?>
<?php endif; ?>