protected function getOptionBaseValue(\Ess\M2ePro\Model\Listing\Product\Variation\Option $option) { if (!$option->getMagentoProduct()->isStatusEnabled() || !$option->getMagentoProduct()->isStockAvailability()) { return 0; } if ($this->getSource('mode') == \Ess\M2ePro\Model\Template\SellingFormat::QTY_MODE_PRODUCT) { if (!$this->getMagentoProduct()->isStatusEnabled() || !$this->getMagentoProduct()->isStockAvailability()) { return 0; } } return parent::getOptionBaseValue($option); }
protected function getBundleAdditionalOptionValue(Variation\Option $option) { $value = 0; if ($this->getMagentoProduct()->isBundlePriceTypeDynamic()) { return $value; } $product = $this->getMagentoProduct()->getProduct(); $productTypeInstance = $this->getMagentoProduct()->getTypeInstance(); $bundleAttributes = $productTypeInstance->getOptionsCollection($product); $attributeName = strtolower($option->getAttribute()); foreach ($bundleAttributes as $tempAttribute) { if (!(bool) (int) $tempAttribute->getData('required')) { continue; } if ((is_null($tempAttribute->getData('title')) || strtolower($tempAttribute->getData('title')) != $attributeName) && (is_null($tempAttribute->getData('default_title')) || strtolower($tempAttribute->getData('default_title')) != $attributeName)) { continue; } $tempOptions = $productTypeInstance->getSelectionsCollection(array(0 => $tempAttribute->getId()), $product)->getItems(); foreach ($tempOptions as $tempOption) { if ((int) $tempOption->getId() != $option->getProductId()) { continue; } if ((bool) (int) $tempOption->getData('selection_price_type')) { $value = $this->getProductBaseValue() * (double) $tempOption->getData('selection_price_value') / 100; } else { $value = (double) $tempOption->getData('selection_price_value'); if ($this->isSourceModeSpecial() && $this->getMagentoProduct()->isSpecialPriceActual()) { $value = $value * $product->getSpecialPrice() / 100; } $value = $this->convertValueFromStoreToMarketplace($value); } break 2; } } return $value; }
protected function getOptionBaseValue(\Ess\M2ePro\Model\Listing\Product\Variation\Option $option) { switch ($this->getSource('mode')) { case \Ess\M2ePro\Model\Template\SellingFormat::QTY_MODE_SINGLE: $value = 1; break; case \Ess\M2ePro\Model\Template\SellingFormat::QTY_MODE_NUMBER: $value = (int) $this->getSource('value'); break; case \Ess\M2ePro\Model\Template\SellingFormat::QTY_MODE_ATTRIBUTE: $value = (int) $option->getMagentoProduct()->getAttributeValue($this->getSource('attribute')); break; case \Ess\M2ePro\Model\Template\SellingFormat::QTY_MODE_PRODUCT_FIXED: $value = (int) $option->getMagentoProduct()->getQty(false); break; case \Ess\M2ePro\Model\Template\SellingFormat::QTY_MODE_PRODUCT: $value = (int) $option->getMagentoProduct()->getQty(true); break; default: throw new \Ess\M2ePro\Model\Exception\Logic('Unknown Mode in Database.'); } return $value; }