0
votes

Good morning I installed Magento ver. 1.9.2.1 and I need to delete the box quantity only on some products. I was thinking, for example, when max quantity is set to 1, instead for other products leave the box. Thank you, do you have any suggestions?

Nicola

I tried to modify the file addtochar.phtml but without success. I attach the code ?>getProduct(); ?> ('Add to Cart'); ?> 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(); ?>

1

1 Answers

0
votes

I hope this code will help you.

<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>

Please pay attention to this line: <?php $hiddenFlag = in_array($_product->getId(), array(10,20,30,40)) ? true : false; ?> it will check if product eligible for a qty visibility.