Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <?php
  2. include_once __DIR__ . '/app/Mage.php';
  3. Mage::app('admin');
  4.  
  5.  
  6. //Getting all prdoucts collection
  7. $collection = Mage::getResourceModel('productslider/product_collection')
  8. ->addAttributeToSelect('*');
  9.  
  10.  
  11. foreach($collection as $prod){
  12. $prodId = $prod->getId();
  13. $_product = Mage::getModel('catalog/product')->load($prodId);
  14. $categoryIds = $_product->getCategoryIds();
  15. if(count($categoryIds) == 0){
  16. //Delete prdouct
  17. //$_product->delete();
  18. echo $prodId;
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement