Skip to content

Commit

Permalink
6.31.1 (FINAL RELEASE)
Browse files Browse the repository at this point in the history
  • Loading branch information
m2epro committed Nov 15, 2022
1 parent ccee5ee commit 569c405
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 5 deletions.
25 changes: 24 additions & 1 deletion app/code/community/Ess/M2ePro/Model/Ebay/Order/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public function getVariationProductOptions()
}

foreach ($channelItem->getVariations() as $variation) {
if ($variation['channel_options'] !== $this->getVariationChannelOptions()) {
if ($this->isOptionsDifferent($variation['channel_options'], $this->getVariationChannelOptions())) {
continue;
}

Expand All @@ -254,6 +254,29 @@ public function getVariationProductOptions()
return $this->getVariationChannelOptions();
}


/**
* @param array $first
* @param array $second
*
* @return bool
*/
protected function isOptionsDifferent(array $first, array $second)
{
$comparator = function ($a, $b) {
if ($a === $b) {
return 0;
}

return $a > $b ? 1 : -1;
};

$firstDiff = array_udiff_uassoc($first, $second, $comparator, $comparator);
$secondDiff = array_udiff_uassoc($second, $first, $comparator, $comparator);

return count($firstDiff) !== 0 || count($secondDiff) !== 0;
}

/**
* @return array
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,30 @@ public function mapChannelItemProduct(Ess_M2ePro_Model_Walmart_Listing_Product $
);
}

public function moveChildrenToListing($listingProduct)
{
/** @var Varien_Db_Adapter_Pdo_Mysql $connection */
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
$select = $connection->select();
$select->join(
array('wlp' => $this->getMainTable()),
'lp.id = wlp.listing_product_id',
null
);
$select->join(
array('parent_lp' => Mage::getResourceModel('M2ePro/Listing_Product')->getMainTable()),
'parent_lp.id = wlp.variation_parent_id',
array('listing_id' => 'parent_lp.listing_id')
);
$select->where('wlp.variation_parent_id = ?', $listingProduct->getId());

$updateQuery = $connection->updateFromSelect(
$select,
array('lp' => Mage::getResourceModel('M2ePro/Listing_Product')->getMainTable())
);

$connection->query($updateQuery);
}

//########################################
}
11 changes: 10 additions & 1 deletion app/code/community/Ess/M2ePro/Model/Walmart/Listing.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public function addProductFromOther(
public function addProductFromListing(
Ess_M2ePro_Model_Listing_Product $listingProduct,
Ess_M2ePro_Model_Listing $sourceListing
){
) {
if (!$this->getParentObject()->addProductFromListing($listingProduct, $sourceListing, false)) {
return false;
}
Expand All @@ -348,6 +348,15 @@ public function addProductFromListing(
}
}

$walmartListingProduct = $listingProduct->getChildObject();
$variationManager = $walmartListingProduct->getVariationManager();

if ($variationManager->isRelationParentType()) {
/** @var Ess_M2ePro_Model_Resource_Walmart_Listing_Product $resourceModel */
$resourceModel = Mage::getResourceModel('M2ePro/Walmart_Listing_Product');
$resourceModel->moveChildrenToListing($listingProduct);
}

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.31.0",
"version": "6.31.1",
"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.31.0</version>
<version>6.31.1</version>
</Ess_M2ePro>
</modules>
<default>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

// @codingStandardsIgnoreFile

class Ess_M2ePro_Sql_Update_y22_m11_FixWalmartChildListingId extends
Ess_M2ePro_Model_Upgrade_Feature_AbstractFeature
{
public function execute()
{
$installer = $this->_installer;
$connection = $installer->getConnection();
$select = $connection->select();

$select->join(
array('wlp' => $installer->getFullTableName('walmart_listing_product')),
'lp.id = wlp.listing_product_id',
null
);
$select->join(
array('parent_lp' => $installer->getFullTableName('listing_product')),
'parent_lp.id = wlp.variation_parent_id',
array('listing_id' => 'parent_lp.listing_id')
);
$select->where('lp.listing_id != parent_lp.listing_id');

$updateQuery = $connection->updateFromSelect(
$select,
array('lp' => $installer->getFullTableName('listing_product'))
);

$connection->query($updateQuery);
}
}
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_31_0__v6_31_1_Config extends Ess_M2ePro_Model_Upgrade_Feature_AbstractConfig
{
public function getFeaturesList()
{
return array(
'@y22_m11/FixWalmartChildListingId'
);
}
}
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.31.0",
"version": "6.31.1",
"license": "proprietary",
"keywords": ["ebay", "amazon", "walmart", "magento"],
"homepage": "https://www.m2epro.com/",
Expand Down

0 comments on commit 569c405

Please sign in to comment.