Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading to 6.4.8 #3

Merged
merged 1 commit into from
Feb 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/app/code/community/Ess/M2ePro/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
* 6.4.8 (r11156) (06/02/2017)

* Added: [eBay] Ability to use Parts Compatibility Feature for France Marketplace (kTypes)
* Improvement: More stable extension Install / Upgrade process
* Improvement: Prevention of executing synchronization in parallel when Service Cron is working
* Fix: Wrong message "Domain is invalid for this license" in some cases
* Fix: Magento Order was not created due to "Out of Stock" reason if Product Quantity was reserved earlier
* Fix: Unicode string may be cut in a wrong place (on the border of two bytes of one Unicode character)
* Fix: Warning "Compilation failed: regular expression is too large at offset" when you are using Advanced Filter of the Grid
* Fix: "Unknown Product type." exception, during synchronization, if Variation Magento Product was removed directly from database
* Fix: [eBay] Automatic Cancellation did not work for the Orders, which were not paid
* Fix: [eBay] Custom Import from CSV file of Parts Compatibilities (ePIDs/kTypes) did not work in some cases
* Fix: [Amazon] "Disable Repricing" option did not work correctly for Variational Products
* Fix: [Amazon] "Duplicate entry for key 'PRIMARY'" error during Synchronization process
* Fix: [Amazon] If some Products are managed by Repricing Tool, their prices can have wrong values in the grids
* Fix: [Amazon] If some Products are added to the Repricing Tool but they are in the disabled state, their prices can have wrong values in the grids
* Fix: [Amazon] If Magento Product becomes Variational, some associated Listing Products may be broken as a result
* Fix: [Amazon] Incorrect behavior during adding virtual attributes to active variation products
* Fix: [Amazon] Error message "General ID "%id%" is invalid" can be shown during List/Relist/... actions, even if the value is a valid ISBN10

* 6.4.7.1 (r11020) (05/12/2016)

* Fix: [Amazon] Ability to use Repricing Service without the need to contact support of M2E Pro
* Fix: [Amazon] "Warning: Illegal string offset 'product_price' in /app/code/community/Ess/M2ePro/Model/Amazon/Repricing/Synchronization/ActualPrice.php

* 6.4.7 (r10970) (28/11/2016)

* Added: [Amazon] Ability to use Repricing Service without the need to contact support of M2E Pro
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ abstract class Ess_M2ePro_Controller_Adminhtml_BaseController

protected $pageHelpLink = NULL;

protected $isUnAuthorized = false;

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

public function indexAction()
Expand Down Expand Up @@ -43,7 +45,7 @@ protected function getPageHelpLink()

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

