Skip to content

Commit c8b305d

Browse files
committed
1.66.2 (FINAL RELEASE)
1 parent 23e458f commit c8b305d

File tree

52 files changed

+503
-388
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+503
-388
lines changed

Block/Adminhtml/Amazon/Listing/View.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44

55
class View extends \Ess\M2ePro\Block\Adminhtml\Magento\Grid\AbstractContainer
66
{
7-
/** @var \Ess\M2ePro\Model\Listing */
8-
protected $listing;
9-
/** @var \Ess\M2ePro\Helper\Data */
10-
private $dataHelper;
11-
/** @var \Ess\M2ePro\Helper\Data\GlobalData */
12-
private $globalDataHelper;
13-
/** @var \Ess\M2ePro\Helper\Data\Session */
14-
private $sessionDataHelper;
7+
protected \Ess\M2ePro\Model\Listing $listing;
8+
private \Ess\M2ePro\Helper\Data $dataHelper;
9+
private \Ess\M2ePro\Helper\Data\GlobalData $globalDataHelper;
10+
private \Ess\M2ePro\Helper\Data\Session $sessionDataHelper;
1511

1612
public function __construct(
1713
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Widget $context,
@@ -63,11 +59,6 @@ protected function _prepareLayout()
6359
available Actions accessible in the Mass Actions drop-down.</p>'
6460
),
6561
]);
66-
67-
$this->setPageActionsBlock(
68-
'Amazon_Listing_View_Switcher',
69-
'amazon_listing_view_switcher'
70-
);
7162
}
7263

7364
// ---------------------------------------

Block/Adminhtml/Amazon/Template/ProductType/Edit.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,6 @@ public function _construct()
111111

112112
$isSaveAndClose = (bool)$this->getRequest()->getParam('close_on_save', false);
113113

114-
//$this->addButton(
115-
// 'view_mode_switch_button',
116-
// [
117-
// 'class_name' => \Ess\M2ePro\Block\Adminhtml\Magento\Button\ProductTypeSwitchButton::class,
118-
// 'label' => $this->__('Only Required Attributes'),
119-
// 'value' => $this->productType->getViewMode(),
120-
// ]
121-
//);
122-
123114
if (!$isSaveAndClose && $this->isEditMode()) {
124115
$this->buttonList->add(
125116
'delete',

Block/Adminhtml/Ebay/Listing/Switcher.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

Block/Adminhtml/Ebay/Listing/View.php

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +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\Block\Adminhtml\Ebay\Listing;
104

115
use Ess\M2ePro\Block\Adminhtml\Magento\Grid\AbstractContainer;
126

137
class View extends AbstractContainer
148
{
15-
/** @var \Ess\M2ePro\Model\Listing */
16-
private $listing;
17-
/** @var \Ess\M2ePro\Helper\Data */
18-
private $dataHelper;
19-
/** @var \Ess\M2ePro\Helper\Data\GlobalData */
20-
private $globalDataHelper;
9+
private \Ess\M2ePro\Model\Listing $listing;
10+
private \Ess\M2ePro\Helper\Data $dataHelper;
11+
private \Ess\M2ePro\Helper\Data\GlobalData $globalDataHelper;
2112

2213
public function __construct(
2314
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Widget $context,
@@ -77,11 +68,6 @@ protected function _prepareLayout()
7768
),
7869
]
7970
);
80-
81-
$this->setPageActionsBlock(
82-
'Ebay_Listing_View_Switcher',
83-
'ebay_listing_view_switcher'
84-
);
8571
}
8672

8773
// ---------------------------------------

Block/Adminhtml/Listing/Switcher.php

Lines changed: 74 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,87 @@
11
<?php
22

3-
/**
4-
* @author M2E Pro Developers Team
5-
* @copyright M2E LTD
6-
* @license Commercial use is forbidden
7-
*/
3+
declare(strict_types=1);
84

95
namespace Ess\M2ePro\Block\Adminhtml\Listing;
106

