/** * @return \Ess\M2ePro\Model\Magento\Product\Cache */ public function getMagentoProduct() { if (!$this->magentoProductModel) { $this->magentoProductModel = $this->modelFactory->getObject('Magento\\Product\\Cache')->setStoreId($this->getListing()->getStoreId())->setProductId($this->getData('product_id'))->setStatisticId($this->getListingProduct()->getId()); } $this->getListingProduct()->getMagentoProduct()->isCacheEnabled() ? $this->magentoProductModel->enableCache() : $this->magentoProductModel->disableCache(); return $this->magentoProductModel; }
protected function prepareMagentoProduct(\Ess\M2ePro\Model\Magento\Product\Cache $instance) { $instance->setStoreId($this->getListing()->getStoreId()); $instance->setStatisticId($this->getId()); if (method_exists($this->getChildObject(), 'prepareMagentoProduct')) { $instance = $this->getChildObject()->prepareMagentoProduct($instance); } return $instance; }
/** * @param \Ess\M2ePro\Model\Magento\Product\Cache $instance * @return \Ess\M2ePro\Model\Magento\Product\Cache * @throws \Ess\M2ePro\Model\Exception */ public function prepareMagentoProduct(\Ess\M2ePro\Model\Magento\Product\Cache $instance) { if (!$this->getVariationManager()->isRelationMode()) { return $instance; } if ($this->getVariationManager()->isRelationParentType()) { $parentTypeModel = $this->getVariationManager()->getTypeModel(); } else { $parentAmazonListingProduct = $this->getVariationManager()->getTypeModel()->getAmazonParentListingProduct(); $parentTypeModel = $parentAmazonListingProduct->getVariationManager()->getTypeModel(); } $instance->setVariationVirtualAttributes($parentTypeModel->getVirtualProductAttributes()); $instance->setVariationFilterAttributes($parentTypeModel->getVirtualChannelAttributes()); return $instance; }