Adding Magento custom option fields with a module
I recently started a new job with a tiny company running a niche website on Magento. This is my first module, and I have no experience with Magento but can do pretty solid PHP and what have you. I'm having a hard time figuring out what it is I need to extend and how.
What I need to do is make a help bubble display beside every option that needs a help bubble, and when clicked have it display an image. In the backend this would be a drop-down box in each custom option box within every Product. Getting the actual functionality of the box isn't an issue; I'm just lost as to how to get the box in there in the first place.
In terms of what I've tried, I looked at Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option
and overriding the getOptionValues()
method, but there are getters in there that claim to live in Mage_Catalog_Model_Product_Option
and aren't.
My question is, what do I override and where can I find 开发者_Go百科it? Any help at all would be great; thanks a lot.
I'm trying to summarize our discussion here.
- Write layout update in your module backend layout update xml file to replace adminhtml/catalog_product_edit_tab_options block with your own block (let's call it A) (you can't replace Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option via layout update directly as we both know).
- Extend your block from Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option (let's call this block B) and load this your block class in _prepareLayout() method of you block class A.
- Do what you need in getOptionValues() of block B.
- Make changes in block B template file (copy content of \app\design\adminhtml\default\default\template\catalog\product\edit\options\option.phtml to your template file and make needed changes).
精彩评论