I have been asking a few questions recently to work out how to change our Magento store's product codes.
The answer was to run this command within phpmyadmin:
UPDATE `catalog_product_entity` SET `sku` = RIGHT(CONCAT('00000000', sku), 8)
It worked perfectly, changing all of our product codes from:
63
3433
432
42342343
to:
00000063
00003433
00000432
42342343
The problem is; everytime I run that command it correctly changes the product codes - but all products are then 404'ing. I t开发者_如何学Pythonhen refreshed the indices and found that the were locked. I got the following error:
Cannot initialize the indexer process.
so I ran the following commands via SSH:
rm -rf downloader/pearlib/cache/*
rm -rf downloader/pearlib/download/*
rm -rf var/cache/*
rm -rf var/session/*
rm -rf var/report/*
rm -rf var/tmp/*
rm -rf var/locks/*
but the index processes still wouldn't run. I have now completely messed up the database and am waiting for a support tech to try and fix the problem. I will likely be recovering the database from the backup I took before I ran the SQL command.
I am trying to work out how to run this SQL command without messing the Magento (1.5) locks etc. up so that the products don't 404.
Ok, so the answer was simple.
- Disable all cache options
- Re-index the indices.
- Run the SQL command.
- Re-index the indices.
- Refresh then re-enable the cache
Hope this helps someone else in future!
精彩评论