Skip to content

Commit

Permalink
6.48.0 (FINAL RELEASE)
Browse files Browse the repository at this point in the history
  • Loading branch information
m2epro committed Oct 9, 2023
1 parent 2b7ad74 commit 46640a7
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,84 +335,51 @@ protected function validateIsVariationProductWithoutVariations()

protected function validateVariationsOptions()
{
/** @var Ess_M2ePro_Helper_Component_Ebay $ebayComponentHelper */
$ebayComponentHelper = \Mage::helper('M2ePro/Component_Ebay');
/** @var Ess_M2ePro_Model_Listing_Product_Variation $listingProduct */
$listingProduct = $ebayComponentHelper->getModel('Listing_Product_Variation');

/** @var Ess_M2ePro_Model_Resource_Listing_Product_Variation_Option $variationOptionResource */
$variationOptionResource = \Mage::getResourceModel('M2ePro/Listing_Product_Variation_Option');

/** @var Ess_M2ePro_Model_Resource_Listing_Product_Variation_Collection $collection */
$collection = $listingProduct->getResourceCollection();
$collection->getSelect()->reset(\Zend_Db_Select::COLUMNS);
$collection->getSelect()->joinLeft(
array('vo' => $variationOptionResource->getMainTable()),
'vo.listing_product_variation_id = main_table.id',
array(
'attribute_name' => 'vo.attribute',
'count_variation_options'
=> new \Zend_Db_Expr('COUNT(DISTINCT IF(second_table.`delete`, NULL, vo.`option`))')
)
);
$collection->getSelect()->group('vo.attribute');
$collection->getSelect()->where(
'main_table.listing_product_id = ?',
$this->getListingProduct()->getId()
);
$totalVariationsCount = 0;
$totalDeletedVariationsCount = 0;
$uniqueAttributesValues = array();

$data = $collection->getData();
foreach ($this->getEbayListingProduct()->getVariations(true) as $variation) {
/** @var Ess_M2ePro_Model_Listing_Product_Variation $variation */
/** @var Ess_M2ePro_Model_Ebay_Listing_Product_Variation $ebayVariation */

// Max 5 pair attribute-option:
// Color: Blue, Size: XL, ...
if (count($data) > 5) {
$this->addMessage(
'Variations of this Magento Product are out of the eBay Variational Item limits.
Its number of Variational Attributes is more than 5.
That is why, this Product cannot be updated on eBay.
Please, decrease the number of Attributes to solve this issue.'
);
return false;
}
$ebayVariation = $variation->getChildObject();

// All options deleted
$totalVariationOptions = 0;
foreach ($data as $item) {
$totalVariationOptions += $item['count_variation_options'];
}
foreach ($variation->getOptions(true) as $option) {
/** @var Ess_M2ePro_Model_Listing_Product_Variation_Option $option */

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;
}
$uniqueAttributesValues[$option->getAttribute()][$option->getOption()] = true;

$totalOptionsCount = 1;
foreach ($data as $item) {
if ((int)$item['count_variation_options'] === 0) {
continue;
}
// Max 5 pair attribute-option:
// Color: Blue, Size: XL, ...
if (count($uniqueAttributesValues) > 5) {
$this->addMessage(
'Variations of this Magento Product are out of the eBay Variational Item limits.
Its number of Variational Attributes is more than 5.
That is why, this Product cannot be updated on eBay.
Please, decrease the number of Attributes to solve this issue.'
);
return false;
}

$totalOptionsCount *= $item['count_variation_options'];
// Maximum 60 options by one attribute:
// Color: Red, Blue, Green, ...
if ($item['count_variation_options'] > 60) {
$this->addMessage(
'Variations of this Magento Product are out of the eBay Variational Item limits.
// Maximum 60 options by one attribute:
// Color: Red, Blue, Green, ...
if (count($uniqueAttributesValues[$option->getAttribute()]) > 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.
That is why, this Product cannot be updated on eBay.
Please, decrease the number of Options to solve this issue.'
);
return false;
);
return false;
}
}

// Not more than 250 possible variations
if ($totalOptionsCount > 250) {
$totalVariationsCount++;
$ebayVariation->isDelete() && $totalDeletedVariationsCount++;

// Not more that 250 possible variations
if ($totalVariationsCount > 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.
Expand All @@ -422,6 +389,17 @@ 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;
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Ess/M2ePro/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.46.0",
"version": "6.48.0",
"license": "proprietary",
"keywords": ["ebay", "amazon", "walmart", "magento"],
"homepage": "https://www.m2epro.com/",
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Ess/M2ePro/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<config>
<modules>
<Ess_M2ePro>
<version>6.46.0</version>
<version>6.48.0</version>
</Ess_M2ePro>
</modules>
<default>
Expand Down
10 changes: 5 additions & 5 deletions app/code/community/Ess/M2ePro/sql/Install/Amazon.php
Original file line number Diff line number Diff line change
Expand Up @@ -884,14 +884,14 @@ public function execute()
(48, 20, 'Belgium', 'BE', 'amazon.com.be', 0, 22, 'Europe', 'amazon', NOW(), NOW());
INSERT INTO `{$this->_installer->getTable('m2epro_amazon_marketplace')}` VALUES
(24, 'CAD',1,0,0,0,0),
(24, 'CAD',1,1,0,0,0),
(25, 'EUR',1,1,1,1,1),
(26, 'EUR',1,0,1,1,1),
(26, 'EUR',1,1,1,1,1),
(28, 'GBP',1,1,1,1,1),
(29, 'USD',1,1,1,0,0),
(30, 'EUR',1,0,1,1,1),
(31, 'EUR',1,0,1,1,1),
(34, 'MXN',1,0,0,0,0),
(30, 'EUR',1,1,1,1,1),
(31, 'EUR',1,1,1,1,1),
(34, 'MXN',1,1,0,0,0),
(35, 'AUD',1,0,0,0,0),
(39, 'EUR',1,1,1,1,1),
(40, 'TRY',1,1,0,0,0),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

// @codingStandardsIgnoreFile

class Ess_M2ePro_Sql_Update_y23_m10_EnableAmazonShippingServiceForSomeMarketplaces extends
Ess_M2ePro_Model_Upgrade_Feature_AbstractFeature
{
public function execute()
{
$marketplaces = array(
array('name' => 'Canada', 'id' => 24),
array('name' => 'United States', 'id' => 29),
array('name' => 'Mexico', 'id' => 34),
array('name' => 'Spain', 'id' => 30),
array('name' => 'United Kingdom', 'id' => 28),
array('name' => 'France', 'id' => 26),
array('name' => 'Germany', 'id' => 25),
array('name' => 'Italy', 'id' => 31),
array('name' => 'India', 'id' => 46),
);

$this->_installer->getConnection()->update(
$this->_installer->getTablesObject()->getFullName('m2epro_amazon_marketplace'),
array('is_merchant_fulfillment_available' => 1),
array('marketplace_id IN (?)' => array_column($marketplaces, 'id'))
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

/**
* @author M2E Pro Developers Team
* @copyright M2E LTD
* @license Commercial use is forbidden
*/

class Ess_M2ePro_Sql_Upgrade_v6_46_0__v6_48_0_Config extends Ess_M2ePro_Model_Upgrade_Feature_AbstractConfig
{
public function getFeaturesList()
{
return array(
'@y23_m10/EnableAmazonShippingServiceForSomeMarketplaces',
);
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.46.0",
"version": "6.48.0",
"license": "proprietary",
"keywords": ["ebay", "amazon", "walmart", "magento"],
"homepage": "https://www.m2epro.com/",
Expand Down

0 comments on commit 46640a7

Please sign in to comment.