diff --git a/app/code/community/Ess/M2ePro/Model/Listing/Product/QtyCalculator.php b/app/code/community/Ess/M2ePro/Model/Listing/Product/QtyCalculator.php index 36320754..5deeef76 100644 --- a/app/code/community/Ess/M2ePro/Model/Listing/Product/QtyCalculator.php +++ b/app/code/community/Ess/M2ePro/Model/Listing/Product/QtyCalculator.php @@ -191,7 +191,14 @@ protected function getClearVariationValue(Ess_M2ePro_Model_Listing_Product_Varia continue; } - $optionsQtyArray[$option->getProductId()][] = $this->getOptionBaseValue($option); + $qty = $this->getOptionBaseValue($option); + $bundleDefaultQty = $this + ->getMagentoProduct() + ->getBundleDefaultQty($option->getProductId()); + + $qty /= $bundleDefaultQty; + + $optionsQtyArray[$option->getProductId()][] = $qty; } foreach ($optionsQtyArray as $optionQty) { diff --git a/app/code/community/Ess/M2ePro/Model/Magento/Product.php b/app/code/community/Ess/M2ePro/Model/Magento/Product.php index 7f6cdcaf..5f8ae8b1 100644 --- a/app/code/community/Ess/M2ePro/Model/Magento/Product.php +++ b/app/code/community/Ess/M2ePro/Model/Magento/Product.php @@ -945,6 +945,23 @@ public function getQty($lifeMode = false) ); } + public function getBundleDefaultQty($productId) + { + $product = $this->getProduct(); + $productInstance = $this->getTypeInstance(); + $optionCollection = $productInstance->getOptionsCollection($product); + $selectionsCollection = $productInstance->getSelectionsCollection($optionCollection->getAllIds(), $product); + $items = $selectionsCollection->getItems(); + + foreach ($items as $item) { + if ((int)$item->getId() === (int)$productId) { + return $item->getSelectionQty(); + } + } + + return 1; + } + public function setQty($value) { $this->getStockItem()->setQty($value)->save(); diff --git a/app/code/community/Ess/M2ePro/Model/Order/Reserve.php b/app/code/community/Ess/M2ePro/Model/Order/Reserve.php index 0ab3a50a..5def4527 100644 --- a/app/code/community/Ess/M2ePro/Model/Order/Reserve.php +++ b/app/code/community/Ess/M2ePro/Model/Order/Reserve.php @@ -231,6 +231,13 @@ protected function performAction($action, $newState) $productsExistCount++; + if ($item->getMagentoProduct()->isBundleType()) { + $bundleDefaultQty = $item + ->getMagentoProduct() + ->getBundleDefaultQty($magentoProduct->getProductId()); + $qty *= $bundleDefaultQty; + } + if (!isset($stockItems[$productId])) { $stockItems[$productId] = $magentoProduct->getStockItem(); } diff --git a/app/code/community/Ess/M2ePro/composer.json b/app/code/community/Ess/M2ePro/composer.json index a7326a7f..6efe169c 100644 --- a/app/code/community/Ess/M2ePro/composer.json +++ b/app/code/community/Ess/M2ePro/composer.json @@ -2,7 +2,7 @@ "name": "m2epro/magento1-extension", "description": "M2E Pro is a Magento trusted (TM), award-winning extension, which allows merchants of all sizes to fully integrate Magento based system(s) into eBay/Amazon/Walmart platforms.", "type": "magento-module", - "version": "6.43.3", + "version": "6.43.4", "license": "proprietary", "keywords": ["ebay", "amazon", "walmart", "magento"], "homepage": "https://www.m2epro.com/", diff --git a/app/code/community/Ess/M2ePro/etc/config.xml b/app/code/community/Ess/M2ePro/etc/config.xml index a9c38980..7f1466c2 100644 --- a/app/code/community/Ess/M2ePro/etc/config.xml +++ b/app/code/community/Ess/M2ePro/etc/config.xml @@ -2,7 +2,7 @@ - 6.43.3 + 6.43.4 diff --git a/app/code/community/Ess/M2ePro/sql/Upgrade/v6_42_0__v6_43_0/Config.php b/app/code/community/Ess/M2ePro/sql/Upgrade/v6_42_0__v6_43_0/Config.php index 39718f30..9887fd68 100644 --- a/app/code/community/Ess/M2ePro/sql/Upgrade/v6_42_0__v6_43_0/Config.php +++ b/app/code/community/Ess/M2ePro/sql/Upgrade/v6_42_0__v6_43_0/Config.php @@ -6,10 +6,12 @@ * @license Commercial use is forbidden */ -class Ess_M2ePro_Sql_Upgrade_v6_43_0__v6_43_3_Config extends Ess_M2ePro_Model_Upgrade_Feature_AbstractConfig +class Ess_M2ePro_Sql_Upgrade_v6_42_0__v6_43_0_Config extends Ess_M2ePro_Model_Upgrade_Feature_AbstractConfig { public function getFeaturesList() { - return array(); + return array( + '@y23_m06/IgnoreVariationMpnInResolverConfig', + ); } } diff --git a/app/code/community/Ess/M2ePro/sql/Upgrade/v6_43_0__v6_43_3/Config.php b/app/code/community/Ess/M2ePro/sql/Upgrade/v6_43_0__v6_43_3/Config.php new file mode 100644 index 00000000..39718f30 --- /dev/null +++ b/app/code/community/Ess/M2ePro/sql/Upgrade/v6_43_0__v6_43_3/Config.php @@ -0,0 +1,15 @@ +