Skip to content

Commit 069d5cd

Browse files
authored
Merge pull request #3463 from magento-epam/EPAM-PR-18
Fixed bugs: MAGETWO-91609 Problems with operator more/less in the "catalog Products List" widget MAGETWO-91650 Translation not working for product alerts MAGETWO-91649 #13513: Magento ignore store-level url_key of child category in URL rewrite process for global scope MAGETWO-91657 Advanced pricing the bulk discounts by percentage returns error when set MAGETWO-91733 Unusual behavior with the persistent shopping cart after the session is expired MAGETWO-91602 Visual Merchandiser incorrectly displays/sorts configurable product price in Tile view MAGETWO-91764 Frontend base url https results in admin too many redirects #8800 MAGETWO-91633 Grouped Products: Associated Products Can't Be Sorted Between Pages MAGETWO-91751 Apostrophe displays as code in the text field box MAGETWO-58210 [GitHub] Magento 2.0.7 Import Products sets default behaviour as append, need add_update #6193 MAGETWO-91711 Unable to delete downloadable product links if sample links are not deleted MAGETWO-91569 Special characters in CSV return error: General system exception happened MAGETWO-91684 Issue with Newsletter subscriptions MAGETWO-91750 Multiselect attribute values is not searchable under Quick Search when more than one value is selected MAGETWO-91636 Tooltip Position on Mobile out of view range
2 parents 4126ffc + 6e809ea commit 069d5cd

File tree

53 files changed

+1614
-308
lines changed

Some content is hidden

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

53 files changed

+1614
-308
lines changed

app/code/Magento/Backend/Model/AdminPathConfig.php

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,39 +48,37 @@ public function __construct(
4848
}
4949

5050
/**
51-
* {@inheritdoc}
52-
*
53-
* @param \Magento\Framework\App\RequestInterface $request
54-
* @return string
51+
* @inheritdoc
5552
*/
5653
public function getCurrentSecureUrl(\Magento\Framework\App\RequestInterface $request)
5754
{
5855
return $this->url->getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/');
5956
}
6057

6158
/**
62-
* {@inheritdoc}
63-
*
64-
* @param string $path
65-
* @return bool
59+
* @inheritdoc
6660
*/
6761
public function shouldBeSecure($path)
6862
{
69-
return parse_url(
70-
(string)$this->coreConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, 'default'),
71-
PHP_URL_SCHEME
72-
) === 'https'
73-
|| $this->backendConfig->isSetFlag(Store::XML_PATH_SECURE_IN_ADMINHTML)
74-
&& parse_url(
75-
(string)$this->coreConfig->getValue(Store::XML_PATH_SECURE_BASE_URL, 'default'),
76-
PHP_URL_SCHEME
77-
) === 'https';
63+
$baseUrl = (string)$this->coreConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, 'default');
64+
if (parse_url($baseUrl, PHP_URL_SCHEME) === 'https') {
65+
return true;
66+
}
67+
68+
if ($this->backendConfig->isSetFlag(Store::XML_PATH_SECURE_IN_ADMINHTML)) {
69+
if ($this->backendConfig->isSetFlag('admin/url/use_custom')) {
70+
$adminBaseUrl = (string)$this->coreConfig->getValue('admin/url/custom', 'default');
71+
} else {
72+
$adminBaseUrl = (string)$this->coreConfig->getValue(Store::XML_PATH_SECURE_BASE_URL, 'default');
73+
}
74+
return parse_url($adminBaseUrl, PHP_URL_SCHEME) === 'https';
75+
}
76+
77+
return false;
7878
}
7979

