Skip to content

Commit 698e398

Browse files
committed
Merge branch '2.4-develop' of github.com:magento-commerce/magento2ce into PWA-2565
2 parents 725d94a + 96faea7 commit 698e398

File tree

47 files changed

+1509
-258
lines changed

Some content is hidden

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

47 files changed

+1509
-258
lines changed

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

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

88
use Magento\Catalog\Api\ProductRepositoryInterface;
9-
use Magento\Catalog\Model\Category;
109

1110
/**
1211
* Product View block
@@ -183,7 +182,8 @@ public function getJsonConfig()
183182
foreach ($tierPricesList as $tierPrice) {
184183
$tierPriceData = [
185184
'qty' => $tierPrice['price_qty'],
186-
'price' => $tierPrice['website_price'],
185+
'price' => $tierPrice['price']->getValue(),
186+
'basePrice' => $tierPrice['price']->getBaseAmount()
187187
];
188188
$tierPrices[] = $tierPriceData;
189189
}

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\Catalog\Model;
88

99
use Magento\Catalog\Api\CategoryLinkManagementInterface;
10+
use Magento\Catalog\Api\Data\ProductAttributeInterface;
1011
use Magento\Catalog\Api\Data\ProductExtension;
1112
use Magento\Catalog\Api\Data\ProductInterface;
1213
use Magento\Catalog\Model\Attribute\ScopeOverriddenValue;
@@ -617,7 +618,10 @@ public function save(ProductInterface $product, $saveOptions = false)
617618
$product->getStoreId()
618619
)
619620
) {
620-
$product->setData($attributeCode);
621+
$product->setData(
622+
$attributeCode,
623+
$attributeCode === ProductAttributeInterface::CODE_SEO_FIELD_URL_KEY ? false : null
624+
);
621625
$hasDataChanged = true;
622626
}
623627
}

app/code/Magento/Catalog/Pricing/Price/TierPrice.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Magento\Framework\Pricing\PriceCurrencyInterface;
1919
use Magento\Framework\Pricing\PriceInfoInterface;
2020
use Magento\Customer\Model\Group\RetrieverInterface as CustomerGroupRetrieverInterface;
21-
use Magento\Tax\Model\Config;
2221

2322
/**
2423
* @api
@@ -176,13 +175,6 @@ public function getTierPriceList()
176175
function (&$priceData) {
177176
/* convert string value to float */
178177
$priceData['price_qty'] *= 1;
179-
$exclTaxPrice = $this->calculator->getAmount($priceData['price'], $this->product);
180-
if ($this->getConfigTaxDisplayType() === Config::DISPLAY_TYPE_EXCLUDING_TAX) {
181-
$priceData['excl_tax_price'] = $exclTaxPrice;
182-
}
183-
if ($this->getConfigTaxDisplayType() === Config::DISPLAY_TYPE_BOTH) {
184-
$priceData['incl_excl_tax_price'] = $exclTaxPrice;
185-
}
186178
$priceData['price'] = $this->applyAdjustment($priceData['price']);
187179
}
188180
);
@@ -191,16 +183,6 @@ function (&$priceData) {
191183
return $this->priceList;
192184
}
193185

