/** * @param RocketWeb_GoogleBaseFeedGenerator_Model_Map_Product_Abstract $productMap */ protected function addProductToFeed($productMap) { try { $rows = $productMap->map(); // if (get_class($productMap) != 'RocketWeb_GoogleBaseFeedGenerator_Model_Map_Product_Configurable_Apparel') { $rows = $productMap->map(); } if ($productMap->isSkip()) { $this->_count_products_skipped++; return $this; } if (($productMap->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE || $productMap->getProduct()->getTypeId() == RocketWeb_GoogleBaseFeedGenerator_Model_Map_Product_Subscription_Configurable::PRODUCT_TYPE_SUBSCTIPTION_CONFIGURABLE) && $productMap->getIsApparel() && $productMap->hasAssocMaps() && $productMap->getIsVariants()) { foreach ($productMap->getAssocMaps() as $assocMap) { if ($assocMap->isSkip()) { $this->_count_products_skipped++; } } } foreach ($rows as $row) { // format prices foreach ($row as $column => $value) { if (($column == "price" || $column == "sale_price") && trim($value) != "") { $row[$column] = $this->formatPrice($value); } } $this->writeFeed($row); $this->_count_products_exported++; } } catch (Exception $e) { $this->log($e->getMessage(), Zend_Log::ERR); if ($this->getTestMode()) { if ($productMap instanceof RocketWeb_GoogleBaseFeedGenerator_Model_Map_Product_Abstract && $productMap->getProduct() instanceof Mage_Catalog_Model_Product) { Mage::throwException(sprintf("product id %d product sku %s: " . $e->getMessage(), $productMap->getProduct()->getId(), $productMap->getProduct()->getSku())); } else { Mage::throwException($e->getMessage()); } } } return $this; }