Created
April 2, 2013 15:43
-
-
Save ksysctl/5293232 to your computer and use it in GitHub Desktop.
Set stock status for every configurable product on Magento only if has an image
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
| UPDATE | |
| `cataloginventory_stock_item` | |
| SET | |
| `cataloginventory_stock_item`.`is_in_stock` = '1' | |
| WHERE | |
| `cataloginventory_stock_item`.`product_id` IN | |
| ( | |
| SELECT | |
| a.entity_id | |
| FROM | |
| `catalog_product_entity` AS a | |
| INNER JOIN | |
| `eav_attribute` AS attribute ON attribute.attribute_code = 'image' AND attribute.frontend_input = 'media_image' | |
| LEFT JOIN | |
| `catalog_product_entity_varchar` AS b ON a.entity_id = b.entity_id AND b.attribute_id = attribute.attribute_id | |
| WHERE | |
| b.value <> '' AND b.value IS NOT NULL AND b.value <> 'no_selection' AND `type_id` = 'configurable' | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment