Skip to content

Commit

Permalink
6.4.10 RELEASE FINAL
Browse files Browse the repository at this point in the history
  • Loading branch information
d-belousov committed May 16, 2017
1 parent f0596dd commit a8471d5
Show file tree
Hide file tree
Showing 33 changed files with 280 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public function callbackColumnProductOptions($additionalData, $row, $column, $is
'</strong></span>:&nbsp;<span class="value">' . Mage::helper('M2ePro')->escapeHtml($option) .
'</span></span>';

if ($uniqueProductsIds && $option !== '--') {
if ($uniqueProductsIds && $option !== '--' && !in_array($attribute, $virtualProductAttributes)) {
$url = $this->getUrl('adminhtml/catalog_product/edit', array('id' => $productsIds[$attribute]));
$html .= '<a href="' . $url . '" target="_blank">' . $optionHtml . '</a><br/>';
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,13 @@ public function getEmptyText()
{
return Mage::helper('M2ePro')->__(
'No records found.
You can add Custom Compatible Vehicles manually or through the %link_start%Import Tool%link_end%.',
You can %link_new_item_start%add Custom Compatible Vehicles%link_new_item_end% manually
or through the %link_start%Import Tool%link_end%.',
'<a target="_blank" href="javascript::void(0)" onclick="EbayMotorsHandlerObj.openAddRecordPopup()">',
'</a>',
'<a target="_blank" href="' .
$this->getUrl('*/adminhtml_ebay_configuration/index') .
'#magento_block_ebay_configuration_general_motors_epids">',
$this->getUrl('*/adminhtml_ebay_configuration/index') .
'#magento_block_ebay_configuration_general_motors_epids">',
'</a>'
);
}
Expand Down
16 changes: 16 additions & 0 deletions app/code/community/Ess/M2ePro/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
* 6.4.10 (r11425) (16/05/2017)

* Improvement: [Amazon] Condition Note can be filled only if Condition is different than "New"
* Fix: Magento Order was not created if Buyer Email Address was not received from channel and Buyer Name contains special symbols
* Fix: Magento Order was created with invalid Tax Rate if the same Buyer bought Items from other marketplaces at one time
* Fix: "Call to a member function setStockItem() on null" for Orders which had the QTY reserved and then the Product was unmapped manually
* Fix: Log record about sending tracking number to channel was written twice mistakenly in some cases
* Fix: [eBay] Adding custom kTypes did not work in some cases
* Fix: [eBay] Address line1 and line2 are being merged in Magento Order even it is not needed
* Fix: [eBay] Unnecessary log records, about Online Price changes, can happen, if Listed Product becomes not variational in Magento
* Fix: [eBay] Order Variation Options were not mapped automatically if some Options were added after List the Item action on Channel
* Fix: [eBay] Automatic revise did not work, if Base Image was changed in Magento in some cases
* Fix: [eBay] Category Specifics edit page was crashed in some cases (the limited set of cases)
* Fix: [Amazon] Unable to revise AFN Variation Child Products by running Revise action for Parent Product
* Fix: [Amazon] Invalid variations matching for Bundle Product in some cases (the limited set of cases)

* 6.4.9 (r11403) (09/05/2017)

* Added: [eBay] Ability to use Parts Compatibility Feature for Spain (kTypes)
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 = '11403';
$revision = '11425';

if ($revision == str_replace('|','#','|REVISION|')) {
$revision = (int)exec('svnversion');
Expand Down
11 changes: 9 additions & 2 deletions app/code/community/Ess/M2ePro/Helper/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,22 @@ public function sendRequest(array $postData,

$response = curl_exec($curlObject);

$curlInfo = curl_getinfo($curlObject);
$errorNumber = curl_errno($curlObject);
$curlInfo = curl_getinfo($curlObject);
$errorNumber = curl_errno($curlObject);
$errorMessage = curl_error($curlObject);

curl_close($curlObject);

if ($response === false) {

$switchingResult = $this->switchEndpoint();

Mage::helper('M2ePro/Module_Logger')->process(array(
'curl_error_number' => $errorNumber,
'curl_error_message' => $errorMessage,
'curl_info' => $curlInfo
), 'Curl Empty Response', false);

if ($errorNumber !== CURLE_OPERATION_TIMEOUTED && !$secondAttempt && $switchingResult) {
return $this->sendRequest($postData,$headers,$timeout,true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,19 @@ public function getData()
*/
private function getConditionData()
{
$condition = array();

$this->searchNotFoundAttributes();
$conditionNote = $this->getAmazonListingProduct()->getListingSource()->getConditionNote();
$this->processNotFoundAttributes('Condition Note');
$condition['condition'] = $this->getAmazonListingProduct()->getListingSource()->getCondition();
$this->processNotFoundAttributes('Condition');

return array(
'condition' => $this->getAmazonListingProduct()->getListingSource()->getCondition(),
'condition_note' => $conditionNote,
);
if ($condition['condition'] != Ess_M2ePro_Model_Amazon_Listing::CONDITION_NEW) {
$this->searchNotFoundAttributes();
$condition['condition_note'] = $this->getAmazonListingProduct()->getListingSource()->getConditionNote();
$this->processNotFoundAttributes('Condition Note');
}

return $condition;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ private function getBuyerEmail()

if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$email = str_replace(' ', '-', strtolower($this->order->getChildObject()->getBuyerName()));
$email = mb_convert_encoding($email, "ASCII");
$email .= Ess_M2ePro_Model_Magento_Customer::FAKE_EMAIL_POSTFIX;
}

Expand Down
4 changes: 4 additions & 0 deletions app/code/community/Ess/M2ePro/Model/Buy/Listing/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public function _construct()

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

public function afterSaveNewEntity() {}

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

/**
* @return Ess_M2ePro_Model_Account
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ private function getBuyerEmail()

if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$email = str_replace(' ', '-', strtolower($this->order->getChildObject()->getBuyerName()));
$email = mb_convert_encoding($email, "ASCII");
$email .= Ess_M2ePro_Model_Magento_Customer::FAKE_EMAIL_POSTFIX;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ protected function filterChildListingProductsByStatus(array $listingProducts)
$resultListingProducts = array();

foreach ($listingProducts as $childListingProduct) {
if (!$childListingProduct->isListed() || !$childListingProduct->isRevisable()) {

if (!$childListingProduct->getChildObject()->isAfnChannel() &&
(!$childListingProduct->isListed() || $childListingProduct->isBlocked())) {
continue;
}

if (!$childListingProduct->isRevisable()) {
continue;
}

Expand Down
2 changes: 2 additions & 0 deletions app/code/community/Ess/M2ePro/Model/Connector/Protocol.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ protected function sendRequest()

Mage::helper('M2ePro/Server')->switchEndpoint();

Mage::helper('M2ePro/Module_Logger')->process($curlResult, 'Invalid Response Format', false);

$errorMsg = 'The Action was not completed because connection with M2E Pro Server was not set.
There are several possible reasons: temporary connection problem – please wait and try again later;
block of outgoing connection by firewall – please, ensure that connection to s1.m2epro.com and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ protected function replaceVariationSpecificsNames(array $data)
}

$data = $this->doReplaceVariationSpecifics($data, $additionalData['variations_specifics_replacements']);
$data['variations_specifics_replacements'] = $additionalData['variations_specifics_replacements'];

return $data;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function processSuccess(array $response, array $responseParams = array())
$this->getListingProduct()->addData($data)->save();

$this->updateVariationsValues(true);
$this->updateEbayItem();
}

public function processAlreadyStopped(array $response, array $responseParams = array())
Expand Down Expand Up @@ -211,6 +212,61 @@ protected function appendItemFeesValues($data, $response)
return $data;
}

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

private function updateEbayItem()
{
$data = array(
'account_id' => $this->getAccount()->getId(),
'marketplace_id' => $this->getMarketplace()->getId(),
'product_id' => (int)$this->getListingProduct()->getProductId(),
'store_id' => (int)$this->getListing()->getStoreId()
);

if ($this->getRequestData()->isVariationItem() && $this->getRequestData()->getVariations()) {

$variations = array();
$requestData = $this->getRequestData()->getData();

foreach ($this->getRequestData()->getVariations() as $variation) {

$channelOptions = $variation['specifics'];
$productOptions = $variation['specifics'];

if (empty($requestData['variations_specifics_replacements'])) {

$variations[] = array(
'product_options' => $productOptions,
'channel_options' => $channelOptions,
);
continue;
}

foreach ($requestData['variations_specifics_replacements'] as $productValue => $channelValue) {

if (!isset($productOptions[$channelValue])) {
continue;
}

$productOptions[$productValue] = $productOptions[$channelValue];
unset($productOptions[$channelValue]);
}

$variations[] = array(
'product_options' => $productOptions,
'channel_options' => $channelOptions,
);
}

$data['variations'] = json_encode($variations);
}

$object = $this->getEbayListingProduct()->getEbayItem();
$object->addData($data)->save();

return $object;
}

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

public function tryToReviseItemWithFullDataAction()
Expand Down
20 changes: 10 additions & 10 deletions app/code/community/Ess/M2ePro/Model/Ebay/Order/Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public function getAddressData()
// Adding reference id into street array
// ---------------------------------------
$referenceId = '';
$addressData['street'] = !empty($rawAddressData['street']) ? $rawAddressData['street'] : array();

if ($this->order->isUseGlobalShippingProgram()) {
$details = $this->order->getGlobalShippingDetails();
Expand All @@ -158,17 +159,16 @@ public function getAddressData()
isset($details['reference_id']) && $referenceId = 'Ref #'.$details['reference_id'];
}

$streetParts = !empty($rawAddressData['street']) ? $rawAddressData['street'] : array();
if (!empty($referenceId)) {

$addressData['street'] = array();
if (count($streetParts) >= 2) {
$addressData['street'] = array(
$referenceId,
implode(' ', $streetParts),
);
} else {
array_unshift($streetParts, $referenceId);
$addressData['street'] = $streetParts;
if (count($addressData['street']) >= 2) {
$addressData['street'] = array(
$referenceId,
implode(' ', $addressData['street']),
);
} else {
array_unshift($addressData['street'], $referenceId);
}
}
// ---------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@ private function processAccount(Ess_M2ePro_Model_Account $account)
continue;
}

/** @var Ess_M2ePro_Model_Ebay_Listing_Product $ebayListingProduct */
$ebayListingProduct = $listingProduct->getChildObject();

$isVariationOnChannel = !empty($change['variations']);
$isVariationInMagento = $ebayListingProduct->isVariationsReady();

if ($isVariationOnChannel != $isVariationInMagento) {
continue;
}

$this->processListingProduct($listingProduct,$change);

if (empty($change['variations'])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,15 @@ private function executeImagesChanged()
{
$this->getActualOperationHistory()->addTimePoint(__METHOD__,'Update images');

$ebayTemplateDescriptionItems = Mage::getModel('M2ePro/Ebay_Template_Description')->getCollection()->getItems();
$attributesForProductChange = array();

/** @var Ess_M2ePro_Model_Ebay_Template_Description $template */
foreach (Mage::getModel('M2ePro/Ebay_Template_Description')->getCollection()->getItems() as $template) {
foreach ($ebayTemplateDescriptionItems as $template) {
$attributesForProductChange = array_merge(
$attributesForProductChange,
$template->getImageMainAttributes(),
$template->getGalleryImagesAttributes(),
$template->getVariationImagesAttributes()
$template->getGalleryImagesAttributes()
);
}

Expand Down Expand Up @@ -353,9 +353,16 @@ private function executeImagesChanged()
);
}

/** @var Ess_M2ePro_Model_Listing_Product[] $changedListingsProductsByVariationOption */
/** @var Ess_M2ePro_Model_Ebay_Template_Description $template */
foreach ($ebayTemplateDescriptionItems as $template) {
$attributesForProductChange = array_merge(
$attributesForProductChange,
$template->getVariationImagesAttributes()
);
}

$changedListingsProductsByVariationOption = $this->getChangesHelper()->getInstancesByVariationOption(
$attributesForProductChange, true
array_unique($attributesForProductChange), true
);

foreach ($changedListingsProductsByVariationOption as $listingProduct) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1056,14 +1056,14 @@ protected function getBundleTitlesVariationSet()

$values = array();
foreach ($storeOption['values'] as $valueStoreTitles) {
$valueStoreTitles = array_unique($valueStoreTitles);
$valueStoreTitles = array_values($valueStoreTitles);

$keyValue = $valueStoreTitles[Mage_Core_Model_App::ADMIN_STORE_ID];
if (isset($valueStoreTitles[$this->getMagentoProduct()->getStoreId()])) {
$keyValue = $valueStoreTitles[$this->getMagentoProduct()->getStoreId()];
}

$valueStoreTitles = array_unique($valueStoreTitles);
$valueStoreTitles = array_values($valueStoreTitles);

$values[$keyValue] = $valueStoreTitles;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ class Ess_M2ePro_Model_Magento_Quote_Store_Configurator

public function init(Mage_Sales_Model_Quote $quote, Ess_M2ePro_Model_Order_Proxy $proxyOrder)
{
// we need clear singleton stored instances, because magento caches tax rates in private properties
Mage::unregister('_singleton/tax/calculation');
Mage::unregister('_resource_singleton/tax/calculation');
Mage::unregister('_singleton/sales/quote_address_total_collector');

$this->quote = $quote;
$this->proxyOrder = $proxyOrder;
$this->taxConfig = Mage::getSingleton('tax/config');
Expand Down
6 changes: 6 additions & 0 deletions app/code/community/Ess/M2ePro/Model/Observer/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ public function process()

/** @var $shipment Mage_Sales_Model_Order_Shipment */
$shipment = $this->getEvent()->getShipment();

if ($shipment->getData('is_already_processed_by_m2epro')) {
return;
}
$shipment->setData('is_already_processed_by_m2epro', true);

$magentoOrderId = $shipment->getOrderId();

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ public function process()
$track = $this->getEvent()->getTrack();

$shipment = $track->getShipment();

if ($shipment->getData('is_already_processed_by_m2epro')) {
return;
}
$shipment->setData('is_already_processed_by_m2epro', true);

$magentoOrderId = $shipment->getOrderId();

try {
Expand Down
5 changes: 5 additions & 0 deletions app/code/community/Ess/M2ePro/Model/Order/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,11 @@ public function unassignProduct()
$this->setData('product_id', null);
$this->setAssociatedProducts(array());
$this->setAssociatedOptions(array());

if ($this->getOrder()->getReserve()->isPlaced()) {
$this->getOrder()->getReserve()->cancel();
}

$this->save();
}

Expand Down
Loading

0 comments on commit a8471d5

Please sign in to comment.