Skip to content

Commit c34ced3

Browse files
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #18375: Backport 2.2 - Fix wrong reference in google analytics module layout xml (by @sambolek) - #18369: [Backport] Fix throwing error by checkout error processor model (by @ihor-sviziev) - #18283: [Backport] Fix for removing the dirs while creating a TAR archive (by @haroldclaus) - #18377: [Backport 2.2-develop] Refactor Mass Order Cancel code to use Interface (by @JeroenVanLeusden) - #17986: Implemented 17964: Backend Order creation Authorizenet: If invalid cr� (by @passtet) - #17882: Do not overwrite URL Key with blank value (by @josephmcdermott) Fixed GitHub Issues: - #16497: Magento 2.2.5: Google Analytics not added to head correctly (reported by @WalterSmulders) has been fixed in #18375 by @sambolek in 2.2-develop branch Related commits: 1. 0189014 - #18330: Checkout - Infinite loading indicator when server returned error (reported by @ihor-sviziev) has been fixed in #18369 by @ihor-sviziev in 2.2-develop branch Related commits: 1. 74bed69 - #17023: CSV Import of `sku,attribute` empties `url_key` value (reported by @josephmcdermott) has been fixed in #17882 by @josephmcdermott in 2.2-develop branch Related commits: 1. a021d5f 2. a02bf03 3. e48683c 4. 7df4e12 5. fffb6ff 6. 002aa19 7. 172e2ec 8. 3a54946 9. 2fb7183 10. fda664a 11. abd95bd 12. 0f26b52
2 parents 98ee213 + c53d9a5 commit c34ced3

File tree

9 files changed

+357
-29
lines changed

9 files changed

+357
-29
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,10 @@ protected function _saveProducts()
15621562
}
15631563
$rowScope = $this->getRowScope($rowData);
15641564

1565-
$rowData[self::URL_KEY] = $this->getUrlKey($rowData);
1565+
$urlKey = $this->getUrlKey($rowData);
1566+
if (!empty($urlKey)) {
1567+
$rowData[self::URL_KEY] = $urlKey;
1568+
}
15661569

15671570
$rowSku = $rowData[self::COL_SKU];
15681571

@@ -2452,7 +2455,9 @@ public function validateRow(array $rowData, $rowNum)
24522455
*/
24532456
private function isNeedToValidateUrlKey($rowData)
24542457
{
2455-
return (!empty($rowData[self::URL_KEY]) || !empty($rowData[self::COL_NAME]))
2458+
$urlKey = $this->getUrlKey($rowData);
2459+
2460+
return (!empty($urlKey))
24562461
&& (empty($rowData[self::COL_VISIBILITY])
24572462
|| $rowData[self::COL_VISIBILITY]
24582463
!== (string)Visibility::getOptionArray()[Visibility::VISIBILITY_NOT_VISIBLE]);
@@ -2764,8 +2769,14 @@ protected function getUrlKey($rowData)
27642769
if (!empty($rowData[self::URL_KEY])) {
27652770
return $this->productUrl->formatUrlKey($rowData[self::URL_KEY]);
27662771
}
2767-
2768-
if (!empty($rowData[self::COL_NAME])) {
2772+
2773+
/**
2774+
* If the product exists, assume it already has a URL Key and even
2775+
* if a name is provided in the import data, it should not be used
2776+
* to overwrite that existing URL Key the product already has.
2777+
*/
2778+
$isSkuExist = $this->isSkuExist($rowData[self::COL_SKU]);
2779+
if (!$isSkuExist && !empty($rowData[self::COL_NAME])) {
27692780
return $this->productUrl->formatUrlKey($rowData[self::COL_NAME]);
27702781
}
27712782

app/code/Magento/Checkout/view/frontend/web/js/model/error-processor.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
*/
99
define([
1010
'mage/url',
11-
'Magento_Ui/js/model/messageList'
12-
], function (url, globalMessageList) {
11+
'Magento_Ui/js/model/messageList',
12+
'consoleLogger'
13+
], function (url, globalMessageList, consoleLogger) {
1314
'use strict';
1415

1516
return {
@@ -25,8 +26,12 @@ define([
2526
if (response.status == 401) { //eslint-disable-line eqeqeq
2627
window.location.replace(url.build('customer/account/login/'));
2728
} else {
28-
error = JSON.parse(response.responseText);
29-
messageContainer.addErrorMessage(error);
29+
try {
30+
error = JSON.parse(response.responseText);
31+
messageContainer.addErrorMessage(error);
32+
} catch (e) {
33+
consoleLogger.error(e);
34+
}
3035
}
3136
}
3237
};

app/code/Magento/GoogleAnalytics/view/frontend/layout/default.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
-->
88
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
99
<body>
10-
<referenceContainer name="head.additional">
10+
<referenceBlock name="head.additional">
1111
<block class="Magento\GoogleAnalytics\Block\Ga" name="google_analytics" as="google_analytics" template="Magento_GoogleAnalytics::ga.phtml"/>
12-
</referenceContainer>
12+
</referenceBlock>
1313
</body>
1414
</page>

app/code/Magento/Sales/Controller/Adminhtml/Order/MassCancel.php

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,37 @@
1111
use Magento\Ui\Component\MassAction\Filter;
1212
use Magento\Sales\Model\ResourceModel\Order\CollectionFactory;
1313
use Magento\Framework\App\Request\Http as HttpRequest;
14+
use Magento\Sales\Api\OrderManagementInterface;
1415

1516
class MassCancel extends \Magento\Sales\Controller\Adminhtml\Order\AbstractMassAction
1617
{
1718
/**
1819
* Authorization level of a basic admin session
1920
*/
2021
const ADMIN_RESOURCE = 'Magento_Sales::cancel';
22+
23+
/**
24+
* @var OrderManagementInterface
25+
*/
26+
private $orderManagement;
2127

2228
/**
2329
* @param Context $context
2430
* @param Filter $filter
2531
* @param CollectionFactory $collectionFactory
32+
* @param OrderManagementInterface|null $orderManagement
2633
*/
27-
public function __construct(Context $context, Filter $filter, CollectionFactory $collectionFactory)
28-
{
34+
public function __construct(
35+
Context $context,
36+
Filter $filter,
37+
CollectionFactory $collectionFactory,
38+
OrderManagementInterface $orderManagement = null
39+
) {
2940
parent::__construct($context, $filter);
3041
$this->collectionFactory = $collectionFactory;
42+
$this->orderManagement = $orderManagement ?: \Magento\Framework\App\ObjectManager::getInstance()->get(
43+
\Magento\Sales\Api\OrderManagementInterface::class
44+
);
3145
}
3246

3347
/**
@@ -54,11 +68,10 @@ protected function massAction(AbstractCollection $collection)
5468
{
5569
$countCancelOrder = 0;
5670
foreach ($collection->getItems() as $order) {
57-
if (!$order->canCancel()) {
71+
$isCanceled = $this->orderManagement->cancel($order->getEntityId());
72+
if ($isCanceled === false) {
5873
continue;
5974
}
60-
$order->cancel();
61-
$order->save();
6275
$countCancelOrder++;
6376
}
6477
$countNonCancelOrder = $collection->count() - $countCancelOrder;

0 commit comments

Comments
 (0)