public function preDispatch()
final public function preDispatch()
{
parent::preDispatch();

Expand All @@ -57,41 +59,51 @@ public function preDispatch()
* The code below is the logical extension of the method \Ess_M2ePro_Controller_Router::addModule.
*/
// -----------------------------------------------------------------
if (!$this->getRequest()->isDispatched() &&
!Mage::getSingleton('admin/session')->isLoggedIn() &&
$this->getRequest()->getActionName() == 'login') {
if (!Mage::getSingleton('admin/session')->isLoggedIn()) {

return $this->_redirect('M2ePro/index/index/');
}
// -----------------------------------------------------------------
$this->isUnAuthorized = true;

// client was logged out
if ($this->getRequest()->isXmlHttpRequest() &&
!Mage::getSingleton('admin/session')->isLoggedIn()) {
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
$this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
$this->setFlag('', self::FLAG_NO_PRE_DISPATCH, true);

exit(json_encode(array(
'ajaxExpired' => 1,
'ajaxRedirect' => $this->_getRefererUrl()
)));
if ($this->getRequest()->isXmlHttpRequest()) {
exit(json_encode(array(
'ajaxExpired' => 1,
'ajaxRedirect' => Mage::getBaseUrl()
)));
}

if (Mage::helper('M2ePro/Module')->isProductionEnvironment()) {
return $this->getResponse()->setRedirect(Mage::getBaseUrl());
}
}
// -----------------------------------------------------------------

Mage::helper('M2ePro/Module_Exception')->setFatalErrorHandler();

// flag controller loaded
// flag that controller is loaded
if (is_null(Mage::helper('M2ePro/Data_Global')->getValue('is_base_controller_loaded'))) {
Mage::helper('M2ePro/Data_Global')->setValue('is_base_controller_loaded',true);
}

$this->__preDispatch();

return $this;
}

public function dispatch($action)
final public function dispatch($action)
{
try {

Mage::helper('M2ePro/Module_Exception')->setFatalErrorHandler();
parent::dispatch($action);

} catch (Exception $exception) {

if ($this->isUnAuthorized) {
throw $exception;
}

if ($this->getRequest()->getControllerName() ==
Mage::helper('M2ePro/Module_Support')->getPageControllerName()) {
exit($exception->getMessage());
Expand Down Expand Up @@ -127,6 +139,27 @@ public function dispatch($action)
}
}

final public function postDispatch()
{
parent::postDispatch();

if ($this->isUnAuthorized) {
return;
}

$this->__postDispatch();
}

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

protected function __preDispatch() {}

protected function __postDispatch()
{
// Removes garbage from the response's body
ob_get_clean();
}

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

public function loadLayout($ids=null, $generateBlocks=true, $generateXml=true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ abstract class Ess_M2ePro_Controller_Adminhtml_Development_CommandController
{
//########################################

/**
* Allows fill response by echo(), etc.
*/
protected function __postDispatch() {}

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

public function indexAction()
{
$this->_redirect(Mage::helper('M2ePro/View_Development')->getPageRoute());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ abstract class Ess_M2ePro_Controller_Adminhtml_MainController
{
//########################################

public function preDispatch()
protected function __preDispatch()
{
parent::preDispatch();
parent::__preDispatch();

if ($this->getRequest()->isGet() &&
!$this->getRequest()->isPost() &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Ess_M2ePro_Helper_Component_Ebay extends Mage_Core_Helper_Abstract
const MARKETPLACE_MOTORS = 9;
const MARKETPLACE_AU = 4;
const MARKETPLACE_UK = 3;
const MARKETPLACE_FR = 7;
const MARKETPLACE_DE = 8;
const MARKETPLACE_IT = 10;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function getKtypeSupportedMarketplaces()
Ess_M2ePro_Helper_Component_Ebay::MARKETPLACE_UK,
Ess_M2ePro_Helper_Component_Ebay::MARKETPLACE_DE,
Ess_M2ePro_Helper_Component_Ebay::MARKETPLACE_IT,
Ess_M2ePro_Helper_Component_Ebay::MARKETPLACE_FR,
);
}

Expand Down
20 changes: 15 additions & 5 deletions src/app/code/community/Ess/M2ePro/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,19 @@ public function escapeHtml($data, $allowedTags = null, $flags = ENT_COMPAT)

public function reduceWordsInString($string, $neededLength, $longWord = 6, $minWordLen = 2, $atEndOfWord = '.')
{
if (strlen($string) <= $neededLength) {
$oldEncoding = mb_internal_encoding();
mb_internal_encoding('UTF-8');

if (mb_strlen($string) <= $neededLength) {

mb_internal_encoding($oldEncoding);
return $string;
}

$longWords = array();
foreach (explode(' ', $string) as $word) {
if (strlen($word) >= $longWord && !preg_match('/[0-9]/', $word)) {
$longWords[$word] = strlen($word) - $minWordLen;
if (mb_strlen($word) >= $longWord && !preg_match('/[0-9]/', $word)) {
$longWords[$word] = mb_strlen($word) - $minWordLen;
}
}

Expand All @@ -224,17 +229,19 @@ public function reduceWordsInString($string, $neededLength, $longWord = 6, $minW
$canBeReduced += $canBeReducedForWord;
}

$needToBeReduced = strlen($string) - $neededLength + (count($longWords) * strlen($atEndOfWord));
$needToBeReduced = mb_strlen($string) - $neededLength + (count($longWords) * mb_strlen($atEndOfWord));

if ($canBeReduced < $needToBeReduced) {

mb_internal_encoding($oldEncoding);
return $string;
}

$weightOfOneLetter = $needToBeReduced / $canBeReduced;
foreach ($longWords as $word => $canBeReducedForWord) {

$willReduced = ceil($weightOfOneLetter * $canBeReducedForWord);
$reducedWord = substr($word, 0, strlen($word) - $willReduced) . $atEndOfWord;
$reducedWord = mb_substr($word, 0, mb_strlen($word) - $willReduced) . $atEndOfWord;

$string = str_replace($word, $reducedWord, $string);

Expand All @@ -243,6 +250,7 @@ public function reduceWordsInString($string, $neededLength, $longWord = 6, $minW
}
}

mb_internal_encoding($oldEncoding);
return $string;
}

Expand Down Expand Up @@ -495,6 +503,8 @@ public function isISBN10($string)
}

$a = 0;
$string = (string)$string;

for ($i = 0; $i < 10; $i++) {
if ($string[$i] == "X" || $string[$i] == "x") {
$a += 10 * intval(10 - $i);
Expand Down
2 changes: 1 addition & 1 deletion src/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 = '10970';
$revision = '11156';

if ($revision == str_replace('|','#','|REVISION|')) {
$revision = (int)exec('svnversion');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public function isDisabled()
return $isDisabled;
}

if ($this->getMagentoProduct()->isSimpleType() || $this->getMagentoProduct()->isGroupedType()) {
if ($this->getMagentoProduct()->isSimpleType() || $this->getMagentoProduct()->isBundleType()) {
return $isDisabled;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ protected function check()
return;
}

$channelVariations = $this->getProcessor()->getTypeModel()->getChannelVariations();

foreach ($this->getProcessor()->getTypeModel()->getChildListingsProducts() as $listingProduct) {
/** @var Ess_M2ePro_Model_Listing_Product $listingProduct */

/** @var Ess_M2ePro_Model_Amazon_Listing_Product_Variation_Manager $variationManager */
$variationManager = $listingProduct->getChildObject()->getVariationManager();
/** @var Ess_M2ePro_Model_Amazon_Listing_Product $amazonListingProduct */
$amazonListingProduct = $listingProduct->getChildObject();

/** @var Ess_M2ePro_Model_Amazon_Listing_Product_Variation_Manager_Type_Relation_Child $typeModel */
$typeModel = $variationManager->getTypeModel();
$typeModel = $amazonListingProduct->getVariationManager()->getTypeModel();

if (!$typeModel->isActualProductAttributes() ||
!$typeModel->isActualMatchedAttributes() ||
Expand All @@ -55,6 +57,15 @@ protected function check()
$typeModel->resetProductVariation();
}

if ($typeModel->isVariationChannelMatched()) {
$currentChannelOptions = $channelVariations[$amazonListingProduct->getGeneralId()];
$childChannelOptions = $typeModel->getChannelOptions();

if ($currentChannelOptions != $childChannelOptions) {
$typeModel->setChannelVariation($currentChannelOptions);
}
}

if (!$typeModel->isVariationProductMatched() && !$typeModel->isVariationChannelMatched()) {
$this->getProcessor()->tryToRemoveChildListingProduct($listingProduct);
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ private function checkChangeAsVariationProduct(Ess_M2ePro_Model_Listing_Product
}

$listingProduct->setData('is_variation_product', 1);
$variationManager->setRelationParentType();
$variationManager->getTypeModel()->resetProductAttributes(false);
$variationManager->getTypeModel()->getProcessor()->process();
$variationManager->setIndividualType();
$variationManager->getTypeModel()->resetProductVariation();

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class Ess_M2ePro_Model_Amazon_Repricing_Synchronization_ActualPrice
public function run($skus = NULL)
{
$existedSkus = array_unique(array_merge(
Mage::getResourceModel('M2ePro/Amazon_Listing_Product_Repricing')->getAllSkus($this->getAccount()),
Mage::getResourceModel('M2ePro/Amazon_Listing_Other')->getAllRepricingSkus($this->getAccount())
Mage::getResourceModel('M2ePro/Amazon_Listing_Product_Repricing')->getAllSkus($this->getAccount(), true),
Mage::getResourceModel('M2ePro/Amazon_Listing_Other')->getAllRepricingSkus($this->getAccount(), true)
));

if (is_null($skus)) {
Expand Down Expand Up @@ -158,7 +158,7 @@ private function updateListingsOthersPrices(array $offersProductPrices)
$connWrite->update(
$resource->getTableName('m2epro_amazon_listing_other'),
array(
'online_price' => $offerProductPrice['product_price'],
'online_price' => $offerProductPrice,
),
array('listing_other_id = ?' => $listingOtherId)
);
Expand Down
Loading