/** * @return Ess_M2ePro_Model_Ebay_Template_Category */ public function getCategoryTemplate() { if (is_null($this->categoryTemplateModel)) { $this->categoryTemplateModel = Mage::helper('M2ePro')->getCachedObject('Ebay_Template_Category', $this->getTemplateCategoryId(), NULL, array('template')); if (!is_null($this->getMagentoProduct())) { $this->categoryTemplateModel->setMagentoProduct($this->getMagentoProduct()); } } return $this->categoryTemplateModel; }
/** * @return Ess_M2ePro_Model_Ebay_Template_Category */ public function getCategoryTemplate() { if (is_null($this->categoryTemplateModel)) { try { $this->categoryTemplateModel = Mage::helper('M2ePro')->getCachedObject('Ebay_Template_Category', (int) $this->getAddingTemplateCategoryId(), NULL, array('template')); } catch (Exception $exception) { return $this->categoryTemplateModel; } if (!is_null($this->getMagentoProduct())) { $this->categoryTemplateModel->setMagentoProduct($this->getMagentoProduct()); } } return $this->categoryTemplateModel; }
protected function isMainCategoryWasChanged(Ess_M2ePro_Model_Ebay_Template_Category $template, $selectedValue) { return $template->getData('category_main_id') != $selectedValue && $template->getData('category_main_attribute') != $selectedValue; }
protected function addAttributeSetData(Ess_M2ePro_Model_Listing_Product $listingProduct, Ess_M2ePro_Model_Ebay_Template_Category $categoryTemplate, array &$requestData) { $requestData['attribute_set'] = array('attribute_set_id' => 0, 'attributes' => array()); $filters = array('mode' => Ess_M2ePro_Model_Ebay_Template_Category_Specific::MODE_ATTRIBUTE_SET); $specifics = $categoryTemplate->getSpecifics(true, $filters); foreach ($specifics as $specific) { /** @var $specific Ess_M2ePro_Model_Ebay_Template_Category_Specific */ $categoryTemplate->getMagentoProduct()->clearNotFoundAttributes(); $tempAttributeData = $specific->getAttributeData(); $tempAttributeValues = $specific->getValues(); $notFoundAttributes = $categoryTemplate->getMagentoProduct()->getNotFoundAttributes(); if (!empty($notFoundAttributes)) { Mage::getModel('M2ePro/Connector_Server_Ebay_Item_Helper')->addNotFoundAttributesMessage($listingProduct, Mage::helper('M2ePro')->__('Specifics'), $notFoundAttributes); continue; } $requestData['attribute_set']['attribute_set_id'] = $specific->getModeRelationId(); $requestData['attribute_set']['attributes'][] = array('id' => $tempAttributeData['id'], 'value' => $tempAttributeValues); } }