Created
September 24, 2014 12:27
-
-
Save peterjaap/d4cefcaac36084a0a896 to your computer and use it in GitHub Desktop.
Magento SQL query to attach products that are not added to a website to the default website (id 1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO catalog_product_website | |
(product_id, website_id) | |
(SELECT catalog_product_entity.entity_id, '1' | |
FROM catalog_product_entity LEFT JOIN catalog_product_website ON catalog_product_entity.entity_id = catalog_product_website.product_id | |
GROUP BY catalog_product_entity.entity_id | |
HAVING COUNT(catalog_product_website.product_id) = 0 | |
ORDER BY sku DESC) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome, thanks!