11-
use Ess\M2ePro\Block\Adminhtml\Magento\AbstractBlock;
12-
13-
/**
14-
* Class \Ess\M2ePro\Block\Adminhtml\Listing\Switcher
15-
*/
16-
abstract class Switcher extends AbstractBlock
7+
class Switcher extends \Ess\M2ePro\Block\Adminhtml\Switcher
178
{
18-
//########################################
9+
protected $paramName = 'id';
10+
private \Ess\M2ePro\Model\Amazon\Listing\Repository $amazonListingRepository;
11+
private \Ess\M2ePro\Model\Ebay\Listing\Repository $ebayListingRepository;
12+
private \Ess\M2ePro\Model\Walmart\Listing\Repository $walmartListingRepository;
13+
private string $componentMode;
14+
15+
public function __construct(
16+
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Template $context,
17+
\Ess\M2ePro\Model\Amazon\Listing\Repository $amazonListingRepository,
18+
\Ess\M2ePro\Model\Ebay\Listing\Repository $ebayListingRepository,
19+
\Ess\M2ePro\Model\Walmart\Listing\Repository $walmartListingRepository,
20+
array $data = []
21+
) {
22+
parent::__construct($context, $data);
23+
$this->amazonListingRepository = $amazonListingRepository;
24+
$this->ebayListingRepository = $ebayListingRepository;
25+
$this->walmartListingRepository = $walmartListingRepository;
26+
$this->componentMode = $data['component_mode'] ?? '';
27+
}
28+
29+
public function getLabel(): string
30+
{
31+
return (string)__('View Listing:');
32+
}
1933

20-
public function _construct()
34+
public function hasDefaultOption(): bool
2135
{
22-
parent::_construct();
36+
return false;
37+
}
2338

24-
$this->setAddListingUrl('');
39+
protected function loadItems(): void
40+
{
41+
$listings = $this->getListingCollection();
2542

26-
$this->setTemplate('Ess_M2ePro::listing/switcher.phtml');
43+
if (empty($listings)) {
44+
$this->items = [];
45+
46+
return;
47+
}
48+
49+
if (count($listings) < 2) {
50+
$this->hasDefaultOption = false;
51+
$this->setIsDisabled(true);
52+
}
53+
54+
$items = [];
55+
foreach ($listings as $listing) {
56+
$listingTitle = $this->filterManager->truncate(
57+
$listing->getTitle(),
58+
['length' => 70]
59+
);
60+
61+
$items[] = [
62+
'value' => $listing->getId(),
63+
'label' => $listingTitle,
64+
];
65+
}
66+
67+
$this->items = ['mode' => ['value' => $items]];
2768
}
2869

29-
//########################################
70+
/**
71+
* @return \Ess\M2ePro\Model\Listing[]
72+
* @throws \Ess\M2ePro\Model\Exception\Logic
73+
*/
74+
private function getListingCollection(): array
75+
{
76+
switch ($this->componentMode) {
77+
case \Ess\M2ePro\Helper\Component\Amazon::NICK:
78+
return $this->amazonListingRepository->getAll();
79+
case \Ess\M2ePro\Helper\Component\Ebay::NICK:
80+
return $this->ebayListingRepository->getAll();
81+
case \Ess\M2ePro\Helper\Component\Walmart::NICK:
82+
return $this->walmartListingRepository->getAll();
83+
default:
84+
throw new \Ess\M2ePro\Model\Exception\Logic('Invalid component mode: ' . $this->componentMode);
85+
}
86+
}
3087
}

Block/Adminhtml/Walmart/Listing/View.php

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
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\Block\Adminhtml\Walmart\Listing;
104

115
use Ess\M2ePro\Block\Adminhtml\Log\Listing\Product\AbstractGrid;
126

137
class View extends \Ess\M2ePro\Block\Adminhtml\Magento\Grid\AbstractContainer
148
{
15-
/** @var \Ess\M2ePro\Model\Listing */
16-
protected $listing;
17-
/** @var \Ess\M2ePro\Helper\Data */
18-
private $dataHelper;
19-
/** @var \Ess\M2ePro\Helper\Data\GlobalData */
20-
private $globalDataHelper;
21-
/** @var \Ess\M2ePro\Helper\Data\Session */
22-
private $sessionDataHelper;
9+
protected \Ess\M2ePro\Model\Listing $listing;
10+
private \Ess\M2ePro\Helper\Data $dataHelper;
11+
private \Ess\M2ePro\Helper\Data\GlobalData $globalDataHelper;
12+
private \Ess\M2ePro\Helper\Data\Session $sessionDataHelper;
2313

2414
public function __construct(
2515
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Widget $context,
@@ -68,11 +58,6 @@ protected function _prepareLayout()
6858
),
6959
]
7060
);
71-
72-
$this->setPageActionsBlock(
73-
'Walmart_Listing_View_Switcher',
74-
'walmart_listing_view_switcher'
75-
);
7661
}
7762

7863
$this->addButton(

Helper/Component/Ebay/BlockingErrorConfig.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

Model/Amazon/Connector/Orders/Refund/ItemsRequester.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ public function getRequestData()
7676
'order_id' => $this->params['order']['amazon_order_id'],
7777
'currency' => $this->params['order']['currency'],
7878
'type' => 'Refund',
79+
'adjustment_fee' => $this->params['order']['adjustment_fee'] ?? 0,
80+
'adjustment_refund' => $this->params['order']['adjustment_refund'] ?? 0,
81+
'shipping_refund' => $this->params['order']['shipping_refund'] ?? 0,
82+
'shipping_tax_refund' => $this->params['order']['shipping_tax_refund'] ?? 0,
7983
'items' => $this->params['order']['items'],
80-
'adjustment_fee' => $this->params['order']['adjustment_fee'] ?? null,
8184
];
8285
}
8386

Model/Amazon/Connector/Protocol.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class Protocol implements \Ess\M2ePro\Model\Connector\ProtocolInterface
1212
{
13-
public const COMPONENT_VERSION = 21;
13+
public const COMPONENT_VERSION = 22;
1414

1515
/**
1616
* @return string

Model/Amazon/Listing/Product/Action/Type/ListAction/Response.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ public function processSuccess(array $params = []): void
7272

7373
$this->setVariationData($generalId);
7474

75+
$this->getListingProduct()->removeBlockingByError();
76+
7577
$this->getListingProduct()->save();
7678

7779
if (!$variationManager->isRelationParentType()) {

0 commit comments

Comments
 (0)