Magento had limited field in custom Options so if we required the New or To add the New field in the magento product Custom options just follow the steps
Note : Here DEAL is the new field you have to replace by your field name
1) Open the file adminhtml/default/default/catalog/product/edit/options/option.phtml
Just after this
Add the new field
Add the new field
3) In the same file check for the
4) Open the file app\code\core\Mage\Adminhtml\Block\Catalog\Product\Edit\Tab\Options\Option.php
and add in local folder app\code\core\Mage\Adminhtml\Block\Catalog\Product\Edit\Tab\Options\Option.php
search function getOptionValues()
Add the follwoing code
and in the same file check this Fucntion getRequireSelectHtml()
add new function
6) and add the new filed in the db in the table catalog_product_option or you can upgrade the script for adding the new field for the product custom options
That's it just clear the cache and and refresh your Browser
Note : Here DEAL is the new field you have to replace by your field name
1) Open the file adminhtml/default/default/catalog/product/edit/options/option.phtml
Just after this
'<th class="opt-req"><?php echo $this->jsQuoteEscape(Mage::helper('catalog')->__('Is Required')) ?></th>'+
Add the new field
'<th class="opt-deal"><?php echo $this->jsQuoteEscape(Mage::helper('catalog')->__('Is Deal')) ?></th>'+2) In the same file just after this
'<td class="opt-req"><?php echo $this->getRequireSelectHtml() ?></td>'+
Add the new field
'<td class="opt-deal"><?php echo $this->getDealSelectHtml() ?></td>'+
3) In the same file check for the
if (data.is_require) { $A($('<?php echo $this->getFieldId() ?>_'+data.id+'_is_require').options).each(function(option){ if (option.value==data.is_require) option.selected = true; }); }And below that add
if (data.is_deal) { $A($('<?php echo $this->getFieldId() ?>_'+data.id+'_is_deal').options).each(function(option){ if (option.value==data.is_deal) option.selected = true; }); }
4) Open the file app\code\core\Mage\Adminhtml\Block\Catalog\Product\Edit\Tab\Options\Option.php
and add in local folder app\code\core\Mage\Adminhtml\Block\Catalog\Product\Edit\Tab\Options\Option.php
search function getOptionValues()
$value['is_require'] = $option->getIsRequire();
Add the follwoing code
$value['is_deal'] = $option->getIsDeal();
and in the same file check this Fucntion getRequireSelectHtml()
add new function
public function getDealSelectHtml() { $select = $this->getLayout()->createBlock('adminhtml/html_select') ->setData(array( 'id' => $this->getFieldId().'_{{id}}_is_deal', 'class' => 'select' )) ->setName($this->getFieldName().'[{{id}}][is_deal]') ->setOptions(Mage::getSingleton('adminhtml/system_config_source_yesno')->toArray()); return $select->getHtml(); }
6) and add the new filed in the db in the table catalog_product_option or you can upgrade the script for adding the new field for the product custom options
That's it just clear the cache and and refresh your Browser
Good tweaks! can you post some on Magento GO
ReplyDeletewill be testing it
ReplyDeleteBig Thanks for your post.
ReplyDeleteDont mess in the Core files...so this a bad tweak!
ReplyDeleteya very true messing the core file is bad idea..i will try to make customize module ...
ReplyDeleteNot Work in magento 1.7 please Help...
ReplyDelete@pratik can you tell me what error you are getting
ReplyDeleteEdit your path from :
ReplyDeleteadminhtml/default/default/catalog/product/edit/options/option.phtml
To :
adminhtml/default/default/template/catalog/product/edit/options/option.phtml
Cant find the function getOptionValues() i just have this line of code .
ReplyDelete//adding data to templates
getOptionValues() as $_value): ?>
productOption.add(toJson() ?>);
productOptionType.addDataToValues(toJson() ?>);
Found it here :
ReplyDeleteapp/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Option.php
Can you please post a tutorial for how to do this: please check this
ReplyDeletehttp://postimg.org/image/sxe25labr/
Hi all
ReplyDeletewill update the Post ASAP