Skip to content

Commit 45439d8

Browse files
committed
1.75.1 (FINAL RELEASE)
1 parent eb6b977 commit 45439d8

File tree

29 files changed

+506
-447
lines changed

29 files changed

+506
-447
lines changed

Block/Adminhtml/Amazon/Listing/View/Amazon/Grid.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ protected function _prepareColumns()
246246
]);
247247

248248
$this->addColumn('amazon_sku', [
249-
'header' => $this->__('SKU'),
250-
'header_export' => __('Amazon SKU'),
249+
'header' => $this->__('Channel SKU'),
250+
'header_export' => __('Channel SKU'),
251251
'align' => 'left',
252252
'width' => '150px',
253253
'type' => 'text',

Block/Adminhtml/Walmart/Listing/View/Walmart/Grid.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ protected function _prepareColumns()
223223
]);
224224

225225
$this->addColumn('sku', [
226-
'header' => __('SKU'),
227-
'header_export' => __('Walmart SKU'),
226+
'header' => __('Channel SKU'),
227+
'header_export' => __('Channel SKU'),
228228
'align' => 'left',
229229
'width' => '150px',
230230
'type' => 'text',

Controller/Adminhtml/Listing/Moving/MoveToListing.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
<?php
22

3-
/**
4-
* @author M2E Pro Developers Team
5-
* @copyright M2E LTD
6-
* @license Commercial use is forbidden
7-
*/
8-
93
namespace Ess\M2ePro\Controller\Adminhtml\Listing\Moving;
104

5+
use Ess\M2ePro\Model\Ebay\Listing\Product\Variation\Updater as EbayVariationUpdater;
6+
use Ess\M2ePro\Model\Amazon\Listing\Product\Variation\Updater as AmazonVariationUpdater;
7+
use Ess\M2ePro\Model\Walmart\Listing\Product\Variation\Updater as WalmartVariationUpdater;
8+
119
class MoveToListing extends \Ess\M2ePro\Controller\Adminhtml\Listing
1210
{
1311
/** @var \Ess\M2ePro\Helper\Data\Session */
@@ -44,9 +42,8 @@ public function execute()
4442
$variationUpdaterModel = ucwords($targetListing->getComponentMode())
4543
. '\Listing\Product\Variation\Updater';
4644

47-
/** @var \Ess\M2ePro\Model\Listing\Product\Variation\Updater $variationUpdaterObject */
45+
/** @var EbayVariationUpdater|AmazonVariationUpdater|WalmartVariationUpdater $variationUpdaterObject */
4846
$variationUpdaterObject = $this->modelFactory->getObject($variationUpdaterModel);
49-
$variationUpdaterObject->beforeMassProcessEvent();
5047

5148
$errorsCount = 0;
5249
foreach ($selectedProducts as $listingProductId) {

Helper/Component/Ebay.php

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ class Ebay
2424
public const MARKETPLACE_IN = 16;
2525

2626
public const LISTING_DURATION_GTC = 100;
27-
public const MAX_LENGTH_FOR_OPTION_VALUE = 50;
28-
public const VARIATION_SKU_MAX_LENGTH = 80;
2927
public const ITEM_SKU_MAX_LENGTH = 50;
3028

3129
/** @var \Ess\M2ePro\Model\ActiveRecord\Component\Parent\Ebay\Factory */
@@ -40,25 +38,21 @@ class Ebay
4038
private $config;
4139
/** @var \Ess\M2ePro\Helper\Data\Cache\Permanent */
4240
private $cachePermanent;
43-
/** @var \Ess\M2ePro\Helper\Data */
44-
private $dataHelper;
4541

4642
public function __construct(
4743
\Ess\M2ePro\Helper\Component\Ebay\Configuration $componentEbayConfiguration,
4844
\Ess\M2ePro\Model\ActiveRecord\Component\Parent\Ebay\Factory $ebayFactory,
4945
\Ess\M2ePro\Helper\Module\Translation $moduleTranslation,
5046
\Ess\M2ePro\Model\ActiveRecord\Factory $activeRecordFactory,
5147
\Ess\M2ePro\Helper\Data\Cache\Permanent $cachePermanent,
52-
\Ess\M2ePro\Model\Config\Manager $config,
53-
\Ess\M2ePro\Helper\Data $dataHelper
48+
\Ess\M2ePro\Model\Config\Manager $config
5449
) {
5550
$this->ebayFactory = $ebayFactory;
5651
$this->activeRecordFactory = $activeRecordFactory;
5752
$this->componentEbayConfiguration = $componentEbayConfiguration;
5853
$this->moduleTranslation = $moduleTranslation;
5954
$this->config = $config;
6055
$this->cachePermanent = $cachePermanent;
61-
$this->dataHelper = $dataHelper;
6256
}
6357

6458
// ----------------------------------------
@@ -297,86 +291,6 @@ public function getCarrierTitle($carrierCode, $title = null): string
297291

298292
// ----------------------------------------
299293

300-
/**
301-
* @param array $options
302-
*
303-
* @return array
304-
*/
305-
public function prepareOptionsForVariations(array $options): array
306-
{
307-
$set = [];
308-
foreach ($options['set'] as $optionTitle => $optionsSet) {
309-
foreach ($optionsSet as $singleOptionKey => $singleOption) {
310-
$set[trim($optionTitle)][$singleOptionKey] = trim(
311-
$this->dataHelper->reduceWordsInString(
312-
$singleOption,
313-
self::MAX_LENGTH_FOR_OPTION_VALUE
314-
)
315-
);
316-
}
317-
}
318-
$options['set'] = $set;
319-
320-
foreach ($options['variations'] as &$variation) {
321-
foreach ($variation as &$singleOption) {
322-
$singleOption['option'] = trim(
323-
$this->dataHelper->reduceWordsInString(
324-
$singleOption['option'],
325-
self::MAX_LENGTH_FOR_OPTION_VALUE
326-
)
327-
);
328-
$singleOption['attribute'] = trim($singleOption['attribute']);
329-
}
330-
}
331-
unset($singleOption, $variation);
332-
333-
return $options;
334-
}
335-
336-
/**
337-
* @param array $options
338-
*
339-
* @return array
340-
*/
341-
public function prepareOptionsForOrders(array $options): array
342-
{
343-
foreach ($options as &$singleOption) {
344-
if ($singleOption instanceof \Magento\Catalog\Model\Product) {
345-
$reducedName = trim(
346-
$this->dataHelper->reduceWordsInString(
347-
$singleOption->getName(),
348-
self::MAX_LENGTH_FOR_OPTION_VALUE
349-
)
350-
);
351-
$singleOption->setData('name', $reducedName);
352-
353-
continue;
354-
}
355-
356-
foreach ($singleOption['values'] as &$singleOptionValue) {
357-
foreach ($singleOptionValue['labels'] as &$singleOptionLabel) {
358-
$singleOptionLabel = trim(
359-
$this->dataHelper->reduceWordsInString(
360-
$singleOptionLabel,
361-
self::MAX_LENGTH_FOR_OPTION_VALUE
362-
)
363-
);
364-
}
365-
}
366-
}
367-
368-
if (isset($options['additional']['attributes'])) {
369-
foreach ($options['additional']['attributes'] as $code => &$title) {
370-
$title = trim($title);
371-
}
372-
unset($title);
373-
}
374-
375-
return $options;
376-
}
377-
378-
// ----------------------------------------
379-
380294
/**
381295
* @return void
382296
*/

Helper/Data.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -337,22 +337,13 @@ public function normalizeToUtfEncoding($data)
337337
return self::normalizeToUtf($data);
338338
}
339339

340-
/**
341-
* @param string $string
342-
* @param int $neededLength
343-
* @param int $longWord
344-
* @param int $minWordLen
345-
* @param int $atEndOfWord
346-
*
347-
* @return string
348-
*/
349-
public function reduceWordsInString(
340+
public static function reduceWordsInString(
350341
$string,
351-
$neededLength,
352-
$longWord = 6,
353-
$minWordLen = 2,
354-
$atEndOfWord = '.'
355-
) {
342+
int $neededLength,
343+
int $longWord = 6,
344+
int $minWordLen = 2,
345+
string $atEndOfWord = '.'
346+
): string {
356347
$oldEncoding = mb_internal_encoding();
357348
mb_internal_encoding('UTF-8');
358349

Model/Ebay/Connector/Item/Requester.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,11 @@ protected function validateConfigurator()
281281

282282
protected function initializeVariations()
283283
{
284-
/** @var \Ess\M2ePro\Model\Ebay\Listing\Product\Variation\Updater $variationUpdater */
285-
$variationUpdater = $this->modelFactory->getObject('Ebay_Listing_Product_Variation_Updater');
286-
$variationUpdater->process($this->listingProduct);
287-
$variationUpdater->afterMassProcessEvent();
284+
/** @var \Ess\M2ePro\Model\Ebay\Listing\Product\VariationService $variationService */
285+
$variationService = \Magento\Framework\App\ObjectManager::getInstance()->get(
286+
\Ess\M2ePro\Model\Ebay\Listing\Product\VariationService::class
287+
);
288+
$variationService->update($this->listingProduct);
288289
}
289290

290291
//########################################

Model/Ebay/Listing/Product/Instruction/SynchronizationTemplate/Checker/Active.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,16 @@ public function process(array $params = []): void
217217
}
218218
}
219219

220+
if (
221+
$configurator->isQtyAllowed()
222+
&& !$configurator->isPriceAllowed()
223+
) {
224+
if ($this->isMeetForceRevisePriceRequirements()) {
225+
$configurator->allowPrice();
226+
$tags['price'] = true;
227+
}
228+
}
229+
220230
if (
221231
!$this->input->getListingProduct()->hasBlockingByError()
222232
&& $this->input->hasInstructionWithTypes($this->getReviseTitleInstructionTypes())
@@ -617,4 +627,20 @@ public function isMeetReviseOtherRequirements(): bool
617627
$this->input->getListingProduct()->getChildObject()
618628
);
619629
}
630+
631+
private function isMeetForceRevisePriceRequirements(): bool
632+
{
633+
/** @var \Ess\M2ePro\Model\Ebay\Listing\Product $ebayListingProduct */
634+
$ebayListingProduct = $this->input->getListingProduct()->getChildObject();
635+
636+
if ($ebayListingProduct->isProductInPromotion()) {
637+
return false;
638+
}
639+
640+
if (!$ebayListingProduct->getEbaySynchronizationTemplate()->isReviseUpdatePrice()) {
641+
return false;
642+
}
643+
644+
return true;
645+
}
620646
}

Model/Ebay/Listing/Product/PriceCalculator.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
<?php
22

3-
/**
4-
* @author M2E Pro Developers Team
5-
* @copyright M2E LTD
6-
* @license Commercial use is forbidden
7-
*/
8-
93
namespace Ess\M2ePro\Model\Ebay\Listing\Product;
104

115
use Ess\M2ePro\Model\Ebay\Template\SellingFormat;
12-
use Ess\M2ePro\Model\Listing\Product\Variation as ListingProductVariation;
136

147
class PriceCalculator extends \Ess\M2ePro\Model\Listing\Product\PriceCalculator
158
{
@@ -26,11 +19,8 @@ protected function isPriceVariationModeChildren()
2619
protected function prepareOptionTitles($optionTitles)
2720
{
2821
foreach ($optionTitles as &$optionTitle) {
29-
$optionTitle = trim(
30-
$this->helperFactory->getObject('Data')->reduceWordsInString(
31-
$optionTitle,
32-
\Ess\M2ePro\Helper\Component\Ebay::MAX_LENGTH_FOR_OPTION_VALUE
33-
)
22+
$optionTitle = \Ess\M2ePro\Model\Ebay\Listing\Product\Variation\Option::formatOptionValue(
23+
(string)$optionTitle
3424
);
3525
}
3626

Model/Ebay/Listing/Product/Variation.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
<?php
22

3-
/**
4-
* @author M2E Pro Developers Team
5-
* @copyright M2E LTD
6-
* @license Commercial use is forbidden
7-
*/
8-
93
namespace Ess\M2ePro\Model\Ebay\Listing\Product;
104

115
/**
126
* @method \Ess\M2ePro\Model\Listing\Product\Variation getParentObject()
137
*/
148
class Variation extends \Ess\M2ePro\Model\ActiveRecord\Component\Child\Ebay\AbstractModel
159
{
10+
private const SKU_MAX_LENGTH = 80;
11+
1612
/** @var \Ess\M2ePro\Model\Ebay\Listing\Product\PriceCalculatorFactory */
1713
private $priceCalculatorFactory;
1814

@@ -436,7 +432,7 @@ public function getSku()
436432
. $this->getHelper('Data')->convertStringToSku($option->getOption());
437433
}
438434

439-
if (mb_strlen($sku) > \Ess\M2ePro\Helper\Component\Ebay::VARIATION_SKU_MAX_LENGTH) {
435+
if (mb_strlen($sku) > self::SKU_MAX_LENGTH) {
440436
$sku = 'RANDOM_' . sha1($sku);
441437
}
442438

0 commit comments

Comments
 (0)