First off, this is a fantastic script and a HUGE asset to the Magento community. Thank you for sharing it.
I’m having trouble importing a configurable product with 286 simple products configured on 2 attributes. The simple products are already in the database, and my sample import file is listed below. I get a partial import, where only 43 of the total 286 simple products are assigned to the new configurable product.
I am using Magento 1.2.0.2 and the Productwithconfigurablesandcategories.php file attached to the first post of this thread. Also, I’m doing the import from the admin and not a cron job. There are no errors during import.
Has anyone had success with configurable products associated with large quantities of simple products? Any advice is appreciated.
Thanks in advance!
"store","websites","type","status","options_container","gift_message_available","tax_class_id","visibility","disable_googlecheckout","qty","min_qty","use_config_min_qty","is_qty_decimal","backorders","use_config_backorders","min_sale_qty","use_config_min_sale_qty","max_sale_qty","use_config_max_sale_qty","is_in_stock","low_stock_date","notify_stock_qty","use_config_notify_stock_qty","manage_stock","use_config_manage_stock","stock_status_changed_automatically","has_options","custom_design","custom_layout_update","sku","image","small_image","thumbnail","url_key","url_path","attribute_set","config_attributes","required_options","category_ids","gender","shoe_width","made_in","shoe_mfr_ecco_colors","shoe_mfr_mbt_colors","manufacturer","shoe_mfr_sku","shoe_store_sku","men_shoe_size_us","women_shoe_size_us","name","weight","price","image_label","small_image_label","thumbnail_label","shoe_feat_upper","shoe_feat_outsole","shoe_feat_toe","shoe_feat_lining","shoe_feat_insole","shoe_feat_sole","shoe_feat_1","shoe_feat_2","shoe_feat_3","shoe_feat_4","shoe_feat_5","shoe_feat_6","description","short_description","meta_keyword","meta_title","meta_description","associated" "admin","base","configurable","Enabled","Block after Info Column","Use config","Taxable Goods","Catalog, Search","No"," ","0","1","0","0","1","1","1","0","1","1",,,"1","0","1","0","1",,,"2009_ECCO_TEST-M","/68104-55104_STONE.jpg","/68104-55104_STONE.jpg","/68104-55104_STONE.jpg","ecco-savage-low-(stone)","ecco-savage-low-(stone).html","Mfr_ECCO_Men","men_shoe_size_us,shoe_width","0","3,6","Men's",,"Thailand","Stone",,"ECCO","68104-55104","68104-55104",,,"ECCO TEST PRODUCT","2","180","ECCO Savage Low","ECCO Savage Low","ECCO Savage Low","Oil Nubuck Leather & Textile","Traction Rubber",,"Textile lining","Direct-injected PU midsole",,"Full-length Receptor technology","Gore-Tex waterproof system",,,,,"Long description: The Savage is an outdoor casual shoe with plenty of cushion and support for all your outdoor needs.","The Savage is an outdoor casual shoe with plenty of cushion and support for all your outdoor needs.",,,,"2009_ECCO_TEST-M-10-2A,2009_ECCO_TEST-M-10-2E,2009_ECCO_TEST-M-10-3E,2009_ECCO_TEST-M-10-4E,2009_ECCO_TEST-M-10-5E,2009_ECCO_TEST-M-10-6E,2009_ECCO_TEST-M-10-9E,2009_ECCO_TEST-M-10-A,2009_ECCO_TEST-M-10-ADJ,2009_ECCO_TEST-M-10-B,2009_ECCO_TEST-M-10-C,2009_ECCO_TEST-M-10-D,2009_ECCO_TEST-M-10-E,2009_ECCO_TEST-M-10.5-2A,2009_ECCO_TEST-M-10.5-2E,2009_ECCO_TEST-M-10.5-3E,2009_ECCO_TEST-M-10.5-4E,2009_ECCO_TEST-M-10.5-5E,2009_ECCO_TEST-M-10.5-6E,2009_ECCO_TEST-M-10.5-9E,2009_ECCO_TEST-M-10.5-A,2009_ECCO_TEST-M-10.5-ADJ,2009_ECCO_TEST-M-10.5-B,2009_ECCO_TEST-M-10.5-C,2009_ECCO_TEST-M-10.5-D,2009_ECCO_TEST-M-10.5-E,2009_ECCO_TEST-M-11-2A,2009_ECCO_TEST-M-11-2E,2009_ECCO_TEST-M-11-4E,2009_ECCO_TEST-M-11-5E,2009_ECCO_TEST-M-11-6E,2009_ECCO_TEST-M-11-9E,2009_ECCO_TEST-M-11-A,2009_ECCO_TEST-M-11-ADJ,2009_ECCO_TEST-M-11-B,2009_ECCO_TEST-M-11-C,2009_ECCO_TEST-M-11-D,2009_ECCO_TEST-M-11-E,2009_ECCO_TEST-M-11.5-2A,2009_ECCO_TEST-M-11.5-2E,2009_ECCO_TEST-M-11.5-3E,2009_ECCO_TEST-M-11.5-4E,2009_ECCO_TEST-M-11.5-5E,2009_ECCO_T"
Basically, make sure you’re careful sorting the SKU column in your CSV file. If you have SKUs like shirt1-small, shirt1-medium, shirt1-large etc. make sure they’re higher on the list (and so get uploaded before) your configurable products which have data in the associated column and have SKUs like shirt1.
I’ve been pulling my hair out for hours - and all it took was something so easy!
Yeah, that’s another thing! Glad you figured it out. I’m having another problem now. I have to bulk import more than 4000 attribute options and when I do this they stop showing up in admin interface.
I shortened up my product skus and now I can import 54 associations with the script. It appears my problem is related to the sku length. Is a variable or field getting maxed out?
UPDATE:
I added an echo statement for the $importData[’associated’]; variable to see what it had. It only has the first 54 skus. So the problem must be occurring in the code that parses the csv file…
UPDATE:
My mistake.... I had bad CSV files from the get go. The script is working properly.
Hi all,
once again I am facing a new problem when importing products and categories the way we do in this script.
Importing for a single language now works fine, even with tier prices and without SQL-injections. The problem starts when you add a second language (store view).
Obviously you will have to create your categories in the new language - but by adding them to your default root category id you’ll end up with a category tree that consists of multiple languages. Of course I could have a separate store with their respective root ids, but that doesn’t seem the way to do it.
Has anybody run into that issue and might have a solution?
I did manage to rewrite the import script so that now you can import categories with multiple languages. If anybody is interested in the mod please let me know.
Also, I stumbled upon another bug in the original script which prevents the correct caching of categories and might result in slower performance. Look for this code in the method _addCategories
when I started to import my data into different stores I ran into an error that has been mentioned before in this thread by Pooch.
Fatal error: Call to a member function getPath() on a non-object in app\code\core\Mage\Catalog\Model\Resource\Eav\Mysql4\Category.php on line 385
Obviously something is wrong with adding of the categories and after hours I was able to track the cause down to the resource class “Mage_Catalog_Model_Resource_Eav_Mysql4_Category”. In the method _getTree the private variable $_tree gets set and remains set whenever we are in our loop category adding loop.
This means that the tree doesn’t get reloaded in every loop which in turn causes the problem.
My quick and dirty solution in “Mage_Catalog_Model_Resource_Eav_Mysql4_Category” was this
which is of course not the correct way to do it. Does anybody have an idea how I can reset that private variable from outside the object or destroy the $cat object in every loop?
Probably an easy question, but I am out of ideas.
The funny thing is that this error does not occur on my local installation of Magento and also only when more than one store is enabled.
First of all amartinez, if you’re ever in the DC area I’ll buy you a cup of coffee! I just implemented your script on a store running 1.3.2.1. Thank you.
The missing piece of the puzzle at this point is adding prices to the associated products/options after import in an automated fashion. The store will have hundreds of configurable products, each associated to the same 25 simple products. After importing, I need to be able to push the pricing to all of the configurable products. And from an ongoing maintenance perspective, once the pricing is in place I need the ability to update pricing for a given simple product option ("change the price of XYZ on all configurable products from $10 to $15").
I’m digging through the forums right now, but if anyone has any pointers, a script, or some raw SQL that fits the bill, I would greatly appreciate it.
These configurable options are single or multiple?
Thanks by the cofee!
jaybenfield - 18 July 2009 04:48 PM
First of all amartinez, if you’re ever in the DC area I’ll buy you a cup of coffee! I just implemented your script on a store running 1.3.2.1. Thank you.
The missing piece of the puzzle at this point is adding prices to the associated products/options after import in an automated fashion. The store will have hundreds of configurable products, each associated to the same 25 simple products. After importing, I need to be able to push the pricing to all of the configurable products. And from an ongoing maintenance perspective, once the pricing is in place I need the ability to update pricing for a given simple product option ("change the price of XYZ on all configurable products from $10 to $15").
I’m digging through the forums right now, but if anyone has any pointers, a script, or some raw SQL that fits the bill, I would greatly appreciate it.
My first round of imports worked just fine, so I tried to upload a second set of products.
But when I go to the configurable product’s backend profile, after importing, it opens with the “Select Configurable Attributes” page asking me to choose my configurable attribute (which is ‘shirt_size’). Unless I highlight the right attribute, it won’t work and display the configurable product’s options on the frontend.
The thing is, I don’t think individually selecting the attribute for 5000 products is practical! I used the same .csv layout as before, so I don’t know where else I’m going wrong.
If you’re being asked to select the configurable attribute option for each product in the backend, make sure the configurable products ‘has_option’ column is set to ‘0’ in your .csv
Does anybody know how I can bypass the Select Configurable Attribute page for each configurable product on the backend?
I don’t want to have to manually select ‘Shirt Size’ for 5,000 products. I didn’t have to when I imported configurable products into a different Magento store. Only with this store.
I’m running Magento version 1.3.2.1. My configurable and simple products import just fine. When I’m in the admin I can clearly see that my configurable products have associated products attached to them. HOWEVER the associated products don’t show up on the website.
What’s weird is that I can get them to show up by visiting a simple product in the admin and clicking on the “Associated” link in the left nav and then click “Save”.
It’s almost like it isn’t saving the simple products correctly.
Anybody with a free moment care to look over the following files:
A QUICK EDIT...
I’ve noticed in the Database that when I manually click on a configurable product in the admin. Then in the left nav menu when I click on the link labled “Associated” - then click save. It changes the values for these tables in the configurable product.
Thanks for your prompt response! In looking into it, at least at the time, it seemed like configurable products was the best way to go. From a user interface perspective it works great. That is, it’s presented to the user exactly how I want it. It’s just the assignment of pricing to the associated products that is killing me by mouse-click.
To back up a little bit… The store sells photographs (prints). There are two attributes: print_type & print_size. Each simple product has both. There are only a couple print_types (print, canvas, etc.) but a number of print_sizes (8x10, 10x14, etc.). In all, there’s 24 different simple products that get associated to the configurable product, each with a unique price.
The configurable product is the visible/unique photograph. Each of the configurable products is associated with all of the simple products, and the price is always the same. If I have a photograph of a duck or a photograph of an airplane, the print_type ‘canvas’ and print_size ‘10x14’ will always be $xx. There is no variation in price between configurable products - only in the simple ones.
That said, what I’m looking for is to automatically set the price (5x7’s always $10, 8x10’s always $20, etc.) after import *and* be able to update the price across all 8x10’s without clicking hundreds of times.
Thanks again for your help!
Jay
amartinez - 19 July 2009 11:49 PM
Can you use grouped products?
These configurable options are single or multiple?
Thanks by the cofee!
jaybenfield - 18 July 2009 04:48 PM
First of all amartinez, if you’re ever in the DC area I’ll buy you a cup of coffee! I just implemented your script on a store running 1.3.2.1. Thank you.
The missing piece of the puzzle at this point is adding prices to the associated products/options after import in an automated fashion. The store will have hundreds of configurable products, each associated to the same 25 simple products. After importing, I need to be able to push the pricing to all of the configurable products. And from an ongoing maintenance perspective, once the pricing is in place I need the ability to update pricing for a given simple product option ("change the price of XYZ on all configurable products from $10 to $15").
I’m digging through the forums right now, but if anyone has any pointers, a script, or some raw SQL that fits the bill, I would greatly appreciate it.
for all those who try to use the cron script on European (e.g. Germany) servers: make sure to put
setlocale(LC_ALL, 'en_EN');
at the beginning of the cron_import_products.php
The reason for this is that Magento uses the PHP “floatval” function to return the formatted decimal numbers. This function, however, returns the numbers formatted based on the current locale. This will cause “45.50” to be returned as “45,50”. This results is the following error:
“SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn’t match value count at row 1”