8080
/**
81-
* {@inheritdoc}
82-
*
83-
* @return string
81+
* @inheritdoc
8482
*/
8583
public function getDefaultPath()
8684
{

app/code/Magento/Backend/Test/Unit/Model/AdminPathConfigTest.php

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,35 @@ public function testGetCurrentSecureUrl()
7676
* @param $unsecureBaseUrl
7777
* @param $useSecureInAdmin
7878
* @param $secureBaseUrl
79+
* @param $useCustomUrl
80+
* @param $customUrl
7981
* @param $expected
8082
* @dataProvider shouldBeSecureDataProvider
8183
*/
82-
public function testShouldBeSecure($unsecureBaseUrl, $useSecureInAdmin, $secureBaseUrl, $expected)
83-
{
84-
$coreConfigValueMap = [
84+
public function testShouldBeSecure(
85+
$unsecureBaseUrl,
86+
$useSecureInAdmin,
87+
$secureBaseUrl,
88+
$useCustomUrl,
89+
$customUrl,
90+
$expected
91+
) {
92+
$coreConfigValueMap = $this->returnValueMap([
8593
[\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, 'default', null, $unsecureBaseUrl],
8694
[\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, 'default', null, $secureBaseUrl],
87-
];
88-
$this->coreConfig->expects($this->any())->method('getValue')->will($this->returnValueMap($coreConfigValueMap));
89-
$this->backendConfig->expects($this->any())->method('isSetFlag')->willReturn($useSecureInAdmin);
95+
['admin/url/custom', 'default', null, $customUrl],
96+
]);
97+
$backendConfigFlagsMap = $this->returnValueMap([
98+
[\Magento\Store\Model\Store::XML_PATH_SECURE_IN_ADMINHTML, $useSecureInAdmin],
99+
['admin/url/use_custom', $useCustomUrl],
100+
]);
101+
$this->coreConfig->expects($this->atLeast(1))->method('getValue')
102+
->will($coreConfigValueMap);
103+
$this->coreConfig->expects($this->atMost(2))->method('getValue')
104+
->will($coreConfigValueMap);
105+
106+
$this->backendConfig->expects($this->atMost(2))->method('isSetFlag')
107+
->will($backendConfigFlagsMap);
90108
$this->assertEquals($expected, $this->adminPathConfig->shouldBeSecure(''));
91109
}
92110

@@ -96,13 +114,13 @@ public function testShouldBeSecure($unsecureBaseUrl, $useSecureInAdmin, $secureB
96114
public function shouldBeSecureDataProvider()
97115
{
98116
return [
99-
['http://localhost/', false, 'default', false],
100-
['http://localhost/', true, 'default', false],
101-
['https://localhost/', false, 'default', true],
102-
['https://localhost/', true, 'default', true],
103-
['http://localhost/', false, 'https://localhost/', false],
104-
['http://localhost/', true, 'https://localhost/', true],
105-
['https://localhost/', true, 'https://localhost/', true],
117+
['http://localhost/', false, 'default', false, '', false],
118+
['http://localhost/', true, 'default', false, '', false],
119+
['https://localhost/', false, 'default', false, '', true],
120+
['https://localhost/', true, 'default', false, '', true],
121+
['http://localhost/', false, 'https://localhost/', false, '', false],
122+
['http://localhost/', true, 'https://localhost/', false, '', true],
123+
['https://localhost/', true, 'https://localhost/', false, '', true],
106124
];
107125
}
108126

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryActionGroup.xml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,30 @@
237237
</arguments>
238238
<amOnPage url="{{AdminCategoryPage.page}}" stepKey="amOnCategoryPage"/>
239239
<waitForPageLoad stepKey="waitForPageLoad1"/>
240-
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree(Category.Name)}}" stepKey="navigateToCreatedCategory" />
240+
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandAll"/>
241241
<waitForPageLoad stepKey="waitForPageLoad2"/>
242+
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree(Category.Name)}}" stepKey="navigateToCreatedCategory" />
242243
<waitForLoadingMaskToDisappear stepKey="waitForSpinner" />
243244
</actionGroup>
245+
246+
<actionGroup name="ChangeSeoUrlKey">
247+
<arguments>
248+
<argument name="value" type="string"/>
249+
</arguments>
250+
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection"/>
251+
<fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{value}}" stepKey="enterURLKey"/>
252+
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
253+
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessage"/>
254+
</actionGroup>
255+
256+
<actionGroup name="ChangeSeoUrlKeyForSubCategory">
257+
<arguments>
258+
<argument name="value" type="string"/>
259+
</arguments>
260+
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection"/>
261+
<uncheckOption selector="{{AdminCategorySEOSection.UrlKeyDefaultValueCheckbox}}" stepKey="uncheckDefaultValue"/>
262+
<fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{value}}" stepKey="enterURLKey"/>
263+
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
264+
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessage"/>
265+
</actionGroup>
244266
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,19 @@
6666
<click selector="{{StorefrontCategoryMainSection.modeListButton}}" stepKey="switchCategoryViewToListMode"/>
6767
<waitForElement selector="{{StorefrontCategoryMainSection.CategoryTitle}}" time="30" stepKey="waitForCategoryReload"/>
6868
</actionGroup>
69+
70+
<actionGroup name="GoToSubCategoryPage">
71+
<arguments>
72+
<argument name="parentCategory"/>
73+
<argument name="subCategory"/>
74+
<argument name="urlPath" type="string"/>
75+
</arguments>
76+
<moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName(parentCategory.name)}}" stepKey="moveMouseOnMainCategory"/>
77+
<waitForElementVisible selector="{{StorefrontHeaderSection.NavigationCategoryByName(subCategory.name)}}" stepKey="waitForSubCategoryVisible"/>
78+
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName(subCategory.name)}}" stepKey="goToCategory"/>
79+
<waitForPageLoad stepKey="waitForPageLoad"/>
80+
<seeInCurrentUrl url="{{urlPath}}.html" stepKey="checkUrl"/>
81+
<seeInTitle userInput="{{subCategory.name}}" stepKey="assertCategoryNameInTitle"/>
82+
<see userInput="{{subCategory.name}}" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="assertCategoryName"/>
83+
</actionGroup>
6984
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryContentSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
<element name="uploadImageFile" type="input" selector=".file-uploader-area>input"/>
1616
<element name="imageFileName" type="text" selector=".file-uploader-filename"/>
1717
<element name="removeImageButton" type="button" selector=".file-uploader-summary .action-remove"/>
18+
<element name="AddCMSBlock" type="select" selector="//*[@name='landing_page']"/>
1819
</section>
1920
</sections>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminCategoryDisplaySettingsSection">
12+
<element name="settingsHeader" type="button" selector="//*[contains(text(),'Display Settings')]" timeout="30"/>
13+
<element name="displayMode" type="button" selector="//*[@name='display_mode']"/>
14+
</section>
15+
</sections>

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/TierPrice.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(
4545
}
4646

