1

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 then 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.

4

1 回答 1

0

Ok, so the answer was simple.

  1. Disable all cache options
  2. Re-index the indices.
  3. Run the SQL command.
  4. Re-index the indices.
  5. Refresh then re-enable the cache

Hope this helps someone else in future!

于 2011-09-05T19:07:15.393 回答