I’ve just imported ~800 products into Magento before realising I had store_id set to 0 when it should have been 1.
Does anyone know an easy way to update this? I’ve tried changing the store_id to 1 in the spreadsheet and importing it again to update them but it hasn’t worked.
I found this SQL at http://www.magentocommerce.com/boards/viewthread/1798/ but I’m getting syntax errors and unknown column errors so I’ve not gone any further with it.
REPLACE INTO catalog_product_store (store_id, product_id) SELECT 1,entity_id from catalog_product_entity
update catalog_category_entity set store_id = 1 where store_id = 0;
update catalog_product_entity set store_id = 1 where store_id = 0;
update catalog_product_entity_datetime set store_id = 1 where store_id = 0;
update catalog_product_entity_decimal set store_id = 1 where store_id = 0;
update catalog_product_entity_gallery set store_id = 1 where store_id = 0;
update catalog_product_entity_int set store_id = 1 where store_id = 0;
update catalog_product_entity_text set store_id = 1 where store_id = 0;
update catalog_product_entity_tier_price set store_id = 1 where store_id = 0;
update catalog_product_entity_varchar set store_id = 1 where store_id = 0;
The store ID 0 is the admin store — it’s common to have this set when doing your custom imports. It’s not a problem unless you are working with multiple stores.
The quickest way to update your products is to go to your Catalog->Manage Products menu, select all products, and then select “Update Status” and submit. Then you can assign the website association in the Websites tab on the resulting menu.
Bulk edit all products:

To do it with code instead, you would want to loop through your product collection and set the website or store id there. An example: