Skip to content

Commit 4548bab

Browse files
andimovduhon
authored andcommitted
MC-16258: [final] Pop-up message in case of changing option to NO
1 parent d13dc02 commit 4548bab

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@
2929
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
3030
</field>
3131
<field id="generate_rewrites_on_save" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="0" showInStore="0">
32-
<label>Generate URL Rewrites for Products on Category Save</label>
32+
<label>Generate URL Rewrites for Products in Categories</label>
3333
<backend_model>Magento\CatalogUrlRewrite\Model\TableCleaner</backend_model>
3434
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
3535
<comment>
36-
<![CDATA[<strong style="color:red">Warning!</strong> If you will set option to No autogenerated urls will be deleted, please see documentation]]>
36+
<![CDATA[<strong style="color:red">Warning!</strong> Turning this option off will result in permanent removal of category/product URL rewrites without an ability to restore them back.]]>
3737
</comment>
38+
<frontend_class>generate_rewrites_on_save</frontend_class>
3839
</field>
3940
</group>
4041
</section>

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
"Product URL Suffix","Product URL Suffix"
66
"Use Categories Path for Product URLs","Use Categories Path for Product URLs"
77
"Create Permanent Redirect for URLs if URL Key Changed","Create Permanent Redirect for URLs if URL Key Changed"
8-
"Generate URL Rewrites for Products on Category Save","Generate URL Rewrites for Products on Category Save"
8+
"Generate URL Rewrites for Products in Categories","Generate URL Rewrites for Products in Categories"
9+
"Turn off automatic generation of products with categories path URL rewrites?","Turn off automatic generation of products with categories path URL rewrites?"
10+
"Turning off automatic generation of products with categories path URL rewrites will result in permanent removal of all the currently existing “category/product” type URL rewrites without an ability to restore them back. This may potentially cause unresolved “category/product” type URL conflicts which you have to resolve by creating a URL rewrite manually.","Turning off automatic generation of products with categories path URL rewrites will result in permanent removal of all the currently existing “category/product” type URL rewrites without an ability to restore them back. This may potentially cause unresolved “category/product” type URL conflicts which you have to resolve by creating a URL rewrite manually."

app/code/Magento/Config/view/adminhtml/templates/system/config/edit.phtml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@
3232
require([
3333
"jquery",
3434
"uiRegistry",
35+
"Magento_Ui/js/modal/confirm",
36+
"mage/translate",
3537
"mage/mage",
3638
"prototype",
3739
"mage/adminhtml/form",
3840
"domReady!",
3941
"jquery/ui"
40-
], function(jQuery, registry){
42+
], function(jQuery, registry, confirmation, $t){
4143

4244
var adminSystemConfig = {
4345
navigateToElement: function (searchRequest) {
@@ -384,5 +386,25 @@ require([
384386
registry.set('adminSystemConfig', adminSystemConfig);
385387

386388
adminSystemConfig.navigateToElement(<?php echo /* @noEscape */ $block->getConfigSearchParamsJson(); ?>);
389+
390+
//confirmation for removing category/product URL rewrites
391+
jQuery('select.generate_rewrites_on_save').on('change', function(event){
392+
if (this.value == 0) {
393+
confirmation({
394+
title: $t('Turn off automatic generation of products with categories path URL rewrites?'),
395+
content: $t('Turning off automatic generation of products with categories path URL rewrites will ' +
396+
'result in permanent removal of all the currently existing “category/product” type URL rewrites ' +
397+
'without an ability to restore them back. This may potentially cause unresolved “category/product”' +
398+
' type URL conflicts which you have to resolve by creating a URL rewrite manually.'),
399+
actions: {
400+
cancel: function () {
401+
jQuery('select.generate_rewrites_on_save').val(1);
402+
return false;
403+
},
404+
}
405+
})
406+
}
407+
});
408+
387409
});
388410
</script>

0 commit comments

Comments
 (0)