public function getVariationValue(Ess_M2ePro_Model_Listing_Product_Variation $variation) { if ($variation->getChildObject()->isDelete()) { return 0; } return parent::getVariationValue($variation); }
public function getVariationValue(Ess_M2ePro_Model_Listing_Product_Variation $variation) { if ($this->getMagentoProduct()->isConfigurableType() || $this->getMagentoProduct()->isSimpleTypeWithCustomOptions() || $this->getMagentoProduct()->isGroupedType()) { $options = $variation->getOptions(true); $value = $this->getOptionBaseValue(reset($options)); } else { if ($this->getMagentoProduct()->isBundleType()) { $optionsQtyList = array(); $optionsQtyArray = array(); // grouping qty by product id foreach ($variation->getOptions(true) as $option) { if (!$option->getProductId()) { continue; } $optionsQtyArray[$option->getProductId()][] = $this->getOptionBaseValue($option); } foreach ($optionsQtyArray as $optionQty) { $optionsQtyList[] = floor($optionQty[0] / count($optionQty)); } $value = min($optionsQtyList); } else { throw new Ess_M2ePro_Model_Exception_Logic('Unknown Product type.'); } } $value = $this->applySellingFormatTemplateModifications($value); $value < 0 && ($value = 0); return (int) floor($value); }
private function getVariationDetails(Ess_M2ePro_Model_Listing_Product_Variation $variation) { $data = array(); /** @var Ess_M2ePro_Model_Ebay_Template_Description $ebayDescriptionTemplate */ $ebayDescriptionTemplate = $this->getEbayListingProduct()->getEbayDescriptionTemplate(); $this->searchNotFoundAttributes(); $tempValue = NULL; if ($ebayDescriptionTemplate->isProductDetailsModeDoesNotApply('brand')) { $tempValue = Ess_M2ePro_Model_Ebay_Listing_Product_Action_Request_Description::PRODUCT_DETAILS_UNBRANDED; } elseif ($ebayDescriptionTemplate->isProductDetailsModeAttribute('brand') && $this->processNotFoundAttributes(strtoupper('brand'))) { $tempValue = $this->getEbayListingProduct()->getDescriptionTemplateSource()->getProductDetail('brand'); } if ($tempValue) { $data['brand'] = $tempValue; } $options = NULL; $additionalData = $variation->getAdditionalData(); foreach (array('isbn', 'upc', 'ean', 'mpn') as $tempType) { if (isset($additionalData['product_details'][$tempType])) { $data[$tempType] = $additionalData['product_details'][$tempType]; continue; } if (!$this->getMagentoProduct()->isConfigurableType() && !$this->getMagentoProduct()->isGroupedType()) { continue; } if ($ebayDescriptionTemplate->isProductDetailsModeDoesNotApply($tempType)) { $data[$tempType] = Ess_M2ePro_Model_Ebay_Listing_Product_Action_Request_Description::PRODUCT_DETAILS_DOES_NOT_APPLY; continue; } $attribute = $ebayDescriptionTemplate->getProductDetailAttribute($tempType); if (!$attribute) { continue; } if (is_null($options)) { $options = $variation->getOptions(true); } /** @var $option Ess_M2ePro_Model_Listing_Product_Variation_Option */ $option = reset($options); $this->searchNotFoundAttributes(); $tempValue = $option->getMagentoProduct()->getAttributeValue($attribute); if (!$this->processNotFoundAttributes(strtoupper($tempType)) || !$tempValue) { continue; } $data[$tempType] = $tempValue; } return $this->deleteNotAllowedIdentifier($data); }
protected function applyAdditionalOptionValuesModifications(Ess_M2ePro_Model_Listing_Product_Variation $variation, $value) { foreach ($variation->getOptions(true) as $option) { if ($this->getMagentoProduct()->isConfigurableType()) { $value += $this->getConfigurableAdditionalOptionValue($option); } else { if ($this->getMagentoProduct()->isSimpleType()) { $value += $this->getSimpleWithCustomOptionsAdditionalOptionValue($option); } else { if ($this->getMagentoProduct()->isBundleType()) { $value += $this->getBundleAdditionalOptionValue($option); } } } } return $value; }