Guest User

Untitled

a guest
Mar 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. $productCollection = $obj->create('MagentoCatalogModelResourceModelProductCollection');
  2. $collection = $productCollection
  3. ->addAttributeToSelect('*')
  4. //->setPageSize(700) //Selecting 500 products pour TEST plus rapide
  5. ->load();
  6. echo "sku" . ';' . "name" . ';' . "mgs_brand" . ';' . "urbmag_season" . "n";
  7. foreach($collection as $product){
  8.  
  9. $productType = $product->getTypeId(); // regarde si CONFIGURABLE
  10.  
  11. if ($productType == "configurable" AND !$product->isAvailable()) { // CONF + OUT OF STOCK
  12. $productSku = $product->getSku();
  13. $productName = $product->getName();
  14. $productBrand = $product->getAttributeText('mgs_brand');
  15. $productSeason = $product->getAttributeText('urbmag_season');
  16. echo $productSku.';'.$productName.';'.$productBrand.';'.$productSeason."n";
  17.  
  18. $children = $product->getTypeInstance()->getUsedProducts($product); // simple associés
  19. foreach ($children as $child) {
  20. $childSku = $child->getSku();
  21. $childName = $child->getName();
  22. echo $childSku.';'.$childName.';'.$productBrand.';'.$productSeason."n";
  23. }
  24. }
  25. }
Add Comment
Please, Sign In to add comment