2017-05-03 31 views
0

早安我安裝了Magento ver。 1.9.2.1我只需要在某些產品上刪除箱子數量。我想,例如,當最大數量設置爲1時,而不是其他產品離開箱子。謝謝,你有什麼建議嗎?刪除特定商品的數量框

尼古拉

我試圖修改文件addtochar.phtml但沒有成功。我附上代碼 ?> getProduct(); ?>('加入購物車'); ?> isSaleable()):?> isGrouped())?> __('Qty:')?> getProductDefaultQty()* 1?>「title =」quoteEscape($ this->('Qty'))? >「class =」input-text qty「/>」id =「product-addtocart-button」class =「button btn-cart」onclick =「productAddToCartForm.submit(this)」> getChildHtml('',true,true) ?> showButtonDesign(); ?>

回答

0

我希望這段代碼能幫到你。

<div class="add-to-cart"> 
    <?php if(!$_product->isGrouped()): ?> 
    <?php $hiddenFlag = in_array($_product->getId(), array(10,20,30,40)) ? true : false; ?> 
    <?php if (!$hiddenFlag): ?> 
     <label for="qty"><?php echo $this->__('Qty:') ?></label> 
    <?php endif;?> 
    <input type="<?php echo $hiddenFlag ? 'hidden' : 'text' ?>" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Qty')) ?>" class="input-text qty" /> 
    <?php endif; ?> 
    <button type="button" title="<?php echo $buttonTitle ?>" id="product-addtocart-button" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button> 
    <?php echo $this->getChildHtml('', true, true) ?> 
</div> 

請注意這一行:<?php $hiddenFlag = in_array($_product->getId(), array(10,20,30,40)) ? true : false; ?> it will check if product eligible for a qty visibility.

+0

謝謝你,我想知道,如果你能刪除箱量由ID定義的某些產品。 例如,指示ID 10,11,12,13,20,30等,並從具有這些ID的產品中移除箱子數量。 – nikoweb1969