Advertisement
imoda

Magento: Set Children of Configurable Products: Not Visible

May 6th, 2013
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. <pre><?php
  2.  
  3. include 'app/Mage.php';
  4. Mage::app();
  5. Mage::app()->setCurrentStore(0);
  6.  
  7. $confs = Mage::getResourceModel('catalog/product_collection')
  8.     ->addAttributeToFilter('type_id','configurable');
  9.  
  10. $prods = array();
  11.  
  12. foreach ($confs as $conf) {
  13.  
  14.     $simps = Mage::getModel('catalog/product_type_configurable')
  15.         ->getUsedProducts(null, $conf);
  16.  
  17.     foreach ($simps as $simp) {
  18.  
  19.         if ($simp->getVisibility() != 1) {
  20.  
  21.             echo $simp->getId() . " : " . $simp->getVisibility() . "\n";
  22.             $prods[] = $simp->getId();
  23.         }
  24.     }
  25. }
  26.  
  27. Mage::getSingleton('catalog/product_action')->updateAttributes(
  28.     $prods,
  29.     array("visibility" => 1),
  30.     0
  31. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement