Skip to content

Instantly share code, notes, and snippets.

@Zifius
Created August 10, 2012 21:30
Show Gist options
  • Save Zifius/3318209 to your computer and use it in GitHub Desktop.
Save Zifius/3318209 to your computer and use it in GitHub Desktop.
Magento visibility being reset
<?php
// If you have hidden products never do collection
// saving, without adding visibility attribute to select
$products = Mage::getModel('catalog/product')
->getCollection()
// Important or visibility will be reset to default value (Visible in Catalog and Search)
->addAttributeToSelect(array('visibility', 'name'));
foreach ($products as $product) {
$product->setSomething('someValue');
}
$products->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment