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

Category paths update
 
Radu.Groza
Jr. Member
 
Total Posts:  6
Joined:  2008-06-09
 

I (manually) added a bunch of categories using a php script (directly inserted them into following databases:
catalog_category_entity
catalog_category_entity_int
catalog_category_entity_text
catalog_category_entity_varchar

i know each category’s parent and I need to edit the ‘path’ field in catalog_category_entity.
can this be done automatically? there are a lot of categories and subcategories (about 700)
please help…

 
Magento Community Magento Community
Magento Community
Magento Community
 
corbykissler
Member
 
Total Posts:  39
Joined:  2008-05-14
 

Use sql to update the paths entry?

So for instance if you know the parent path you’d use something like this:

update catalog_category_entity set [category_path] = ‘parentdirect’&’/’&[category_field] where 1=1
or whatever your criteria is for knowing which data is yours

This also assumes that the category_field data is in the same table as the field you are updating . .

Correction:  Looks like mysql uses its own concat function . . it _appears_ you’d use this . . .

Update catalog_category_entity set [category_path] = CONCAT(’parentdirectory’, ‘/’ ,[category_field]) where 1=1

[category_path] above is whatever the name of the field is you want to update

CAUTION:  using 1=1 above will update every record in the database - I’m not sure that’s what you want.  The alternative is to use a data field or something else to let you delineate your records from whatever was there in the first place.

Good luck!

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