Skip to content

Instantly share code, notes, and snippets.

@ksysctl
Created April 2, 2013 15:43
Show Gist options
  • Select an option

  • Save ksysctl/5293232 to your computer and use it in GitHub Desktop.

Select an option

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