Skip to content

Commit

Permalink
6.4.3 RELEASE FINAL
Browse files Browse the repository at this point in the history
  • Loading branch information
d-belousov committed Sep 18, 2016
1 parent 94b15d9 commit af32cfd
Show file tree
Hide file tree
Showing 44 changed files with 3,900 additions and 187 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,6 @@ public function callbackColumnProductTitle($value, $row, $column, $isExport)
{
if (is_null($value)) {
$value = '<i style="color:gray;">receiving...</i>';
} elseif ($value == '') {
$value = '<i style="color:gray;">none</i>';
} else {
$value = '<span>' . Mage::helper('M2ePro')->escapeHtml($value) . '</span>';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,11 @@ public function callbackColumnProductId($value, $row, $column, $isExport)

public function callbackColumnProductTitle($value, $row, $column, $isExport)
{
$value = '<span>'.Mage::helper('M2ePro')->escapeHtml($value).'</span>';
if (is_null($value)) {
$value = '<i style="color:gray;">receiving...</i>';
} else {
$value = '<span>' .Mage::helper('M2ePro')->escapeHtml($value). '</span>';
}

if (!is_null($row->getData('listing_id'))) {
$urlParams = array();
Expand Down
19 changes: 19 additions & 0 deletions app/code/community/Ess/M2ePro/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
* 6.4.4 (r10771) (18/09/2016)

* Added: Ability to install module via composer (composer.json file added)
* Added: Ability to install module via modman (modman file added)
* Added: [Amazon] Ability to create new ASIN/ISBN in Canada Marketplace using Description Policy
* Improvement: [eBay] Variation Options label can be renamed now without further errors from eBay Trading API
* Improvement: [eBay] Preventing the eBay Trading API errors if Magento Child Product will be unassigned from Parent
* Improvement: [eBay] Preventing the eBay Trading API errors if Magento Child Product will be totally removed
* Improvement: [eBay] Price will be sent to the eBay each time during Relist action (together with QTY and Variations Data)
* Fix: Quantity could be calculated incorrectly in some special cases (high limited range of cases)
* Fix: [eBay] Items duplicates because User could List Items with "Listed (Hidden)" status manually
* Fix: [eBay] Orders Synchronization could not work correctly sometimes if there are a lot of changes on eBay side
* Fix: [eBay] Wrong QTY could be set for Item after Relist action for items with "Listed (Hidden)" status
* Fix: [eBay] Excluded locations were not removed from eBay when they were removed from Shipping Policy before
* Fix: [eBay] Error "The Product was Listed as a Simple Product as it has limitation for Multi-Variation Items" during list item even if requirements are met
* Fix: [Amazon] Full revise by Description Policy did not work, if change was performed on Definition tab
* Fix: [Amazon] Synchronization was broken due to error "Call to a member function getOptions() on a non-object"
* Fix: [Amazon/Rakuten.com] Product was not revised if their Policy settings were changed and it was in "Revise in progress" state

* 6.4.3 (r10536) (20/04/2016)

* Improvement: [eBay] If category of listed Item starts to require UPC/EAN/ISBN identifier, M2E will send full Details to prevent an error
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Ess/M2ePro/Helper/Component/Amazon.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function getMarketplacesAvailableForApiCreation()
public function getMarketplacesAvailableForAsinCreation()
{
$collection = $this->getMarketplacesAvailableForApiCreation();
return $collection->addFieldToFilter('is_asin_available', 1);
return $collection->addFieldToFilter('is_new_asin_available', 1);
}

//########################################
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Ess/M2ePro/Helper/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getVersion()

public function getRevision()
{
$revision = '10536';
$revision = '10771';

if ($revision == str_replace('|','#','|REVISION|')) {
$revision = (int)exec('svnversion');
Expand Down
3 changes: 2 additions & 1 deletion app/code/community/Ess/M2ePro/Helper/Module/License.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public function getIntervalBeforeExpirationDate($component)
//########################################

public function obtainRecord($email = NULL, $firstName = NULL, $lastName = NULL,
$country = NULL, $city = NULL, $postalCode = NULL)
$country = NULL, $city = NULL, $postalCode = NULL, $phone = NULL)
{
$requestParams = array(
'domain' => Mage::helper('M2ePro/Client')->getDomain(),
Expand All @@ -253,6 +253,7 @@ public function obtainRecord($email = NULL, $firstName = NULL, $lastName = NULL,
!is_null($email) && $requestParams['email'] = $email;
!is_null($firstName) && $requestParams['first_name'] = $firstName;
!is_null($lastName) && $requestParams['last_name'] = $lastName;
!is_null($phone) && $requestParams['phone'] = $phone;
!is_null($country) && $requestParams['country'] = $country;
!is_null($city) && $requestParams['city'] = $city;
!is_null($postalCode) && $requestParams['postal_code'] = $postalCode;
Expand Down
5 changes: 5 additions & 0 deletions app/code/community/Ess/M2ePro/Model/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ public function getTitle()
return $this->getData('title');
}

public function getAdditionalData()
{
return $this->getData('additional_data');
}

/**
* @return bool
*/
Expand Down
2 changes: 2 additions & 0 deletions app/code/community/Ess/M2ePro/Model/Amazon/Listing/Other.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
*/
class Ess_M2ePro_Model_Amazon_Listing_Other extends Ess_M2ePro_Model_Component_Child_Amazon_Abstract
{
const EMPTY_TITLE_PLACEHOLDER = '--';

//########################################

public function _construct()
Expand Down
20 changes: 2 additions & 18 deletions app/code/community/Ess/M2ePro/Model/Amazon/Marketplace.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ public function getDefaultCurrency()
/**
* @return bool
*/
public function isAsinAvailable()
public function isNewAsinAvailable()
{
return (bool)$this->getData('is_asin_available');
return (bool)$this->getData('is_new_asin_available');
}

/**
Expand All @@ -77,22 +77,6 @@ public function isMerchantFulfillmentAvailable()

//########################################

/**
* @return bool
*/
public function isNewAsinAvailable()
{
$newAsinNotImplementedMarketplaces = array(
Ess_M2ePro_Helper_Component_Amazon::MARKETPLACE_CA,
Ess_M2ePro_Helper_Component_Amazon::MARKETPLACE_JP,
Ess_M2ePro_Helper_Component_Amazon::MARKETPLACE_CN,
);

return !in_array((int)$this->getId(),$newAsinNotImplementedMarketplaces);
}

//########################################

public function save()
{
Mage::helper('M2ePro/Data_Cache_Permanent')->removeTagValues('marketplace');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
class Ess_M2ePro_Model_Amazon_Synchronization_Orders_Receive_Requester
extends Ess_M2ePro_Model_Connector_Amazon_Orders_Get_ItemsRequester
{
const TIMEOUT_ERRORS_COUNT_TO_RISE = 3;
const TIMEOUT_RISE_ON_ERROR = 30;
const TIMEOUT_RISE_MAX_VALUE = 1500;

//########################################

/**
Expand Down Expand Up @@ -38,4 +42,53 @@ public function setProcessingLocks(Ess_M2ePro_Model_Processing_Request $processi
}

//########################################

public function process()
{
$cacheConfig = Mage::helper('M2ePro/Module')->getCacheConfig();
$cacheConfigGroup = '/amazon/synchronization/orders/receive/timeout';

try {

parent::process();

} catch (Ess_M2ePro_Model_Exception_Connection $exception) {

$data = $exception->getAdditionalData();
if (!empty($data['curl_error_number']) && $data['curl_error_number'] == CURLE_OPERATION_TIMEOUTED) {

$fails = (int)$cacheConfig->getGroupValue($cacheConfigGroup, 'fails');
$fails++;

$rise = (int)$cacheConfig->getGroupValue($cacheConfigGroup, 'rise');
$rise += self::TIMEOUT_RISE_ON_ERROR;

if ($fails >= self::TIMEOUT_ERRORS_COUNT_TO_RISE && $rise <= self::TIMEOUT_RISE_MAX_VALUE) {

$fails = 0;
$cacheConfig->setGroupValue($cacheConfigGroup, 'rise', $rise);
}
$cacheConfig->setGroupValue($cacheConfigGroup, 'fails', $fails);
}

throw $exception;
}

$cacheConfig->setGroupValue($cacheConfigGroup, 'fails', 0);
}

//########################################

protected function getRequestTimeout()
{
$cacheConfig = Mage::helper('M2ePro/Module')->getCacheConfig();
$cacheConfigGroup = '/amazon/synchronization/orders/receive/timeout';

$rise = (int)$cacheConfig->getGroupValue($cacheConfigGroup, 'rise');
$rise > self::TIMEOUT_RISE_MAX_VALUE && $rise = self::TIMEOUT_RISE_MAX_VALUE;

return 300 + $rise;
}

//########################################
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ private function updateNotReceivedTitles($neededItems, $responseData) {

$connWrite->update(
$aloTable,
array('title' => ''),
array('title' => Ess_M2ePro_Model_Amazon_Listing_Other::EMPTY_TITLE_PLACEHOLDER),
array('general_id = ?' => (string)$generalId)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,18 @@ protected function performActions()
'Process Account '.$account->getTitle()
);

$params = array();
if (!$this->isFullItemsDataAlreadyReceived($account)) {
$params['full_items_data'] = true;

$additionalData = (array)json_decode($account->getAdditionalData(), true);
$additionalData['is_amazon_other_listings_full_items_data_already_received'] = true;
$account->setSettings('additional_data', $additionalData)->save();
}

$dispatcherObject = Mage::getModel('M2ePro/Connector_Amazon_Dispatcher');
$connectorObj = $dispatcherObject->getConnector('otherListings', 'update' ,'requester',
array(), $account, 'Ess_M2ePro_Model_Amazon_Synchronization');
$params, $account, 'Ess_M2ePro_Model_Amazon_Synchronization');

$dispatcherObject->process($connectorObj);

Expand Down Expand Up @@ -138,5 +147,11 @@ private function isLockedAccount(Ess_M2ePro_Model_Account $account)
return $lockItem->isExist();
}

private function isFullItemsDataAlreadyReceived(Ess_M2ePro_Model_Account $account)
{
$additionalData = (array)json_decode($account->getAdditionalData(), true);
return !empty($additionalData['is_amazon_other_listings_full_items_data_already_received']);
}

//########################################
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ protected function updateReceivedOtherListings($receivedItems)

$newData = array(
'general_id' => (string)$receivedItem['identifiers']['general_id'],
'title' => !empty($receivedItem['title']) ? (string)$receivedItem['title'] : NULL,
'title' => (string)$receivedItem['title'],
'online_price' => (float)$receivedItem['price'],
'online_qty' => (int)$receivedItem['qty'],
'is_afn_channel' => (bool)$receivedItem['channel']['is_afn'],
Expand Down Expand Up @@ -172,8 +172,10 @@ protected function updateReceivedOtherListings($receivedItems)
'status' => (int)$existingItem['status']
);

if (is_null($newData['title']) && !is_null($existingData['title'])) {
$newData['title'] = $existingData['title'];
if (is_null($receivedItem['title']) ||
$receivedItem['title'] == Ess_M2ePro_Model_Amazon_Listing_Other::EMPTY_TITLE_PLACEHOLDER) {

unset($newData['title'], $existingData['title']);
}

if ($newData == $existingData) {
Expand Down Expand Up @@ -300,7 +302,7 @@ protected function createNotExistedOtherListings($receivedItems)
'general_id' => (string)$receivedItem['identifiers']['general_id'],

'sku' => (string)$receivedItem['identifiers']['sku'],
'title' => !empty($receivedItem['title']) ? (string)$receivedItem['title'] : NULL,
'title' => $receivedItem['title'],

'online_price' => (float)$receivedItem['price'],
'online_qty' => (int)$receivedItem['qty'],
Expand All @@ -309,6 +311,12 @@ protected function createNotExistedOtherListings($receivedItems)
'is_isbn_general_id' => (bool)$receivedItem['identifiers']['is_isbn']
);

if (isset($this->params['full_items_data']) && $this->params['full_items_data'] &&
$newData['title'] == Ess_M2ePro_Model_Amazon_Listing_Other::EMPTY_TITLE_PLACEHOLDER) {

$newData['title'] = NULL;
}

if ((bool)$newData['is_afn_channel']) {
$newData['online_qty'] = NULL;
$newData['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_UNKNOWN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,16 @@ private function executeNeedSynchronize()
$listingProductCollection->addFieldToFilter('synch_status',Ess_M2ePro_Model_Listing_Product::SYNCH_STATUS_NEED);
$listingProductCollection->addFieldToFilter('is_variation_parent', 0);

$tag = 'in_action';
$modelName = Mage::getModel('M2ePro/Listing_Product')->getResourceName();

$listingProductCollection->getSelect()->joinLeft(
array('lo' => Mage::getResourceModel('M2ePro/LockedObject')->getMainTable()),
"lo.object_id = main_table.id AND lo.tag='{$tag}' AND lo.model_name = '{$modelName}'",
array()
);
$listingProductCollection->addFieldToFilter('lo.id', array('null' => true));

$listingProductCollection->getSelect()->limit(100);

/** @var $listingProduct Ess_M2ePro_Model_Listing_Product */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ public function setMarketplace(Ess_M2ePro_Model_Marketplace $instance)

// ---------------------------------------

public function setDefinitionTemplate(Ess_M2ePro_Model_Amazon_Template_Description_Definition $template)
{
$this->descriptionDefinitionModel = $template;
return $this;
}

/**
* @return Ess_M2ePro_Model_Amazon_Template_Description_Definition
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ private function executeNeedSynchronize()
$listingProductCollection->addFieldToFilter('status', Ess_M2ePro_Model_Listing_Product::STATUS_LISTED);
$listingProductCollection->addFieldToFilter('synch_status',Ess_M2ePro_Model_Listing_Product::SYNCH_STATUS_NEED);

$tag = 'in_action';
$modelName = Mage::getModel('M2ePro/Listing_Product')->getResourceName();

$listingProductCollection->getSelect()->joinLeft(
array('lo' => Mage::getResourceModel('M2ePro/LockedObject')->getMainTable()),
"lo.object_id = main_table.id AND lo.tag='{$tag}' AND lo.model_name = '{$modelName}'",
array()
);
$listingProductCollection->addFieldToFilter('lo.id', array('null' => true));

$listingProductCollection->getSelect()->limit(100);

/** @var $listingProduct Ess_M2ePro_Model_Listing_Product */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ protected function getResponserParams()

protected function getRequestData()
{
return array();
$requestData = array();
if (isset($this->params['full_items_data'])) {
$requestData['full_items_data'] = $this->params['full_items_data'];
}

return $requestData;
}

//########################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,25 @@ protected function filterManualListingsProducts()
continue;
}

if ($listingProduct->isHidden()) {

$message = array(
// M2ePro_TRANSLATIONS
// The List action cannot be executed for this Item as it has a Listed (Hidden) status. You have to stop Item manually first to run the List action for it.
parent::MESSAGE_TEXT_KEY => 'The List action cannot be executed for this Item as it has
a Listed (Hidden) status. You have to stop Item manually first
to run the List action for it.',
parent::MESSAGE_TYPE_KEY => parent::MESSAGE_TYPE_ERROR
);

$this->getLogger()->logListingProductMessage(
$listingProduct, $message, Ess_M2ePro_Model_Log_Abstract::PRIORITY_MEDIUM
);

$this->removeAndUnlockListingProduct($listingProduct);
continue;
}

if (!$listingProduct->getChildObject()->isSetCategoryTemplate()) {

$message = array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@ protected function filterManualListingProduct()
return false;
}

if ($this->listingProduct->isHidden()) {

$message = array(
// M2ePro_TRANSLATIONS
// The List action cannot be executed for this Item as it has a Listed (Hidden) status. You have to stop Item manually first to run the List action for it.
parent::MESSAGE_TEXT_KEY => 'The List action cannot be executed for this Item as it has
a Listed (Hidden) status. You have to stop Item manually first
to run the List action for it.',
parent::MESSAGE_TYPE_KEY => parent::MESSAGE_TYPE_ERROR
);

$this->getLogger()->logListingProductMessage(
$this->listingProduct, $message, Ess_M2ePro_Model_Log_Abstract::PRIORITY_MEDIUM
);

return false;
}

if (!$this->listingProduct->getChildObject()->isSetCategoryTemplate()) {

$message = array(
Expand Down
Loading

0 comments on commit af32cfd

Please sign in to comment.