Guest User

Untitled

a guest
Oct 16th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <?php
  2.  
  3. require_once 'app/Mage.php';
  4. Mage::app();
  5.  
  6. $categoryId = '';
  7. $attributeCode = '';
  8. $attributeId = '';
  9. $products = Mage::getModel('catalog/category')->load($categoryId)->getProductCollection()->addAttributeToFilter($attributeCode, $attributeId);
  10.  
  11. if($products->getSize() < 1) {
  12. echo "None products found.\n";
  13. exit(0);
  14. }
  15.  
  16. Mage::register('isSecureArea', true);
  17.  
  18. foreach($products as $product) {
  19. $product->load($product->getId());
  20. echo "{$product->getSku()} - {$product->getName()}\n";
  21.  
  22. try {
  23. $product->setManufacturer(null)->save();
  24. } catch (Exception $e) {
  25. echo "ERROR: {$product->getSku()} | {$e->getMessage()} \n";
  26. }
  27. }
  28.  
  29. Mage::unregister('isSecureArea');
Add Comment
Please, Sign In to add comment