public function getData() { if (!$this->getConfigurator()->isNewProduct()) { return array(); } $newProductTemplate = $this->getBuyListingProduct()->getNewProductTemplate(); if (empty($newProductTemplate) || !$newProductTemplate->getId()) { return array(); } $data = array(); // --------------------- $coreSource = $newProductTemplate->getCoreTemplate()->getSource($this->getBuyListingProduct()->getActualMagentoProduct()); $msrpPrice = $this->getBuyListingProduct()->getPrice(); $coreData = array('seller_sku' => $coreSource->getSellerSku(), 'gtin' => $coreSource->getGtin(), 'isbn' => $coreSource->getIsbn(), 'asin' => $coreSource->getAsin(), 'mfg_name' => $coreSource->getMfgName(), 'mfg_part_number' => $coreSource->getMfgPartNumber(), 'product_set_id' => $coreSource->getProductSetId(), 'weight' => $coreSource->getWeight(), 'listing_price' => $msrpPrice, 'msrp' => $msrpPrice, 'category_id' => $newProductTemplate->getCategoryId()); $this->searchNotFoundAttributes(); $coreData['title'] = $coreSource->getTitle(); $this->processNotFoundAttributes('Title'); $this->searchNotFoundAttributes(); $coreData['description'] = $coreSource->getDescription(); $this->processNotFoundAttributes('Description'); $this->searchNotFoundAttributes(); $coreData['main_image'] = $coreSource->getMainImage(); $this->processNotFoundAttributes('Main Image'); $this->searchNotFoundAttributes(); $coreData['additional_messages'] = $coreSource->getAdditionalImages(); $this->processNotFoundAttributes('Additional Messages'); $this->searchNotFoundAttributes(); $coreData['keywords'] = $coreSource->getKeywords(); $this->processNotFoundAttributes('Keywords'); $this->searchNotFoundAttributes(); $coreData['features'] = $coreSource->getFeatures(); $this->processNotFoundAttributes('Features'); if (Ess_M2ePro_Model_Buy_Template_NewProduct::isAllowedUpcExemption() && is_null($coreData['gtin'])) { unset($coreData['gtin']); $coreData['upc_exemption'] = '1'; } $data['core'] = $coreData; // --------------------- // --------------------- $attributesData = array(); $this->searchNotFoundAttributes(); foreach ($newProductTemplate->getAttributes(true) as $attribute) { $tempValue = $attribute->getSource($this->getBuyListingProduct()->getActualMagentoProduct())->getValue(); $attributesData = array_merge($attributesData, $tempValue); } $this->processNotFoundAttributes('Attributes'); $data['attributes'] = $attributesData; // --------------------- return $data; }
public function isAllowedUpcExemption($formData) { $isAllowedUpcExemption = Ess_M2ePro_Model_Buy_Template_NewProduct::isAllowedUpcExemption(); $gtinMode = $formData['category']['gtin_mode']; return $isAllowedUpcExemption || $gtinMode == Ess_M2ePro_Model_Buy_Template_NewProduct_Core::GTIN_MODE_NONE; }
private function map(Ess_M2ePro_Model_Buy_Template_NewProduct $buyTemplateNewProductInstance) { if (count($this->listingProductIds) < 1) { $this->_getSession()->addError(Mage::helper('M2ePro')->__('There are no items to assign.')); return $this->_redirect('*/adminhtml_common_listing'); } $result = $buyTemplateNewProductInstance->map($this->listingProductIds); if (!$result) { $this->_getSession()->addError(Mage::helper('M2ePro')->__('Product(s) was not assigned')); return $this->_redirect('*/adminhtml_common_buy_template_newProduct/index'); } $listingId = Mage::helper('M2ePro/Component_Buy')->getObject('Listing_Product', reset($this->listingProductIds))->getListingId(); $tempMessage = Mage::helper('M2ePro')->__('Template has been successfully assigned.'); $this->_getSession()->addSuccess($tempMessage); return $this->_redirect('*/adminhtml_common_buy_listing/view', array('id' => $listingId)); }