/** * add relations */ public function setRelations() { if ($this->getAdditionalInfo('relations')) { $relationsModel = new Shopgate_Model_Catalog_Relation(); /** * @todo change to crosssell is available */ $relationsModel->setType(Shopgate_Model_Catalog_Relation::DEFAULT_RELATION_TYPE_UPSELL); foreach ($this->getAdditionalInfo('relations') as $relation) { $relationsModel->addValue($relation['id_product']); } if (count($relationsModel->getValues())) { parent::setRelations(array($relationsModel)); } } }
/** * set relations */ public function setRelations() { $result = array(); $crossSellIds = $this->item->getCrossSellProductIds(); if (!empty($crossSellIds)) { $crossSellRelation = new Shopgate_Model_Catalog_Relation(); $crossSellRelation->setType(Shopgate_Model_Catalog_Relation::DEFAULT_RELATION_TYPE_UPSELL); $crossSellRelation->setValues($crossSellIds); $result[] = $crossSellRelation; } $upsellIds = $this->item->getUpSellProductIds(); if (!empty($upsellIds)) { $upSellRelation = new Shopgate_Model_Catalog_Relation(); $upSellRelation->setType(Shopgate_Model_Catalog_Relation::DEFAULT_RELATION_TYPE_UPSELL); $upSellRelation->setValues($upsellIds); $result[] = $upSellRelation; } $relatedIds = $this->item->getRelatedProductIds(); if (!empty($relatedIds)) { $relatedRelation = new Shopgate_Model_Catalog_Relation(); $relatedRelation->setType(Shopgate_Model_Catalog_Relation::DEFAULT_RELATION_TYPE_UPSELL); $relatedRelation->setValues($relatedIds); $result[] = $relatedRelation; } parent::setRelations($result); }