Reputation: 786
I have a basic product in Magento Enterprise (v1.11.2.0). I need to add 0 to many instruction sheets to this product. I know I could just hard code the links within a textbox and have them show on the page, but at some point, I'm going to need to access the value(s) for these attributes through the Magento API, so I need to break them out.
I know I could add multiple attributes to the set (ex. instruction-1, instruction-2, etc.), but that's not very clean or scalable.
I also know that I could add multiple "Custom Options", but something about that just doesn't seem right. If I come across a product that needs these custom options, that is really going to muddy up the user-facing view logic distinguishing between the two (actual custom options and faux custom options).
Ideas?
Upvotes: 0
Views: 1912
Reputation: 5685
Create one attribute called instructions
as varchar
in eav_attribute. Save all the data of instruction-1, instruction-2, etc.. in instructions
attribute in serialized form. So, next time when you show the instructions, just unserialize them and you will be good to go.
Or are you looking something different?
Upvotes: 1
Reputation: 578
It's possible depending on how much work you're willing to do. I recently built a module with a many-to-one relationship and based it off of how tier pricing works. I basically used a custom renderer looping through all the current values and inserting them into a table. Then I used javascript to insert and delete rows. If you copy the classes magento used for tier pricing, you shouldn't have too much of a problem.
Upvotes: 0