Magento 1.9 – How to Change Visibility of All Simple Products

catalogmagento-1.9simple-product

magento-1.9.2.4 I am using nginx server i would like to change catalog product visibility. only child products.

FROM "Catalog, Search" TO "Not Visible Individually" So please how can i do it from database

Best Answer

Mysql: Magento save the relation between configurable product and it child products at catalog_product_super_link and save it product basic data at catalog_product_entity Table.

enter image description here

Write select query with select type_id=simple simple product and check that product id exit at catalog_product_super_link table product_id. columns.

For getting Simple products that are associated with configurable product

    SELECT * FROM `catalog_product_entity` where entity_id 
 in (SELECT product_id FROM `catalog_product_super_link`) and type_id='simple'

Update Query:

UPDATE catalog_product_entity_int SET value = 1 WHERE
attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = "visibility")
AND
entity_id in (SELECT entity_id FROM catalog_product_entity where entity_id   in (SELECT product_id FROM catalog_product_super_link) and 
type_id='simple');