Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

A suggestion to import configurable products + categories
 
snowman58
Member
 
Total Posts:  54
Joined:  2009-04-09
 
mageuser - 26 May 2009 09:00 PM

Antonio,
in order to have less difficulties to retrieve all necessary files and instruction I created this wiki page
I added only the instructions for the moment. Could you please upload the files and everything you think usefull?

Thanks

When I try to use the wiki link, I get an error: You’ve followed a link to a topic that doesn’t exist yet.

When I look at the wiki, I don’t find this topic.

Has it been moved somewhere else?

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
snowman58
Member
 
Total Posts:  54
Joined:  2009-04-09
 

I am a total newbie, so I need all the bred crumbs to follow the trail. Apparently I missed a turn because I am getting a couple error messages. I am using the 1.3.1.1.zip and the csv file in Pooch’s #132 (without changes).

I have added the advanced profile. But when I run the profile I get these messages:

# Notice: Undefined property: Mage_Catalog_Model_Convert_Adapter_Productimport::$_inventorySimpleFields in C:\wamp\www\toystore\app\code\local\mage\catalog\model\convert\adapter\Productimport.php on line 207

# Recoverable Error: Argument 1 passed to Mage_Catalog_Model_Product_Type_Configurable::canUseAttribute() must be an instance of Mage_Eav_Model_Entity_Attribute, boolean given, called in C:\wamp\www\toystore\app\code\local\mage\catalog\model\convert\adapter\Productimport.php on line 103 and defined in C:\wamp\www\toystore\app\code\core\Mage\Catalog\Model\Product\Type\Configurable.php on line 157

Any suggestions?

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pooch
Member
 
Total Posts:  70
Joined:  2008-05-15
Danville, CA USA
 

I believe you’re getting that issue because you don’t have an attribute set called “shoes” set up with an attribute called “size” on it… if you copied my csv verbatim you would need to do that too before it would work.

Make sure the attribute_set field is set to the correct value for your configurable products and that the config_attributes field has all of the fields (comma separated with no spaces in between) that you’re setting attributes for via the import.

eg. in the case of my csv the products are part of the “shoes” attribute set with “size” as a configurable attribute. If your attribute set was “cars” and the user could pick make and model as configurable attribues then you would put “make,model” in the config_attributes field.

Make sense?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pooch
Member
 
Total Posts:  70
Joined:  2008-05-15
Danville, CA USA
 

The updated link to the wiki is:
http://www.magentocommerce.com/wiki/how_to_add_products_using_the_import/how_to_automatically_import_simple_grouped_and_configurable_products

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pooch
Member
 
Total Posts:  70
Joined:  2008-05-15
Danville, CA USA
 

Antonio,

Are you able to assign products to subcategories with your import script? I can’t seem to make that work. I can only get them to assign to top level categories.

 
Magento Community Magento Community
Magento Community
Magento Community
 
snowman58
Member
 
Total Posts:  54
Joined:  2009-04-09
 
Pooch - 31 May 2009 07:35 PM

I believe you’re getting that issue because you don’t have an attribute set called “shoes” set up with an attribute called “size” on it.

Pooch - Thanks for the help. I am trying to use a known “Good” import to verify things before I launch into my own.

The Shoe attribute does exist including the size.
But to simplify I changed it to the Default attrib set & deleted the size and color columns. I now get a slightly different set of error messages.

# Notice: Undefined property: Mage_Catalog_Model_Convert_Adapter_Productimport::$_inventorySimpleFields in C:\wamp\www\toystore\app\code\local\mage\catalog\model\convert\adapter\Productimport.php on line 207

# Notice: Undefined property: Mage_Catalog_Model_Convert_Adapter_Productimport::$_inventorySimpleFields in C:\wamp\www\toystore\app\code\local\mage\catalog\model\convert\adapter\Productimport.php on line 207

# Notice: Undefined index: config_attributes in C:\wamp\www\toystore\app\code\local\mage\catalog\model\convert\adapter\Productimport.php on line 99

Thanks Again

 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 

Uhm… the related to this post wiki links are:

How to automatically import simple grouped and configurable products

How to generate a valid Magento customer password via shell script

