Skip to content

Commit 30fbdcb

Browse files
committed
ACP2E-2770: Double-byte characters (special characters) in Product Name field blocks product creation in backend
1 parent 921945a commit 30fbdcb

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
*/
1919
class Product extends \Magento\Framework\Url\Helper\Data
2020
{
21-
const XML_PATH_PRODUCT_URL_USE_CATEGORY = 'catalog/seo/product_use_categories';
21+
public const XML_PATH_PRODUCT_URL_USE_CATEGORY = 'catalog/seo/product_use_categories';
2222

23-
const XML_PATH_USE_PRODUCT_CANONICAL_TAG = 'catalog/seo/product_canonical_tag';
23+
public const XML_PATH_USE_PRODUCT_CANONICAL_TAG = 'catalog/seo/product_canonical_tag';
2424

25-
const XML_PATH_AUTO_GENERATE_MASK = 'catalog/fields_masks';
25+
public const XML_PATH_AUTO_GENERATE_MASK = 'catalog/fields_masks';
26+
27+
public const XML_PATH_APPLY_TRANSLITERATION_TO_URL = 'catalog/seo/product_url_transliteration';
2628

2729
/**
2830
* Flag that shows if Magento has to check product to be saleable (enabled and/or inStock)

app/code/Magento/Catalog/Model/Product/Url.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,14 @@ public function getProductUrl($product, $useSid = null)
114114
*/
115115
public function formatUrlKey($str)
116116
{
117-
return $this->filter->translitUrl($str);
117+
if ($this->scopeConfig->getValue(
118+
\Magento\Catalog\Helper\Product::XML_PATH_APPLY_TRANSLITERATION_TO_URL,
119+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
120+
)) {
121+
return $this->filter->translitUrl($str);
122+
}
123+
124+
return $str;
118125
}
119126

120127
/**

app/code/Magento/Catalog/etc/adminhtml/system.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@
127127
<label>Use Canonical Link Meta Tag For Products</label>
128128
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
129129
</field>
130+
<field id="product_url_transliteration" translate="label" type="select" sortOrder="9" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
131+
<label>Apply transliteration for product URL</label>
132+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
133+
</field>
130134
</group>
131135
<group id="price" translate="label" type="text" sortOrder="400" showInDefault="1">
132136
<label>Price</label>

app/code/Magento/Catalog/etc/config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<title_separator>-</title_separator>
4949
<category_canonical_tag>0</category_canonical_tag>
5050
<product_canonical_tag>0</product_canonical_tag>
51+
<product_url_transliteration>1</product_url_transliteration>
5152
</seo>
5253
<custom_options>
5354
<date_fields_order>m,d,y</date_fields_order>

app/code/Magento/Catalog/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ Comma-separated.,Comma-separated.
665665
"Page Title Separator","Page Title Separator"
666666
"Use Canonical Link Meta Tag For Categories","Use Canonical Link Meta Tag For Categories"
667667
"Use Canonical Link Meta Tag For Products","Use Canonical Link Meta Tag For Products"
668+
"Apply transliteration for product URL","Apply transliteration for product URL"
668669
"Catalog Price Scope","Catalog Price Scope"
669670
"This defines the base currency scope (""Currency Setup"" > ""Currency Options"" > ""Base Currency"").","This defines the base currency scope (""Currency Setup"" > ""Currency Options"" > ""Base Currency"")."
670671
"Category Top Navigation","Category Top Navigation"

0 commit comments

Comments
 (0)