0

I'm trying to disable the Qty field on the product edit tab.

I've created a local Mage override of:

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Simple.php on line 140 (original):

/* Inventory Data */
    $fieldset->addField('simple_product_inventory_qty', 'text', array(
        'label' => Mage::helper('catalog')->__('Qty'),
        'name'  => 'stock_data[qty]',
        'class' => 'validate-number',
        'required' => true,
        'value'  => 0
    ));

And changed it to:

/* Inventory Data */
    $fieldset->addField('simple_product_inventory_qty', 'text', array(
        'label' => Mage::helper('catalog')->__('Qty'),
        'name'  => 'stock_data[qty]',
        'disabled' => true,
        'value'  => 0
    ));

I've flushed the cache & still no difference. I've even tried editing the core file itself for testing purposes, and even that makes no difference, even if I completely remove the whole field set addition.

1 Answer 1

2

The qty field comes from the template file app/design/adminhtml/default/default/template/catalog/product/tab/inventory.phtml

    <tr>
        <td class="label"><label for="inventory_qty"><?php echo Mage::helper('catalog')->__('Qty') ?><span class="required">*</span></label></td>
        <td class="value">
            <?php if (!$_readonly):?>
            <input type="hidden" id="original_inventory_qty" name="<?php echo $this->getFieldSuffix() ?>[stock_data][original_inventory_qty]" value="<?php echo $this->getFieldValue('qty')*1 ?>"/>
            <?php endif;?>
            <input type="text" class="input-text required-entry validate-number" id="inventory_qty" name="<?php echo $this->getFieldSuffix() ?>[stock_data][qty]" value="<?php echo $this->getFieldValue('qty')*1 ?>" <?php echo $_readonly;?>/>
        </td>
        <td class="value scope-label"><?php echo Mage::helper('adminhtml')->__('[GLOBAL]') ?></td>
    </tr>

You can change your admin theme and add your own template

1
  • Spot on - thanks for the theme advice too.
    – Moose
    Jan 28, 2014 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.