(you only need to see the article categories http://www.magentocommerce.com/wiki/All%20Categories?idx=how_to_add_products_using_the_import)

s2!

 
Magento Community Magento Community
Magento Community
Magento Community
 
glandix2
Jr. Member
 
Total Posts:  8
Joined:  2009-06-02
 

Is this script still working?  I’m getting a number of errors about the _inventorySimpleFields and _inventoryOtherFields properties not existing with the latest version of Magento.  I looked in the old Product.php in the Adapter directory and they both exist there, but not in the latest version of Product.php.  Any ideas how to get this fixed?  I have a site I’m trying to get setup and really need this import ability!

Thanks,
Jesse

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pooch
Member
 
Total Posts:  70
Joined:  2008-05-15
Danville, CA USA
 

I was just testing out an upgrade to 1.3.2.1 and it looks like this import script doesn’t work now. I get the same errors.

NoticeUndefined propertyMage_Catalog_Model_Convert_Adapter_Productimport::$_inventorySimpleFields in /app/code/local/Mage/Catalog/Model/Convert/Adapter/Productimport.php on line 207
Will dig a bit deeper but if anyone comes across a fix or has it working in the latest version let us know!
 
Magento Community Magento Community
Magento Community
Magento Community
 
glandix2
Jr. Member
 
Total Posts:  8
Joined:  2009-06-02
 
Pooch - 02 June 2009 10:35 AM

I was just testing out an upgrade to 1.3.2.1 and it looks like this import script doesn’t work now. I get the same errors.

NoticeUndefined propertyMage_Catalog_Model_Convert_Adapter_Productimport::$_inventorySimpleFields in /app/code/local/Mage/Catalog/Model/Convert/Adapter/Productimport.php on line 207
Will dig a bit deeper but if anyone comes across a fix or has it working in the latest version let us know!

I was able to get further in the process by replacing _inventorySimpleFields with _inventoryFields, but then it gets hung up on _inventoryOtherFields :( ... not sure if that’s the proper way or not, but it was just a guess and it *seemed* to get things further ... not sure, because nowhere in any of the release notes are either _inventorySimpleFields or _inventoryOtherFields mentioned

 
Magento Community Magento Community
Magento Community
Magento Community
 
glandix2
Jr. Member
 
Total Posts:  8
Joined:  2009-06-02
 

Ok, I’ve made some minor progress ... i changed both _inventorySimpleFields and _inventoryOtherFields to _inventoryFields ... it mostly worked, but some things like visibility, price and category (on my configurable product) didn’t get imported.  Still looking through my CSV file to make sure it isn’t an error on my part

 
Magento Community Magento Community
Magento Community
Magento Community
 
glandix2
Jr. Member
 
Total Posts:  8
Joined:  2009-06-02
 

ok, here’s the fix:

on line #207 in Productimport.php, change it from:

if ( in_array$field$this -> _inventorySimpleFields ) ) {

to:

if ( in_array$field$this -> _inventoryFields ) ) {

then, on line #260 change it from:

$inventoryFields $product -> getTypeId() == 'simple' $this -> _inventorySimpleFields $this -> _inventoryOtherFields;

to:

$inventoryFields = isset($this->_inventoryFieldsProductTypes[$product->getTypeId()])
            ? 
$this->_inventoryFieldsProductTypes[$product->getTypeId()]
            
: array();

hope that helps!  seems to be working otherwise for me now! :D

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pooch
Member
 
Total Posts:  70
Joined:  2008-05-15
Danville, CA USA
 

Beat me to it… nice work Glandix! I’ll test when I get home tonight. Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
snowman58
Member
 
Total Posts:  54
Joined:  2009-04-09
 

glandix2,

Nice work figuring this out. I applied your patches and the error message is gone.

However it seems to be stuck on the first record (several hours). If it makes any difference I am running it from the system advanced profiles, since I don’t understand how the cron method works. Which of course may be the problem.

How are you debugging the script? I’d like to see if I can figure out why it is hung (if I can!).

Separate questions (assuming I can get past the hangup)
Can one use multi level categories?  i.e. level_one/level_two
Can one use multiple categories? i.e. cat_one, cat_two, cat_three

Thanks to everyone for the newbe help.

Using:
Magento ver. 1.3.2.1 - fresh install w/ sample database
mySQL ver. 5.1.33
PHP ver. 5.2.9.2
Apache ver. 2.2.11

 
Magento Community Magento Community
Magento Community
Magento Community
 
Simon@smARTstudiosUK
Jr. Member
 
Total Posts:  14
Joined:  2009-03-06
 

Hi Guys,
this is great work.

We had our development team adapt the script, allowing it to overwrite existing products that share the same SKU, and replacing images (with support for multiple images) as well. Essentially this allows our client to constantly update his product listings with fresh images, descriptions and so forth.

If any of the dev people are interested I can have them post it here to look at.

This is almost getting to the stage where we should think about rolling it out to a module proper!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top