194-
/**
195-
* Returns config tax display type
196-
*
197-
* @return int
198-
*/
199-
private function getConfigTaxDisplayType(): int
200-
{
201-
return (int) $this->scopeConfig->getValue(self::XML_PATH_TAX_DISPLAY_TYPE);
202-
}
203-
204186
/**
205187
* Filters tier prices
206188
*
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Setup\Patch\Data;
9+
10+
use Magento\Eav\Setup\EavSetup;
11+
use Magento\Eav\Setup\EavSetupFactory;
12+
use Magento\Framework\Setup\ModuleDataSetupInterface;
13+
use Magento\Framework\Setup\Patch\DataPatchInterface;
14+
use Magento\Framework\Setup\Patch\PatchVersionInterface;
15+
16+
/**
17+
* Class UpdateProductUrlKey for updating description and validation class
18+
*/
19+
class UpdateProductUrlKey implements DataPatchInterface, PatchVersionInterface
20+
{
21+
/**
22+
* @var ModuleDataSetupInterface
23+
*/
24+
private $moduleDataSetup;
25+
26+
/**
27+
* @var EavSetupFactory
28+
*/
29+
private $eavSetupFactory;
30+
31+
/**
32+
* PatchInitial constructor.
33+
* @param ModuleDataSetupInterface $moduleDataSetup
34+
* @param EavSetupFactory $eavSetupFactory
35+
*/
36+
public function __construct(
37+
ModuleDataSetupInterface $moduleDataSetup,
38+
EavSetupFactory $eavSetupFactory
39+
) {
40+
$this->moduleDataSetup = $moduleDataSetup;
41+
$this->eavSetupFactory = $eavSetupFactory;
42+
}
43+
44+
/**
45+
* @inheritdoc
46+
*/
47+
public function apply()
48+
{
49+
/** @var EavSetup $eavSetup */
50+
$eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);
51+
52+
$eavSetup->updateAttribute(
53+
\Magento\Catalog\Model\Product::ENTITY,
54+
'url_key',
55+
[
56+
'frontend_class' => 'validate-trailing-hyphen'
57+
]
58+
);
59+
return $this;
60+
}
61+
62+
/**
63+
* @inheritdoc
64+
*/
65+
public static function getDependencies()
66+
{
67+
return [
68+
UpdateProductAttributes::class,
69+
\Magento\CatalogUrlRewrite\Setup\Patch\Data\CreateUrlAttributes::class
70+
];
71+
}
72+
73+
/**
74+
* @inheritdoc
75+
*/
76+
public static function getVersion()
77+
{
78+
return '2.4.5';
79+
}
80+
81+
/**
82+
* @inheritdoc
83+
*/
84+
public function getAliases()
85+
{
86+
return [];
87+
}
88+
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
<scrollTo selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" x="0" y="-100" stepKey="scrollTo"/>
2121
<conditionalClick selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" dependentSelector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDependent}}" visible="false" stepKey="openDropDownIfClosedRelatedUpSellCrossSell"/>
2222
<click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddCrossSellProductsButton}}" stepKey="clickAddCrossSellButton"/>
23-
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
24-
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
25-
<fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/>
26-
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
23+
<conditionalClick selector="{{AdminProductCrossSellModalSection.Modal}} {{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductCrossSellModalSection.Modal}} {{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
24+
<click selector="{{AdminProductCrossSellModalSection.Modal}} {{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
25+
<fillField selector="{{AdminProductCrossSellModalSection.Modal}} {{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/>
26+
<click selector="{{AdminProductCrossSellModalSection.Modal}} {{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
2727
<waitForPageLoad stepKey="waitForPageToLoad"/>
28-
<click selector="{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectProduct"/>
28+
<click selector="{{AdminProductCrossSellModalSection.Modal}}{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectProduct"/>
2929
<click selector="{{AdminProductCrossSellModalSection.addSelectedProducts}}" stepKey="addRelatedProductSelected"/>
3030
<waitForPageLoad stepKey="waitForModalDisappear"/>
3131
</actionGroup>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminProductCrossSellModalSection">
12+
<element name="Modal" type="button" selector=".product_form_product_form_related_crosssell_modal"/>
1213
<element name="addSelectedProducts" type="button" selector=".product_form_product_form_related_crosssell_modal .action-primary"/>
1314
</section>
1415
</sections>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductRelatedUpSellCrossSellSection/AdminProductFormRelatedUpSellCrossSellSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@
2020
<element name="selectedRelatedProduct" type="block" selector="//span[@data-index='name']"/>
2121
<element name="removeRelatedProduct" type="button" selector="//span[text()='Related Products']//..//..//..//span[text()='{{productName}}']//..//..//..//..//..//button[@class='action-delete']" parameterized="true"/>
2222
<element name="selectedProductSku" type="text" selector="//div[@data-index='{{section}}']//span[@data-index='sku']" parameterized="true" timeout="30"/>
23+
<element name="removeCrossSellProduct" type="button" selector="//span[text()='Cross-Sell Products']//..//..//..//span[text()='{{productName}}']//..//..//..//..//..//button[@class='action-delete']" parameterized="true"/>
24+
<element name="removeUpsellProduct" type="button" selector="//span[text()='Up-Sell Products']//..//..//..//span[text()='{{productName}}']//..//..//..//..//..//button[@class='action-delete']" parameterized="true"/>
2325
</section>
2426
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateSimpleProductUrlKeyTest">
11+
<annotations>
12+
<features value="Catalog"/>
13+
<stories value="Validate URL key while creating Product via Admin"/>
14+
<title value="Admin user should be informed and restricted on allowed characters in URL Key"/>
15+
<description value="User was not being informed about the allowed characters in the UI for URL Key, but later the URL key was getting trimmed in backend"/>
16+
<severity value="AVERAGE"/>
17+
<testCaseId value="AC-2585"/>
18+
<useCaseId value="ACP2E-345"/>
19+
<group value="product"/>
20+
</annotations>
21+
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToCreateProduct"/>
24+
25+
<!--Trigger SEO drop down-->
26+
<scrollTo selector="{{AdminProductSEOSection.sectionHeader}}" x="0" y="-80" stepKey="scrollToSearchEngineOptimization"/>
27+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="selectSearchEngineOptimization"/>
28+
<waitForPageLoad stepKey="WaitForDropDownSEO"/>
29+
30+
<fillField stepKey="fillUrlKey1" selector="{{AdminProductFormBundleSection.urlKey}}" userInput="example-page-"/>
31+
<click stepKey="blurFromUrlKey1" selector="{{AdminProductSEOSection.metaTitleInput}}"/>
32+
<see selector="{{AdminProductFormSection.fieldError('url_key')}}" userInput="Trailing hyphens are not allowed." stepKey="seeLastHyphenErrorMessage"/>
33+
34+
<clearField selector="{{AdminProductFormBundleSection.urlKey}}" stepKey="clearFieldUrlKey2"/>
35+
<fillField stepKey="fillUrlKey2" selector="{{AdminProductFormBundleSection.urlKey}}" userInput="-Example-Page"/>
36+
<click stepKey="blurFromUrlKey2" selector="{{AdminProductSEOSection.metaTitleInput}}"/>
37+
<see selector="{{AdminProductFormSection.fieldError('url_key')}}" userInput="Trailing hyphens are not allowed." stepKey="seeFirstHyphenErrorMessage"/>
38+
39+
<clearField selector="{{AdminProductFormBundleSection.urlKey}}" stepKey="clearFieldUrlKey3"/>
40+
<click stepKey="blurFromUrlKey3" selector="{{AdminProductSEOSection.metaTitleInput}}"/>
41+
<fillField stepKey="fillUrlKey3" selector="{{AdminProductFormBundleSection.urlKey}}" userInput="example-page-test"/>
42+
<dontSee selector="{{AdminProductFormSection.fieldError('url_key')}}" userInput="Trailing hyphens are not allowed." stepKey="dontSeeErrorMessage"/>
43+
</test>
44+
</tests>

0 commit comments

Comments
 (0)