Skip to content

Commit a14c4a8

Browse files
andimovslopukhov
authored andcommitted
MC-4244: Skip URL rewrites multiplication
-- MC-16258: [final] Pop-up message in case of changing option to NO
1 parent 855eaf0 commit a14c4a8

File tree

2 files changed

+25
-19
lines changed
  • app/code/Magento
    • CatalogUrlRewrite/view/adminhtml/web/js/config
    • Config/view/adminhtml/templates/system/config

2 files changed

+25
-19
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
require([
2+
"jquery",
3+
"Magento_Ui/js/modal/confirm",
4+
"mage/translate",
5+
], function(jQuery, confirmation, $t) {
6+
//confirmation for removing category/product URL rewrites
7+
jQuery('select.generate_category_product_rewrites').on('change', function (event) {
8+
if (this.value == 0) {
9+
confirmation({
10+
title: $t('Turn off "category/products" URL rewrites?'),
11+
content: $t('Turning off automatic generation of "category/products" URL rewrites will result in permanent removal of all the currently existing “category/product” type URL rewrites without an ability to restore them back. ' +
12+
'This may potentially cause unresolved “category/product” type URL conflicts which you have to resolve by updating URL key manually.'),
13+
actions: {
14+
cancel: function () {
15+
jQuery('select.generate_category_product_rewrites').val(1);
16+
return false;
17+
},
18+
}
19+
})
20+
}
21+
});
22+
});

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

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ require([
3838
"prototype",
3939
"mage/adminhtml/form",
4040
"domReady!",
41-
"jquery/ui"
42-
], function(jQuery, registry, confirmation, $t){
41+
"jquery/ui",
42+
"Magento_CatalogUrlRewrite/js/config/confirm"
43+
], function(jQuery, registry){
4344

4445
var adminSystemConfig = {
4546
navigateToElement: function (searchRequest) {
@@ -387,22 +388,5 @@ require([
387388

388389
adminSystemConfig.navigateToElement(<?php echo /* @noEscape */ $block->getConfigSearchParamsJson(); ?>);
389390

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

0 commit comments

Comments
 (0)