diff --git a/app/code/community/Ess/M2ePro/Model/Ebay/Listing/Product/Action/Type/Validator.php b/app/code/community/Ess/M2ePro/Model/Ebay/Listing/Product/Action/Type/Validator.php index 43b04a11..65e01d74 100644 --- a/app/code/community/Ess/M2ePro/Model/Ebay/Listing/Product/Action/Type/Validator.php +++ b/app/code/community/Ess/M2ePro/Model/Ebay/Listing/Product/Action/Type/Validator.php @@ -346,15 +346,13 @@ protected function validateVariationsOptions() /** @var Ess_M2ePro_Model_Resource_Listing_Product_Variation_Collection $collection */ $collection = $listingProduct->getResourceCollection(); $collection->getSelect()->reset(\Zend_Db_Select::COLUMNS); - $collection->getSelect()->columns(array( - 'count_deleted' => new \Zend_Db_Expr('SUM(IF(second_table.`delete`, 1, 0))'), - )); $collection->getSelect()->joinLeft( array('vo' => $variationOptionResource->getMainTable()), 'vo.listing_product_variation_id = main_table.id', array( 'attribute_name' => 'vo.attribute', - 'count_options' => new \Zend_Db_Expr('COUNT(DISTINCT IF(second_table.`delete`, NULL, vo.`option`))') + 'count_variation_options' + => new \Zend_Db_Expr('COUNT(DISTINCT IF(second_table.`delete`, NULL, vo.`option`))') ) ); $collection->getSelect()->group('vo.attribute'); @@ -377,14 +375,33 @@ protected function validateVariationsOptions() return false; } - $totalVariationsCount = 1; - $totalDeletedVariationsCount = 0; + // All options deleted + $totalVariationOptions = 0; foreach ($data as $item) { - $totalVariationsCount *= $item['count_options']; - $totalDeletedVariationsCount += $item['count_deleted']; + $totalVariationOptions += $item['count_variation_options']; + } + + if ($totalVariationOptions === 0) { + $this->addMessage( + 'This Product was listed to eBay as Variational Item. + Changing of the Item type from Variational to Non-Variational during Revise/Relist + actions is restricted by eBay. + At the moment this Product is considered as Simple without any Variations, + that does not allow updating eBay Variational Item.' + ); + return false; + } + + $totalOptionsCount = 1; + foreach ($data as $item) { + if ((int)$item['count_variation_options'] === 0) { + continue; + } + + $totalOptionsCount *= $item['count_variation_options']; // Maximum 60 options by one attribute: // Color: Red, Blue, Green, ... - if ($item['count_options'] > 60) { + if ($item['count_variation_options'] > 60) { $this->addMessage( 'Variations of this Magento Product are out of the eBay Variational Item limits. Its number of Options for some Variational Attribute(s) is more than 60. @@ -394,8 +411,8 @@ protected function validateVariationsOptions() return false; } - // Not more that 250 possible variations - if ($totalVariationsCount > 250) { + // Not more than 250 possible variations + if ($totalOptionsCount > 250) { $this->addMessage( 'Variations of this Magento Product are out of the eBay Variational Item limits. The Number of Variations is more than 250. That is why, this Product cannot be updated on eBay. @@ -405,17 +422,6 @@ protected function validateVariationsOptions() } } - if ($totalVariationsCount == $totalDeletedVariationsCount) { - $this->addMessage( - 'This Product was listed to eBay as Variational Item. - Changing of the Item type from Variational to Non-Variational during Revise/Relist - actions is restricted by eBay. - At the moment this Product is considered as Simple without any Variations, - that does not allow updating eBay Variational Item.' - ); - return false; - } - return true; } diff --git a/app/code/community/Ess/M2ePro/composer.json b/app/code/community/Ess/M2ePro/composer.json index 6efe169c..c78d6dd2 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.4", + "version": "6.43.5", "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 7f1466c2..82067612 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.4 + 6.43.5 diff --git a/app/code/community/Ess/M2ePro/sql/Upgrade/v6_43_4__v6_43_5/Config.php b/app/code/community/Ess/M2ePro/sql/Upgrade/v6_43_4__v6_43_5/Config.php new file mode 100644 index 00000000..7fe7b9ad --- /dev/null +++ b/app/code/community/Ess/M2ePro/sql/Upgrade/v6_43_4__v6_43_5/Config.php @@ -0,0 +1,15 @@ +