コード例 #1
0
ファイル: Associated.php プロジェクト: AleksNesh/pandora
 /**
  * @param array $params
  * @return mixed|string
  */
 public function mapDirectiveUrl($params = array())
 {
     $args = array('map' => $params['map']);
     $product = $this->getProduct();
     if (!$this->hasParentMap()) {
         return parent::mapDirectiveUrl($params);
     }
     switch ($this->getConfigVar('associated_products_link', 'configurable_products')) {
         case RocketWeb_GoogleBaseFeedGenerator_Model_Source_Product_Associated_Link::FROM_PARENT:
             $value = $this->hasParentMap() ? $this->getParentMap()->mapColumn($args['map']['column']) : '';
             break;
         case RocketWeb_GoogleBaseFeedGenerator_Model_Source_Product_Associated_Link::FROM_ASSOCIATED_PARENT:
             if ($product->isVisibleInSiteVisibility()) {
                 return parent::mapDirectiveUrl($params);
             } else {
                 $value = $this->hasParentMap() ? $this->getParentMap()->mapColumn($args['map']['column']) : parent::mapDirectiveUrl($params);
             }
             break;
         default:
             $value = $this->hasParentMap() ? $this->getParentMap()->mapColumn($args['map']['column']) : '';
     }
     // Add unique URLs to associated of bundle and configurable if the config is set.
     if ($this->hasParentMap()) {
         $typeId = $this->getParentMap()->getProduct()->getTypeId();
         $linkAddUnique = $this->getConfigVar('associated_products_link_add_unique', 'configurable_products') && ($typeId == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE || $typeId == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE);
         if ($linkAddUnique) {
             $value = $this->addUrlUniqueParams($value, $this->getProduct(), $this->getParentMap()->getOptionCodes($this->getProduct()->getEntityId()), $typeId);
         }
     }
     return $value;
 }