Skip to content

Commit

Permalink
6.39.2 (FINAL RELEASE)
Browse files Browse the repository at this point in the history
  • Loading branch information
m2epro committed May 19, 2023
1 parent 411256b commit 781b1c8
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,20 @@ public function getVariationValue(Ess_M2ePro_Model_Listing_Product_Variation $va
return 0;
}

return parent::getVariationValue($variation);
$qty = parent::getVariationValue($variation);
$ebaySynchronizationTemplate = $variation->getListingProduct()
->getChildObject()
->getEbaySynchronizationTemplate();

if ($ebaySynchronizationTemplate->isStopWhenQtyCalculatedHasValue()) {
$minQty = (int)$ebaySynchronizationTemplate->getStopWhenQtyCalculatedHasValue();

if ($qty <= $minQty) {
return 0;
}
}

return $qty;
}

//########################################
Expand Down
39 changes: 35 additions & 4 deletions app/code/community/Ess/M2ePro/Model/Ebay/Order/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class Ess_M2ePro_Model_Ebay_Order_Builder extends Mage_Core_Model_Abstract
protected $_status = self::STATUS_NOT_MODIFIED;

protected $_updates = array();

//########################################
/** @var array<array{type:string, text:string}> */
protected $_messages = array();

public function __construct()
{
Expand Down Expand Up @@ -91,6 +91,22 @@ protected function initializeData(array $data = array())
$this->setData('currency', $data['selling']['currency']);
$this->setData('tax_reference', $data['selling']['tax_reference']);

if (!empty($data['messages']) && is_array($data['messages'])) {
foreach ($data['messages'] as $message) {
if (
empty($message['text'])
|| empty($message['type'])
) {
continue;
}

$this->_messages[] = array(
'text' => $message['text'],
'type' => $message['type'],
);
}
}

if (empty($data['selling']['tax_details']) || !is_array($data['selling']['tax_details'])) {
$this->setData('tax_details', null);
} else {
Expand Down Expand Up @@ -514,6 +530,23 @@ protected function createOrUpdateOrder()
}
}

if (
$this->_order->getId()
&& !empty($this->_messages)
) {
$orderLog = $this->_order->getLog();

foreach ($this->_messages as $message) {
$orderLog->addMessage(
$this->_order,
$message['text'],
$orderLog->convertServerMessageTypeToExtensionMessageType($message['type']),
array(),
true
);
}
}

$this->_order->setAccount($this->_account);

if ($this->getData('order_status') == OrderHelper::EBAY_ORDER_STATUS_CANCELLED) {
Expand Down Expand Up @@ -984,6 +1017,4 @@ protected function processMagentoOrderUpdates()

$magentoOrderUpdater->finishUpdate();
}

//########################################
}
25 changes: 16 additions & 9 deletions app/code/community/Ess/M2ePro/Model/Order/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,10 @@ public function addServerResponseMessage($order, Message $message)
$order = Mage::getModel('M2ePro/Order')->load($order);
}

$map = array(
Message::TYPE_NOTICE => self::TYPE_INFO,
Message::TYPE_SUCCESS => self::TYPE_SUCCESS,
Message::TYPE_WARNING => self::TYPE_WARNING,
Message::TYPE_ERROR => self::TYPE_ERROR
);

$this->addMessage(
$order,
$message->getText(),
isset($map[$message->getType()]) ? $map[$message->getType()] : self::TYPE_ERROR
$this->convertServerMessageTypeToExtensionMessageType((string)$message->getType())
);
}

Expand All @@ -127,5 +120,19 @@ public function isExist($orderId, $message)
return false;
}

//########################################
/**
* @param string $type
* @return int
*/
public function convertServerMessageTypeToExtensionMessageType($type)
{
$map = array(
Message::TYPE_NOTICE => self::TYPE_INFO,
Message::TYPE_SUCCESS => self::TYPE_SUCCESS,
Message::TYPE_WARNING => self::TYPE_WARNING,
Message::TYPE_ERROR => self::TYPE_ERROR,
);

return isset($map[$type]) ? $map[$type] : self::TYPE_ERROR;
}
}
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.39.1",
"version": "6.39.2",
"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.39.1</version>
<version>6.39.2</version>
</Ess_M2ePro>
</modules>
<default>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

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

class Ess_M2ePro_Sql_Upgrade_v6_39_1__v6_39_2_Config extends Ess_M2ePro_Model_Upgrade_Feature_AbstractConfig
{
public function getFeaturesList()
{
return array();
}
}
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.39.1",
"version": "6.39.2",
"license": "proprietary",
"keywords": ["ebay", "amazon", "walmart", "magento"],
"homepage": "https://www.m2epro.com/",
Expand Down

0 comments on commit 781b1c8

Please sign in to comment.