コード例 #1
0
ファイル: Configurable.php プロジェクト: xiaoguizhidao/beut
 public function _map()
 {
     $rows = array();
     if ($this->getConfig()->isAllowConfigurableMode($this->getStoreId())) {
         if (!$this->isSkip()) {
             $row = parent::_map();
         }
         reset($row);
         $row = current($row);
         $rows[] = $row;
     }
     if ($this->getConfig()->isAllowAssociatedMode($this->getStoreId())) {
         foreach ($this->getAssocMaps() as $assocId => $assocMap) {
             $row = $assocMap->map();
             reset($row);
             $row = current($row);
             if (!$assocMap->isSkip()) {
                 $rows[] = $row;
             }
         }
     }
     return $rows;
 }
コード例 #2
0
 /**
  * @return array
  */
 public function map()
 {
     $rows = array();
     $this->_beforeMap();
     if ($this->getConfig()->isAllowGroupedMode($this->getStoreId())) {
         if (!$this->isSkip()) {
             // simulate parent::map() without clearing associated_maps from memory, as associated more could be on.
             $row = parent::_map();
             reset($row);
             $row = current($row);
             $this->_checkEmptyColumns($row);
             if (!$this->isSkip()) {
                 $rows[] = $row;
             }
         }
     }
     if ($this->getConfig()->isAllowGroupedAssociatedMode($this->getStoreId())) {
         foreach ($this->getAssocMaps() as $assocMap) {
             $row = $assocMap->map();
             reset($row);
             $row = current($row);
             if (!$assocMap->isSkip()) {
                 $rows[] = $row;
             }
         }
     }
     // if any of the associated not skipped, force add them to the feed
     if (count($rows)) {
         $this->unSkip();
     }
     return $this->_afterMap($rows);
 }
コード例 #3
0
 public function _map()
 {
     $rows = array();
     $parentRow = null;
     if ($this->getConfig()->isAllowConfigurableMode($this->getStoreId())) {
         if (!$this->isSkip()) {
             $row = parent::_map();
             reset($row);
             $parentRow = current($row);
         }
     }
     if ($this->getConfig()->isAllowConfigurableAssociatedMode($this->getStoreId()) && !$this->hasSkipAssocs() && $this->hasAssocMaps()) {
         foreach ($this->getAssocMaps() as $assocId => $assocMap) {
             $row = $assocMap->map();
             reset($row);
             $row = current($row);
             if (!$this->getTools()->isModuleEnabled('OrganicInternet_SimpleConfigurableProducts')) {
                 // [Default Magento] Overwrite price with configurable price if no option price set.
                 if ($assocMap->getProduct()->hasOptionPrice() && !$assocMap->getProduct()->getOptionPrice() && $parentRow) {
                     $row['price'] = $parentRow['price'];
                 }
             }
             if (!$assocMap->isSkip()) {
                 $rows[] = $row;
             }
         }
     }
     // Fill in parent columns specified in $inherit_columns with values list from associated items
     if (!is_null($parentRow)) {
         $this->mergeVariantValuesToParent($parentRow, $rows);
         array_unshift($rows, $parentRow);
     }
     return $rows;
 }
コード例 #4
0
ファイル: Bundle.php プロジェクト: AleksNesh/pandora
 /**
  * @return array
  */
 public function map()
 {
     $rows = array();
     $parentRow = null;
     $this->_beforeMap();
     if ($this->getConfig()->isAllowBundleMode($this->getStoreId())) {
         if (!$this->isSkip()) {
             // simulate parent::map() without clearing associated_maps from memory, as associated more could be on.
             $row = parent::_map();
             reset($row);
             $parentRow = current($row);
             // remove parent and skipping flag so that the associated items could still be processed.
             if ($this->isSkip()) {
                 $parentRow = null;
             }
         }
     }
     if ($this->getConfig()->isAllowBundleAssociatedMode($this->getStoreId()) && $this->hasAssocMaps()) {
         foreach ($this->getAssocMaps() as $assocMap) {
             $row = $assocMap->map();
             reset($row);
             $row = current($row);
             if (!$assocMap->isSkip()) {
                 $rows[] = $row;
             }
         }
     }
     // Fill in parent columns specified in $inherit_columns with values list from associated items
     if (!is_null($parentRow)) {
         $this->mergeVariantValuesToParent($parentRow, $rows);
         array_unshift($rows, $parentRow);
     }
     // if any of the associated not skipped, force add them to the feed
     if (count($rows)) {
         $this->unSkip();
     }
     return $this->_afterMap($rows);
 }
コード例 #5
0
 public function map()
 {
     $rows = array();
     $parentRow = null;
     $this->_beforeMap();
     if ($this->getConfig()->isAllowConfigurableMode($this->getStoreId())) {
         if (!$this->isSkip()) {
             // simulate parent::map() without clearing associated_maps from memory, as associated more could be on.
             $row = parent::_map();
             reset($row);
             $parentRow = current($row);
             $this->_checkEmptyColumns($parentRow);
             // remove parent and skipping flag so that the associated items could still be processed.
             if ($this->isSkip()) {
                 $parentRow = null;
             }
         }
     }
     if ($this->getConfig()->isAllowConfigurableAssociatedMode($this->getStoreId()) && !$this->hasSkipAssocs() && $this->hasAssocMaps()) {
         foreach ($this->getAssocMaps() as $assocMap) {
             $row = $assocMap->map();
             reset($row);
             $row = current($row);
             if (!Mage::getSingleton('googlebasefeedgenerator/config')->isSimplePricingEnabled($this->getData('store_id'))) {
                 // [Default Magento] Overwrite price with configurable price if no option price set.
                 if ($assocMap->getProduct()->hasOptionPrice() && !$assocMap->getProduct()->getOptionPrice() && $parentRow) {
                     $row['price'] = $parentRow['price'];
                 }
             }
             if (!$assocMap->isSkip()) {
                 $rows[] = $row;
             }
         }
     }
     // Fill in parent columns specified in $inherit_columns with values list from associated items
     if (!is_null($parentRow)) {
         $this->mergeVariantValuesToParent($parentRow, $rows);
         array_unshift($rows, $parentRow);
     }
     // if any of the associated not skipped, force add them to the feed
     if (count($rows)) {
         $this->unSkip();
     }
     return $this->_afterMap($rows);
 }