Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $productCollection = $obj->create('MagentoCatalogModelResourceModelProductCollection');
- $collection = $productCollection
- ->addAttributeToSelect('*')
- //->setPageSize(700) //Selecting 500 products pour TEST plus rapide
- ->load();
- echo "sku" . ';' . "name" . ';' . "mgs_brand" . ';' . "urbmag_season" . "n";
- foreach($collection as $product){
- $productType = $product->getTypeId(); // regarde si CONFIGURABLE
- if ($productType == "configurable" AND !$product->isAvailable()) { // CONF + OUT OF STOCK
- $productSku = $product->getSku();
- $productName = $product->getName();
- $productBrand = $product->getAttributeText('mgs_brand');
- $productSeason = $product->getAttributeText('urbmag_season');
- echo $productSku.';'.$productName.';'.$productBrand.';'.$productSeason."n";
- $children = $product->getTypeInstance()->getUsedProducts($product); // simple associés
- foreach ($children as $child) {
- $childSku = $child->getSku();
- $childName = $child->getName();
- echo $childSku.';'.$childName.';'.$productBrand.';'.$productSeason."n";
- }
- }
- }
Add Comment
Please, Sign In to add comment