0

I would like to create an attribute that has tabular content much like the Tier Price. Where can I find examples of how to define an admin frontend client-side controller like Tier Price has? I am new to Magento so terminology of what these things are called would be helpful.

enter image description here

In the case of Tier Price, I have come to understand that the in-browser frontend tabular data entry control actually just serializes its content and stores a parsable string to a 'text' field (re: Why is Magento's "Tier Price" attribute of the type "text"?).

It seems like most of the heavy lifting would be done in a .phtml template. Is any processing done within a server-side controller or is it all HTML/JavaScript that makes such attributes work?

I am currently on Magento 1.9.x

jschrab
  • 215
  • 2
  • 8

1 Answers1

1

The Attribute is created here:

https://github.com/bragento/magento-core/blob/1264aee821b451b3c88e55659cd1ee79d3b324af/app/code/core/Mage/Catalog/Model/Resource/Setup.php#L590

Magento uses this class for the Resource Setup because of this configuration: https://github.com/bragento/magento-core/blob/1.9/app/code/core/Mage/Catalog/etc/config.xml#L419

In the attribute array the Backend Model is defined which is responsible for the loading and the saving of the attribute, which you can find here:

https://github.com/bragento/magento-core/blob/1.9/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Tierprice.php#L35

Parent: https://github.com/bragento/magento-core/blob/1.9/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Groupprice/Abstract.php#L217

From your question I assume that you have already found the template with the js in it (Not the fanciest one)? https://github.com/bragento/magento-core/blob/1264aee821b451b3c88e55659cd1ee79d3b324af/app/design/adminhtml/default/default/template/catalog/product/edit/price/tier.phtml

David Verholen
  • 6,312
  • 1
  • 20
  • 38
  • This points me in the direction I was looking for. I'm sure there are A LOT more details. Thanks much, David. – jschrab Feb 15 '16 at 21:45
  • For others trying to do the same, here are some things that helped me: 1) what you are trying to create is a custom "input renderer" and 2) Marius helped A TON with this fairly detailed example here - http://magento.stackexchange.com/questions/38434/adminhtml-how-to-add-custom-template-for-custom-product-attribute – jschrab Mar 03 '16 at 18:59