Skip to content

Commit d444134

Browse files
author
Dmytro Vilchynskyi
committed
Merge remote-tracking branch 'origin/2.3-develop' into MAGETWO-72864
2 parents b2833cf + cec4bf4 commit d444134

File tree

283 files changed

+6167
-1711
lines changed

Some content is hidden

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

283 files changed

+6167
-1711
lines changed

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassRemove.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ public function execute()
3939
$this->messageManager->addException($e, __("We couldn't remove the messages because of an error."));
4040
}
4141
}
42-
$this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*')));
42+
$this->_redirect('adminhtml/*/');
4343
}
4444
}

app/code/Magento/Backend/Block/System/Store/Grid/Render/Group.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function render(\Magento\Framework\DataObject $row)
2727
$this->getUrl('adminhtml/*/editGroup', ['group_id' => $row->getGroupId()]) .
2828
'">' .
2929
$this->escapeHtml($row->getData($this->getColumn()->getIndex())) .
30-
'</a>';
30+
'</a><br />'
31+
. '(' . __('Code') . ': ' . $row->getGroupCode() . ')';
3132
}
3233
}

app/code/Magento/Backend/Block/System/Store/Grid/Render/Store.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function render(\Magento\Framework\DataObject $row)
2727
$this->getUrl('adminhtml/*/editStore', ['store_id' => $row->getStoreId()]) .
2828
'">' .
2929
$this->escapeHtml($row->getData($this->getColumn()->getIndex())) .
30-
'</a>';
30+
'</a><br />' .
31+
'(' . __('Code') . ': ' . $row->getStoreCode() . ')';
3132
}
3233
}

app/code/Magento/Backend/Block/System/Store/Grid/Render/Website.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function render(\Magento\Framework\DataObject $row)
2424
$this->getUrl('adminhtml/*/editWebsite', ['website_id' => $row->getWebsiteId()]) .
2525
'">' .
2626
$this->escapeHtml($row->getData($this->getColumn()->getIndex())) .
27-
'</a>';
27+
'</a><br />' .
28+
'(' . __('Code') . ': ' . $row->getCode() . ')';
2829
}
2930
}

app/code/Magento/Catalog/Block/Product/Image.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,19 @@
2020
class Image extends \Magento\Framework\View\Element\Template
2121
{
2222
/**
23+
* @deprecated Property isn't used
2324
* @var \Magento\Catalog\Helper\Image
2425
*/
2526
protected $imageHelper;
2627

2728
/**
29+
* @deprecated Property isn't used
2830
* @var \Magento\Catalog\Model\Product
2931
*/
3032
protected $product;
3133

3234
/**
35+
* @deprecated Property isn't used
3336
* @var array
3437
*/
3538
protected $attributes = [];

app/code/Magento/Catalog/Console/Command/ImagesResizeCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ protected function execute(
6969
$productIds = $productCollection->getAllIds();
7070
if (!count($productIds)) {
7171
$output->writeln("<info>No product images to resize</info>");
72-
// we must have an exit code higher than zero to indicate something was wrong
7372
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
7473
}
7574

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ public function execute()
113113
$options
114114
);
115115
$valueOptions = (isset($options['value']) && is_array($options['value'])) ? $options['value'] : [];
116+
foreach (array_keys($valueOptions) as $key) {
117+
if (!empty($options['delete'][$key])) {
118+
unset($valueOptions[$key]);
119+
}
120+
}
116121
$this->checkEmptyOption($response, $valueOptions);
117122
}
118123

app/code/Magento/Catalog/Cron/DeleteOutdatedPriceValues.php

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,27 +48,46 @@ public function __construct(
4848
}
4949

