Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Hide Magento 1 products with configurable parents
require_once 'abstract.php';
class Hide_Children_Products extends Mage_Shell_Abstract {
* Hide products having at least one configurable parent
public function run()
$products = Mage::getModel('catalog/product')
->addAttributeToFilter('type_id', array('eq' => 'configurable'));
foreach ($products as $product) {
$product = Mage::getModel('catalog/product')->load($product->getId());
$children = $product->getTypeInstance()->getUsedProducts($product);
foreach ($children as $child) {
if ($product->getStatus() &&
$product->getVisiblity() != Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE &&
$child->getVisibility() != Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE
) {
$child = Mage::getModel('catalog/product')->load($child->getId());
$shell = new Hide_Children_Products();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.