Home » Php » php – Adding values to a magento dropdown or multi-select product attribute while adding a new product

php – Adding values to a magento dropdown or multi-select product attribute while adding a new product

Posted by: admin April 23, 2020 Leave a comment

Questions:

I’m wondering if anyone has found or written an extension that would allow a magento website administrator the ability to add values to their products attribute while adding the product. For example, if I sell books and want the book author to be in a drop down list so that it would be used in layered navigation, it seems odd that I would have to add the author via the attributes section before adding the product. From a workflow standpoint it really makes sense to have an “add new value” button next to the drop down on my add product screen.

Anyone have any thoughts or insight?

How to&Answers:

It’s a piece of cake to do, if you know jquery and the (if I may guess) extremely simple model behind magento.

As the other guy said, throw some money and I’ll do it 😉

Otherwise, real easy -> find where that dropdown is generated, add a button next to it that opens a popup which you fill “create a new thingie” stuff, create button -> +create +close +refresh your dropdown.

Definitely easy.

And considering the attribute dialog already exists in the tool you cold probably take most from there and just add the popup handlers / button / +refresh .

Answer:

This extension can Import/Export products and customers from/to CSV file. Create categories, add attribute options, import images and media galleries, reindex, refresh cache, media and price rules automatically. In addition you can backup the entire database in SQL format.

So from above, once you make the csv file, you just have to add the Author header and it would build the list from there. However, the attribute must exist first. I am using this method for the creation of my own manufacturer attribute options.

AMartinez_CustomImportExport

Answer:

Can’t say I have, but I’ve developed something similar that creates an attribute and adds it to multiple products, it’s completely possible, you just need to add something that will call the add attribute on the add product page or change the new product flow to allow a new attribute and add it if needed.
Don’t let them scare you, it’s not as hard as some people might describe 🙂

Answer:

My curiosity finally took over my laziness and I managed to create the module author requested. It’s available on github.

Please feel free to check it out and update it if you wish. Maybe in some near future I’ll post it on Magento Connect, if feedback is good.

Answer:

Here’s some code that checks if an attribute value exists and adds it if it doesn’t: http://www.magentocommerce.com/boards/viewthread/26234/

Shouldn’t be too hard to integrate it with the “Add product” form.