5050
/**
51-
* Delete all price values for non-admin stores if PRICE_SCOPE is global
51+
* Delete all price values for non-admin stores if PRICE_SCOPE is set to global.
5252
*
5353
* @return void
5454
*/
5555
public function execute()
5656
{
57-
$priceScope = $this->scopeConfig->getValue(Store::XML_PATH_PRICE_SCOPE);
58-
if ($priceScope == Store::PRICE_SCOPE_GLOBAL) {
59-
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $priceAttribute */
60-
$priceAttribute = $this->attributeRepository
61-
->get(ProductAttributeInterface::ENTITY_TYPE_CODE, ProductAttributeInterface::CODE_PRICE);
62-
$connection = $this->resource->getConnection();
63-
$conditions = [
64-
$connection->quoteInto('attribute_id = ?', $priceAttribute->getId()),
65-
$connection->quoteInto('store_id != ?', Store::DEFAULT_STORE_ID),
66-
];
57+
if (!$this->isPriceScopeSetToGlobal()) {
58+
return;
59+
}
60+
61+
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $priceAttribute */
62+
$priceAttribute = $this->attributeRepository
63+
->get(ProductAttributeInterface::ENTITY_TYPE_CODE, ProductAttributeInterface::CODE_PRICE);
64+
$connection = $this->resource->getConnection();
65+
$conditions = [
66+
$connection->quoteInto('attribute_id = ?', $priceAttribute->getId()),
67+
$connection->quoteInto('store_id != ?', Store::DEFAULT_STORE_ID),
68+
];
6769

68-
$connection->delete(
69-
$priceAttribute->getBackend()->getTable(),
70-
$conditions
71-
);
70+
$connection->delete(
71+
$priceAttribute->getBackend()->getTable(),
72+
$conditions
73+
);
74+
}
75+
76+
/**
77+
* Checks if price scope config option explicitly equal to global value.
78+
*
79+
* Such strict comparision is required to prevent price deleting when
80+
* price scope config option is null for some reason.
81+
*
82+
* @return bool
83+
*/
84+
private function isPriceScopeSetToGlobal()
85+
{
86+
$priceScope = $this->scopeConfig->getValue(Store::XML_PATH_PRICE_SCOPE);
87+
if ($priceScope === null) {
88+
return false;
7289
}
90+
91+
return (int)$priceScope === Store::PRICE_SCOPE_GLOBAL;
7392
}
7493
}

app/code/Magento/Catalog/Helper/Product/Configuration.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Catalog\Helper\Product;
77

88
use Magento\Framework\App\ObjectManager;
9+
use Magento\Framework\Escaper;
910
use Magento\Framework\Serialize\Serializer\Json;
1011
use Magento\Catalog\Helper\Product\Configuration\ConfigurationInterface;
1112
use Magento\Framework\App\Helper\AbstractHelper;
@@ -43,6 +44,11 @@ class Configuration extends AbstractHelper implements ConfigurationInterface
4344
*/
4445
private $serializer;
4546

47+
/**
48+
* @var Escaper
49+
*/
50+
private $escaper;
51+
4652
/**
4753
* @param \Magento\Framework\App\Helper\Context $context
4854
* @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory
@@ -55,12 +61,14 @@ public function __construct(
5561
\Magento\Catalog\Model\Product\OptionFactory $productOptionFactory,
5662
\Magento\Framework\Filter\FilterManager $filter,
5763
\Magento\Framework\Stdlib\StringUtils $string,
58-
Json $serializer = null
64+
Json $serializer = null,
65+
Escaper $escaper = null
5966
) {
6067
$this->_productOptionFactory = $productOptionFactory;
6168
$this->filter = $filter;
6269
$this->string = $string;
6370
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
71+
$this->escaper = $escaper ?: ObjectManager::getInstance()->get(Escaper::class);
6472
parent::__construct($context);
6573
}
6674

@@ -175,7 +183,7 @@ public function getFormattedOptionValue($optionValue, $params = null)
175183
if (isset($optionValue['option_id'])) {
176184
$optionInfo = $optionValue;
177185
if (isset($optionInfo['value'])) {
178-
$optionValue = $optionInfo['value'];
186+
$optionValue = $this->escaper->escapeHtml($optionInfo['value']);
179187
}
180188
} elseif (isset($optionValue['value'])) {
181189
$optionValue = $optionValue['value'];
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Catalog\Model\Config\Source;
10+
11+
use Magento\Catalog\Model\Product\Attribute\Source\Layout;
12+
13+
/**
14+
* Returns layout list for Web>Default Layouts>Default Product Layout/Default Category Layout
15+
*/
16+
class LayoutList implements \Magento\Framework\Option\ArrayInterface
17+
{
18+
/**
19+
* @var array
20+
*/
21+
private $options;
22+
23+
/**
24+
* @var \Magento\Catalog\Model\Product\Attribute\Source\Layout
25+
*/
26+
private $layoutSource;
27+
28+
/**
29+
* @param Layout $layoutSource
30+
*/
31+
public function __construct(
32+
Layout $layoutSource
33+
) {
34+
$this->layoutSource = $layoutSource;
35+
}
36+
37+
/**
38+
* To option array
39+
*
40+
* @return array
41+
*/
42+
public function toOptionArray()
43+
{
44+
if (!$this->options) {
45+
$this->options = $this->layoutSource->getAllOptions();
46+
}
47+
return $this->options;
48+
}
49+
}

0 commit comments

Comments
 (0)