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

How to categorize products after importing them
 
Capitaine Commerce
Member
 
Avatar
Total Posts:  68
Joined:  2007-09-01
Lille, France
 

Hi !
At last I succeed in importing a csv file in the Magento database, but there is still an oblivious problem.
Products are not stored in categories so you have edit manually each product to put it in a category.
Needless to say it’s a pain in the ass if you got more a 100 products and more.
So i tried this little query in my phpmyadmin to fix the problem :

insert into catalog_category_product (product_idselect entity_id from catalog_product_entity;

Which worked pretty cool, except that my products don’t show up in the front office. So I took a look in the back office and could see that all my products where actually stored in a category but their names and prices were missing.
Well that means that I miss something somewhere, some kind of a little SQL query, but which one ? Can anyone tell me ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Michael_1
Enthusiast
 
Total Posts:  826
Joined:  2007-08-31
 

Hi Capitaine Commerce,

What do you mean saying that the products were imported successfully, but the same time they don’t have no names nor prices ?
Regarding the SQL you posted here - what category do you try to assign all the products to ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mark_Kimsal
Sr. Member
 
Total Posts:  186
Joined:  2007-09-12
Michigan, USA
 

@Capitaine Commerce
Your SQL is missing a category ID

Clean up what you ran before with:

DELETE from catalog_category_product WHERE category_id 0

Then run this modified statement to insert all products into 1 category

insert into catalog_category_product (category_idproduct_idselect 3,entity_id from catalog_product_entity

Change 3 to whichever category ID you want to put these into.

Strange that the import doesn’t let you put products into categories.

EDIT:
Shoot, or just do this

UPDATE catalog_category_product SET category_id 3 where category_id =0
 
Magento Community Magento Community
Magento Community
Magento Community
 
Capitaine Commerce
Member
 
Avatar
Total Posts:  68
Joined:  2007-09-01
Lille, France
 

Hi guys !
Thank you for your responses. Indeed my SQL query what incomplete, but that doesn’t change the problem when I assign a category to a product with this query.

Please have a look at the picture I attached with this thread so can you can see what I mean when saying “You can’t see the name or the price of the product”

Image Attachments
mage_screenshot_1.png
 
Magento Community Magento Community
Magento Community
Magento Community
 
Michael_1
Enthusiast
 
Total Posts:  826
Joined:  2007-08-31
 

Could check what name and price does any of those products have in the store ‘Praticado’ ? Just make sure you have selected this store in store drop-down on product edit page. And what are product status and visibilty values in that store ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Alessandro Perrone
Jr. Member
 
Total Posts:  13
Joined:  2008-07-22
 

I’d need to add existing already categorized products to other categories (i.e. a product in category 1 must be inserted also in category 5). I have Magento 1.1.1 and I know that you can do that from the product detail->categories but as I’d need to do this on a great number of products, is there an automatic way to do this without editing each single product?

Thanks in advance.

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