4747
/**
48-
* {@inheritdoc}
48+
* @inheritdoc
4949
* @since 101.1.0
5050
*/
5151
public function modifyData(array $data)
@@ -54,8 +54,11 @@ public function modifyData(array $data)
5454
}
5555

5656
/**
57-
* {@inheritdoc}
57+
* Add tier price info to meta array.
58+
*
5859
* @since 101.1.0
60+
* @param array $meta
61+
* @return array
5962
*/
6063
public function modifyMeta(array $meta)
6164
{
@@ -150,8 +153,8 @@ private function getUpdatedTierPriceStructure(array $priceMeta)
150153
'dataType' => Price::NAME,
151154
'addbefore' => '%',
152155
'validation' => [
153-
'validate-number' => true,
154-
'less-than-equals-to' => 100
156+
'required-entry' => true,
157+
'validate-positive-percent-decimal' => true
155158
],
156159
'visible' => $firstOption
157160
&& $firstOption['value'] == ProductPriceOptionsInterface::VALUE_PERCENT,

app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,8 @@ public function prepareProductIndex($indexData, $productData, $storeId)
570570
}
571571
}
572572
foreach ($indexData as $entityId => $attributeData) {
573-
foreach ($attributeData as $attributeId => $attributeValue) {
574-
$value = $this->getAttributeValue($attributeId, $attributeValue, $storeId);
573+
foreach ($attributeData as $attributeId => $attributeValues) {
574+
$value = $this->getAttributeValue($attributeId, $attributeValues, $storeId);
575575
if (!empty($value)) {
576576
if (isset($index[$attributeId])) {
577577
$index[$attributeId][$entityId] = $value;
@@ -602,16 +602,16 @@ public function prepareProductIndex($indexData, $productData, $storeId)
602602
* Retrieve attribute source value for search
603603
*
604604
* @param int $attributeId
605-
* @param mixed $valueId
605+
* @param mixed $valueIds
606606
* @param int $storeId
607607
* @return string
608608
*/
609-
private function getAttributeValue($attributeId, $valueId, $storeId)
609+
private function getAttributeValue($attributeId, $valueIds, $storeId)
610610
{
611611
$attribute = $this->getSearchableAttribute($attributeId);
612-
$value = $this->engine->processAttributeValue($attribute, $valueId);
612+
$value = $this->engine->processAttributeValue($attribute, $valueIds);
613613
if (false !== $value) {
614-
$optionValue = $this->getAttributeOptionValue($attributeId, $valueId, $storeId);
614+
$optionValue = $this->getAttributeOptionValue($attributeId, $valueIds, $storeId);
615615
if (null === $optionValue) {
616616
$value = $this->filterAttributeValue($value);
617617
} else {
@@ -626,13 +626,15 @@ private function getAttributeValue($attributeId, $valueId, $storeId)
626626
* Get attribute option value
627627
*
628628
* @param int $attributeId
629-
* @param int $valueId
629+
* @param int|string $valueIds
630630
* @param int $storeId
631631
* @return null|string
632632
*/
633-
private function getAttributeOptionValue($attributeId, $valueId, $storeId)
633+
private function getAttributeOptionValue($attributeId, $valueIds, $storeId)
634634
{
635635
$optionKey = $attributeId . '-' . $storeId;
636+
$attributeValueIds = explode(',', $valueIds);
637+
$attributeOptionValue = '';
636638
if (!array_key_exists($optionKey, $this->attributeOptions)
637639
) {
638640
$attribute = $this->getSearchableAttribute($attributeId);
@@ -650,8 +652,12 @@ private function getAttributeOptionValue($attributeId, $valueId, $storeId)
650652
$this->attributeOptions[$optionKey] = null;
651653
}
652654
}
653-
654-
return $this->attributeOptions[$optionKey][$valueId] ?? null;
655+
foreach ($attributeValueIds as $attrValueId) {
656+
if (isset($this->attributeOptions[$optionKey][$attrValueId])) {
657+
$attributeOptionValue .= $this->attributeOptions[$optionKey][$attrValueId] . ' ';
658+
}
659+
}
660+
return empty($attributeOptionValue) ? null : trim($attributeOptionValue);
655661
}
656662

657663
/**

app/code/Magento/CatalogUrlRewrite/Model/Category/ChildrenUrlRewriteGenerator.php

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator;
1111
use Magento\UrlRewrite\Model\MergeDataProviderFactory;
1212
use Magento\Framework\App\ObjectManager;
13+
use Magento\Catalog\Api\CategoryRepositoryInterface;
1314

15+
/**
16+
* Model for generate url rewrites for children categories
17+
*/
1418
class ChildrenUrlRewriteGenerator
1519
{
1620
/**
@@ -28,22 +32,31 @@ class ChildrenUrlRewriteGenerator
2832
*/
2933
private $mergeDataProviderPrototype;
3034

35+
/**
36+
* @var CategoryRepositoryInterface
37+
*/
38+
private $categoryRepository;
39+
3140
/**
3241
* @param \Magento\CatalogUrlRewrite\Model\Category\ChildrenCategoriesProvider $childrenCategoriesProvider
3342
* @param \Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGeneratorFactory $categoryUrlRewriteGeneratorFactory
3443
* @param \Magento\UrlRewrite\Model\MergeDataProviderFactory|null $mergeDataProviderFactory
44+
* @param CategoryRepositoryInterface|null $categoryRepository
3545
*/
3646
public function __construct(
3747
ChildrenCategoriesProvider $childrenCategoriesProvider,
3848
CategoryUrlRewriteGeneratorFactory $categoryUrlRewriteGeneratorFactory,
39-
MergeDataProviderFactory $mergeDataProviderFactory = null
49+
MergeDataProviderFactory $mergeDataProviderFactory = null,
50+
CategoryRepositoryInterface $categoryRepository = null
4051
) {
4152
$this->childrenCategoriesProvider = $childrenCategoriesProvider;
4253
$this->categoryUrlRewriteGeneratorFactory = $categoryUrlRewriteGeneratorFactory;
4354
if (!isset($mergeDataProviderFactory)) {
4455
$mergeDataProviderFactory = ObjectManager::getInstance()->get(MergeDataProviderFactory::class);
4556
}
4657
$this->mergeDataProviderPrototype = $mergeDataProviderFactory->create();
58+
$this->categoryRepository = $categoryRepository
59+
?: ObjectManager::getInstance()->get(CategoryRepositoryInterface::class);
4760
}
4861

4962
/**
@@ -53,18 +66,23 @@ public function __construct(
5366
* @param \Magento\Catalog\Model\Category $category
5467
* @param int|null $rootCategoryId
5568
* @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[]
69+
* @throws \Magento\Framework\Exception\NoSuchEntityException
5670
*/
5771
public function generate($storeId, Category $category, $rootCategoryId = null)
5872
{
5973
$mergeDataProvider = clone $this->mergeDataProviderPrototype;
60-
foreach ($this->childrenCategoriesProvider->getChildren($category, true) as $childCategory) {
61-
$childCategory->setStoreId($storeId);
62-
$childCategory->setData('save_rewrites_history', $category->getData('save_rewrites_history'));
63-
/** @var CategoryUrlRewriteGenerator $categoryUrlRewriteGenerator */
64-
$categoryUrlRewriteGenerator = $this->categoryUrlRewriteGeneratorFactory->create();
65-
$mergeDataProvider->merge(
66-
$categoryUrlRewriteGenerator->generate($childCategory, false, $rootCategoryId)
67-
);
74+
$childrenIds = $this->childrenCategoriesProvider->getChildrenIds($category, true);
75+
if ($childrenIds) {
76+
foreach ($childrenIds as $childId) {
77+
/** @var Category $childCategory */
78+
$childCategory = $this->categoryRepository->get($childId, $storeId);
79+
$childCategory->setData('save_rewrites_history', $category->getData('save_rewrites_history'));
80+
/** @var CategoryUrlRewriteGenerator $categoryUrlRewriteGenerator */
81+
$categoryUrlRewriteGenerator = $this->categoryUrlRewriteGeneratorFactory->create();
82+
$mergeDataProvider->merge(
83+
$categoryUrlRewriteGenerator->generate($childCategory, false, $rootCategoryId)
84+
);
85+
}
6886
}
6987

7088
return $mergeDataProvider->getData();

0 commit comments

Comments
 (0)