-I have a spreadsheet ready to import.
-I’ve got a column for colors.
-The color I have in the spreadsheet is BLUE.
-I have not yet created a BLUE option in the color attribute in the back end. If I import the spreadsheet now then BLUE will not be included in the attribute option because it doesn’t exist in the back end.
What would be nice, is if when I import the spreadsheet the system recognizes that I have not yet added BLUE as an option to the back end, and automatically adds that option to the color attribute.
This would save major headaches for people who let’s say have 300 colors they need to add, or 500 manufacturers. Instead of the system not including those entries in the options, it say “oh, it looks like you have options to add to this attribute” and takes care of that automatically.
I know you can add mass info to the database directly, and in a more complex fashion, but ideally you’d want this process to be simple and streamlined. Especially in cases where people have clients who pee their pants at the thought of even seeing a live database, let alone executing anything on it
Seriously. How difficult can it be to program magento to automatically create these attribute options on import. Is there a way to do this via mysql? I found a thread titled: “Import Bulk Attributes"*, this might help.
I have created three functions that are extremely helpful in this process. If you are familiar with programming and the mage classes these will be extremely beneficial…
public function attributeValueExists($arg_attribute, $arg_value) { $attribute_model = Mage::getModel('eav/entity_attribute'); $attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ;
public function updateProductColor() { $color = 'blue'; $product = Mage::getModel('catalog/product')->load($your_product_id);
$color_id = $this->attributeValueExists('color', $color); //ask magento if the color 'blue' is already an attribute, if it does, return its attribute_id
if($color_id) //if the color value 'blue' does exist in magento already simply set { $product->setColor($color_id); $product->save(); } else //the color value 'blue' doesn't exist in magento, so add it, then set it { $color_id = $this->addAttributeValue('color', $color); $product->setColor($color_id); $product->save(); }
}
My implementation of this is a little different, as I am looping through all products and updating their color from a separate database, so I freehand wrote this out, if there are any mistakes, I will fix them. I hope this helps others, as I spent a great deal of time building this work around. I must also note, this has only been testing in 1.1.6.
I am also including some files that have been extremely helpful to me. I downloaded them here in the forums, but I can’t remember what user submitted them… sorry…
I suppose this could be turned into an extension that would allow a text value to be entered into a dropdown attribute and it would check to see if it already exists, then would associate that attribute to the product… I will see what I can do. I am extremely busy launching our companies new e-commerce site, but as soon as work settles down, I will see if I an bundle this up to an extension.
You’re awesome. Unfortunately I would need some documentation along with this in order to implement it. I’m just getting started as a programmer using PHP/MySQL. Once I really learn the ropes I would like to help out as much as possible since I am taking on e-commerce clients and will be using magento for the foreseeable future.
But, for now, I’m a ‘dummy’ and will need further help.
You’re awesome. Unfortunately I would need some documentation along with this in order to implement it. I’m just getting started as a programmer using PHP/MySQL. Once I really learn the ropes I would like to help out as much as possible since I am taking on e-commerce clients and will be using magento for the foreseeable future.
But, for now, I’m a ‘dummy’ and will need further help.
Thanks,
Ab.
If you have any specific questions, please fire away. I am extremely busy releasing a beta version of a new e-commerce site for a very large company, so I am wrapped up pulling 20+ hour days. Once work settles down, I would like to turn this into an extension. I am thinking that the extension will add the ability to load a product and call a function like “$product->setAttributeValue(’color’, $color)” or any dropdown attribute.
I agree this would be incredibly helpful. Right now I’m banging my head about how to import a huge amount of data with 80 different attributes, each having many, many attribute dropdown options. I am brand new to magento and liking it so far, but getting everything set up is a real pain.
One thing I may do is just use Access with the MySQL connector to (hackishly) copy and paste the attributes and their options into the appropriate tables.
Does anyone know why in the eav_attribute_option_value table, it creates each option value twice, once for store_id=0 and again for store_id=1? I’m only using one store, but is there another one in the background that I’m not using? It seems to do this whether I set the Scope to “Global”, “Store View”, or “Website”.
I have found that store_id=0 is “Admin” and store_id=1 is “Default Store View”. Of course these would be different if you’ve modified the stores. So I take it both are necessary to include in the attribute option values for some reason? Maybe it wouldn’t display in the admin section or in the customer section if you left one of them out?
I still don’t understand how attributes, attribute sets, and configurable products work, are related, or are made. I mean, I understand it to a certain point, but can someone give me a magento for dummies breakdown of attributes and configurable products. The knowledge base, users guides, and screencasts have not helped as they’re very short and offer very little in the way of examples and [most importantly] a LOGICAL explanation as to how and why things work the way they do. It’s not that I’m stupid, it’s just that I don’t think it’s very well documented, because I’ve followed the screen cast and configurable product instructions and I’m still not seeing any drop down menus on my configurable product page...even though my configurable product creation page is filled out and looks exactly like the one in the screen cast. It’s also very, very hard to get anyone in the forums to explain things like this. No one minds posting code, but when I’ve asked for simple instructions or definitions people literally don’t respond. I’ve posted something like 4 different threads with not a single response in the “How do I” forum.
@abijah I think I can psuedo code my whole import process. I have thousands of simple and configurable products and I have developed custom classes for importing, updating, and managing them. I would be more than glad to share my code, explain each step, and answer questions that you may have. I am extremely busy finishing up our site though. I will see if I can document my code better and share my entire library of classes and update scripts by next week. I have been able to automate 100% of the importing, updating, and managing of products, attributes, and their changes from our IBM DB2 business system with over 100,000 skus. I apologize for this taking so long, but I am working 14 - 18 hours a day trying to release our site.
Wow. Though I’m pretty much done with my current project, I’m very much interested in what you’ve written. When you’re done, and have time, let me know. Thanks
I will start a new thread and link to my thread in here. I will start writing on and off as I have time today. Hopefully I can write up the whole import process in a day or so.