1

I have 2000+ products all set to simple products but with custom options.

An option is a drop-down option with an SKU etc... What I want to know is, is it possible to add another input box after 'Sort Order' to say 'stock count'??

I'm using Magento 1.9.2.2

Current Custom Options

7
  • 1
    version please and could you share me any screenshot where you exact want to add? Feb 14, 2017 at 12:19
  • you want to add it as order attribute or product attribute ? Feb 14, 2017 at 12:20
  • @NAGARAJUK I've added this.
    – WebDevB
    Feb 14, 2017 at 12:38
  • @VishwasBhatnagar product option.
    – WebDevB
    Feb 14, 2017 at 12:39
  • Sure I will help you. Feb 14, 2017 at 13:40

1 Answer 1

5

Please follow the below steps:

Step1:

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Option.php

you have to modify the code in the line numbers 263 and 287 (or) search sku as keyword, based on that just keep below code.

line number 263

 'stockcount' => $_value->getStockcount(),

and in the line number 287

$value['stockcount'] = $option->getStockcount();
        

enter image description here

enter image description here

Step 2:

/app/design/adminhtml/default/default/template/catalog/product/edit/options/type/select.phtml
    

line number 42 add below code

'<th class="type-stockcount"><?php echo Mage::helper('core')->jsQuoteEscape(Mage::helper('catalog')->__('Stock Count')) ?></th>'+
    
    

line number 67

+'<td><input type="text" class="validate-zero-or-greater input-text" name="product[options][{{id}}][values][{{select_id}}][stockcount]" value="{{stockcount}}"></td>'+

step 3:

finally you should add create a column 'stockcount' in the database table called catalog_product_option_type_value as shown in the below screenshot

enter image description here

Finally clear cache and session

output:

corrected the links

2
  • You should never modify core code! Extend the classes instead. And do not extend the database table directly, always use setup scripts!
    – Black
    Oct 23, 2018 at 10:53
  • yes i will follow @Black thanks for your suggestion Oct 23, 2018 at 11:12

Your Answer

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

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