Created
March 19, 2015 13:34
-
-
Save oreales/986c6f58f2f63f126e7b to your computer and use it in GitHub Desktop.
Insert product weights for all products without weight in database (Magento)
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
#select to view all products without weight in database: | |
#TAKE CARE that weight attribute id is the right value | |
SELECT p.sku, w.value FROM catalog_product_entity as p | |
LEFT JOIN catalog_product_entity_decimal as w ON (p.entity_id = w.entity_id AND w.attribute_id = 101) | |
WHERE w.value IS NOT NULL; | |
#insert weight in catalog_product_entity_decimal for all products without value in that table: | |
#TAKE CARE to use the right entity_ids (depending on magento version) | |
INSERT INTO catalog_product_entity_decimal (entity_type_id, attribute_id, store_id, entity_id, value) | |
SELECT 10, 101, 0, p.entity_id, 1.000 FROM catalog_product_entity as p | |
LEFT JOIN catalog_product_entity_decimal as w ON (p.entity_id = w.entity_id AND w.attribute_id = 101) | |
WHERE w.value IS NULL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment