File tree 15 files changed +34
-31
lines changed
app/code/Magento/Catalog/Controller 15 files changed +34
-31
lines changed Original file line number Diff line number Diff line change @@ -44,12 +44,12 @@ public function execute()
44
44
$ this ->_eventManager ->dispatch ('catalog_controller_category_delete ' , ['category ' => $ category ]);
45
45
$ this ->_auth ->getAuthStorage ()->setDeletedPath ($ category ->getPath ());
46
46
$ this ->categoryRepository ->delete ($ category );
47
- $ this ->messageManager ->addSuccess (__ ('You deleted the category. ' ));
47
+ $ this ->messageManager ->addSuccessMessage (__ ('You deleted the category. ' ));
48
48
} catch (\Magento \Framework \Exception \LocalizedException $ e ) {
49
- $ this ->messageManager ->addError ($ e ->getMessage ());
49
+ $ this ->messageManager ->addErrorMessage ($ e ->getMessage ());
50
50
return $ resultRedirect ->setPath ('catalog/*/edit ' , ['_current ' => true ]);
51
51
} catch (\Exception $ e ) {
52
- $ this ->messageManager ->addError (__ ('Something went wrong while trying to delete the category. ' ));
52
+ $ this ->messageManager ->addErrorMessage (__ ('Something went wrong while trying to delete the category. ' ));
53
53
return $ resultRedirect ->setPath ('catalog/*/edit ' , ['_current ' => true ]);
54
54
}
55
55
}
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ protected function _validateProducts()
54
54
}
55
55
56
56
if ($ error ) {
57
- $ this ->messageManager ->addError ($ error );
57
+ $ this ->messageManager ->addErrorMessage ($ error );
58
58
}
59
59
60
60
return !$ error ;
Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ public function execute()
192
192
$ this ->_eventManager ->dispatch ('catalog_product_to_website_change ' , ['products ' => $ productIds ]);
193
193
}
194
194
195
- $ this ->messageManager ->addSuccess (
195
+ $ this ->messageManager ->addSuccessMessage (
196
196
__ ('A total of %1 record(s) were updated. ' , count ($ this ->attributeHelper ->getProductIds ()))
197
197
);
198
198
@@ -205,9 +205,9 @@ public function execute()
205
205
$ this ->_productPriceIndexerProcessor ->reindexList ($ this ->attributeHelper ->getProductIds ());
206
206
}
207
207
} catch (\Magento \Framework \Exception \LocalizedException $ e ) {
208
- $ this ->messageManager ->addError ($ e ->getMessage ());
208
+ $ this ->messageManager ->addErrorMessage ($ e ->getMessage ());
209
209
} catch (\Exception $ e ) {
210
- $ this ->messageManager ->addException (
210
+ $ this ->messageManager ->addExceptionMessage (
211
211
$ e ,
212
212
__ ('Something went wrong while updating the product(s) attributes. ' )
213
213
);
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ public function execute()
68
68
$ response ->setError (true );
69
69
$ response ->setMessage ($ e ->getMessage ());
70
70
} catch (\Exception $ e ) {
71
- $ this ->messageManager ->addException (
71
+ $ this ->messageManager ->addExceptionMessage (
72
72
$ e ,
73
73
__ ('Something went wrong while updating the product(s) attributes. ' )
74
74
);
Original file line number Diff line number Diff line change @@ -21,23 +21,23 @@ public function execute()
21
21
// entity type check
22
22
$ model ->load ($ id );
23
23
if ($ model ->getEntityTypeId () != $ this ->_entityTypeId ) {
24
- $ this ->messageManager ->addError (__ ('We can \'t delete the attribute. ' ));
24
+ $ this ->messageManager ->addErrorMessage (__ ('We can \'t delete the attribute. ' ));
25
25
return $ resultRedirect ->setPath ('catalog/*/ ' );
26
26
}
27
27
28
28
try {
29
29
$ model ->delete ();
30
- $ this ->messageManager ->addSuccess (__ ('You deleted the product attribute. ' ));
30
+ $ this ->messageManager ->addSuccessMessage (__ ('You deleted the product attribute. ' ));
31
31
return $ resultRedirect ->setPath ('catalog/*/ ' );
32
32
} catch (\Exception $ e ) {
33
- $ this ->messageManager ->addError ($ e ->getMessage ());
33
+ $ this ->messageManager ->addErrorMessage ($ e ->getMessage ());
34
34
return $ resultRedirect ->setPath (
35
35
'catalog/*/edit ' ,
36
36
['attribute_id ' => $ this ->getRequest ()->getParam ('attribute_id ' )]
37
37
);
38
38
}
39
39
}
40
- $ this ->messageManager ->addError (__ ('We can \'t find an attribute to delete. ' ));
40
+ $ this ->messageManager ->addErrorMessage (__ ('We can \'t find an attribute to delete. ' ));
41
41
return $ resultRedirect ->setPath ('catalog/*/ ' );
42
42
}
43
43
}
Original file line number Diff line number Diff line change @@ -25,14 +25,14 @@ public function execute()
25
25
$ model ->load ($ id );
26
26
27
27
if (!$ model ->getId ()) {
28
- $ this ->messageManager ->addError (__ ('This attribute no longer exists. ' ));
28
+ $ this ->messageManager ->addErrorMessage (__ ('This attribute no longer exists. ' ));
29
29
$ resultRedirect = $ this ->resultRedirectFactory ->create ();
30
30
return $ resultRedirect ->setPath ('catalog/*/ ' );
31
31
}
32
32
33
33
// entity type check
34
34
if ($ model ->getEntityTypeId () != $ this ->_entityTypeId ) {
35
- $ this ->messageManager ->addError (__ ('This attribute cannot be edited. ' ));
35
+ $ this ->messageManager ->addErrorMessage (__ ('This attribute cannot be edited. ' ));
36
36
$ resultRedirect = $ this ->resultRedirectFactory ->create ();
37
37
return $ resultRedirect ->setPath ('catalog/*/ ' );
38
38
}
Original file line number Diff line number Diff line change @@ -43,11 +43,11 @@ public function execute()
43
43
$ product = $ this ->productBuilder ->build ($ this ->getRequest ());
44
44
try {
45
45
$ newProduct = $ this ->productCopier ->copy ($ product );
46
- $ this ->messageManager ->addSuccess (__ ('You duplicated the product. ' ));
46
+ $ this ->messageManager ->addSuccessMessage (__ ('You duplicated the product. ' ));
47
47
$ resultRedirect ->setPath ('catalog/*/edit ' , ['_current ' => true , 'id ' => $ newProduct ->getId ()]);
48
48
} catch (\Exception $ e ) {
49
49
$ this ->_objectManager ->get (\Psr \Log \LoggerInterface::class)->critical ($ e );
50
- $ this ->messageManager ->addError ($ e ->getMessage ());
50
+ $ this ->messageManager ->addErrorMessage ($ e ->getMessage ());
51
51
$ resultRedirect ->setPath ('catalog/*/edit ' , ['_current ' => true ]);
52
52
}
53
53
return $ resultRedirect ;
Original file line number Diff line number Diff line change @@ -52,12 +52,12 @@ public function execute()
52
52
if (($ productId && !$ product ->getEntityId ())) {
53
53
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
54
54
$ resultRedirect = $ this ->resultRedirectFactory ->create ();
55
- $ this ->messageManager ->addError (__ ('This product doesn \'t exist. ' ));
55
+ $ this ->messageManager ->addErrorMessage (__ ('This product doesn \'t exist. ' ));
56
56
return $ resultRedirect ->setPath ('catalog/*/ ' );
57
57
} elseif ($ productId === 0 ) {
58
58
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
59
59
$ resultRedirect = $ this ->resultRedirectFactory ->create ();
60
- $ this ->messageManager ->addError (__ ('Invalid product id. Should be numeric value greater than 0 ' ));
60
+ $ this ->messageManager ->addErrorMessage (__ ('Invalid product id. Should be numeric value greater than 0 ' ));
61
61
return $ resultRedirect ->setPath ('catalog/*/ ' );
62
62
}
63
63
Original file line number Diff line number Diff line change @@ -29,12 +29,12 @@ public function execute()
29
29
);
30
30
31
31
if ($ model ->itemExists ()) {
32
- $ this ->messageManager ->addError (__ ('A group with the same name already exists. ' ));
32
+ $ this ->messageManager ->addErrorMessage (__ ('A group with the same name already exists. ' ));
33
33
} else {
34
34
try {
35
35
$ model ->save ();
36
36
} catch (\Exception $ e ) {
37
- $ this ->messageManager ->addError (__ ('Something went wrong while saving this group. ' ));
37
+ $ this ->messageManager ->addErrorMessage (__ ('Something went wrong while saving this group. ' ));
38
38
}
39
39
}
40
40
}
Original file line number Diff line number Diff line change @@ -36,10 +36,10 @@ public function execute()
36
36
$ resultRedirect = $ this ->resultRedirectFactory ->create ();
37
37
try {
38
38
$ this ->attributeSetRepository ->deleteById ($ setId );
39
- $ this ->messageManager ->addSuccess (__ ('The attribute set has been removed. ' ));
39
+ $ this ->messageManager ->addSuccessMessage (__ ('The attribute set has been removed. ' ));
40
40
$ resultRedirect ->setPath ('catalog/*/ ' );
41
41
} catch (\Exception $ e ) {
42
- $ this ->messageManager ->addError (__ ('We can \'t delete this set right now. ' ));
42
+ $ this ->messageManager ->addErrorMessage (__ ('We can \'t delete this set right now. ' ));
43
43
$ resultRedirect ->setUrl ($ this ->_redirect ->getRedirectUrl ($ this ->getUrl ('* ' )));
44
44
}
45
45
return $ resultRedirect ;
Original file line number Diff line number Diff line change @@ -127,15 +127,15 @@ public function execute()
127
127
$ model ->initFromSkeleton ($ this ->getRequest ()->getParam ('skeleton_set ' ));
128
128
}
129
129
$ model ->save ();
130
- $ this ->messageManager ->addSuccess (__ ('You saved the attribute set. ' ));
130
+ $ this ->messageManager ->addSuccessMessage (__ ('You saved the attribute set. ' ));
131
131
} catch (\Magento \Framework \Exception \AlreadyExistsException $ e ) {
132
132
$ this ->messageManager ->addErrorMessage ($ e ->getMessage ());
133
133
$ hasError = true ;
134
134
} catch (\Magento \Framework \Exception \LocalizedException $ e ) {
135
- $ this ->messageManager ->addError ($ e ->getMessage ());
135
+ $ this ->messageManager ->addErrorMessage ($ e ->getMessage ());
136
136
$ hasError = true ;
137
137
} catch (\Exception $ e ) {
138
- $ this ->messageManager ->addException ($ e , __ ('Something went wrong while saving the attribute set. ' ));
138
+ $ this ->messageManager ->addExceptionMessage ($ e , __ ('Something went wrong while saving the attribute set. ' ));
139
139
$ hasError = true ;
140
140
}
141
141
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ public function execute()
137
137
$ response ->setError (true );
138
138
$ response ->setMessages ([$ e ->getMessage ()]);
139
139
} catch (\Exception $ e ) {
140
- $ this ->messageManager ->addError ($ e ->getMessage ());
140
+ $ this ->messageManager ->addErrorMessage ($ e ->getMessage ());
141
141
$ layout = $ this ->layoutFactory ->create ();
142
142
$ layout ->initMessages ();
143
143
$ response ->setError (true );
Original file line number Diff line number Diff line change @@ -30,12 +30,12 @@ public function execute()
30
30
31
31
try {
32
32
$ items ->clear ();
33
- $ this ->messageManager ->addSuccess (__ ('You cleared the comparison list. ' ));
33
+ $ this ->messageManager ->addSuccessMessage (__ ('You cleared the comparison list. ' ));
34
34
$ this ->_objectManager ->get (\Magento \Catalog \Helper \Product \Compare::class)->calculate ();
35
35
} catch (\Magento \Framework \Exception \LocalizedException $ e ) {
36
- $ this ->messageManager ->addError ($ e ->getMessage ());
36
+ $ this ->messageManager ->addErrorMessage ($ e ->getMessage ());
37
37
} catch (\Exception $ e ) {
38
- $ this ->messageManager ->addException ($ e , __ ('Something went wrong clearing the comparison list. ' ));
38
+ $ this ->messageManager ->addExceptionMessage ($ e , __ ('Something went wrong clearing the comparison list. ' ));
39
39
}
40
40
41
41
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ public function execute()
44
44
$ item ->delete ();
45
45
$ productName = $ this ->_objectManager ->get (\Magento \Framework \Escaper::class)
46
46
->escapeHtml ($ product ->getName ());
47
- $ this ->messageManager ->addSuccess (
47
+ $ this ->messageManager ->addSuccessMessage (
48
48
__ ('You removed product %1 from the comparison list. ' , $ productName )
49
49
);
50
50
$ this ->_eventManager ->dispatch (
Original file line number Diff line number Diff line change @@ -78,13 +78,16 @@ public function execute()
78
78
79
79
if ($ this ->getRequest ()->isPost () && $ this ->getRequest ()->getParam (self ::PARAM_NAME_URL_ENCODED )) {
80
80
$ product = $ this ->_initProduct ();
81
+
81
82
if (!$ product ) {
82
83
return $ this ->noProductRedirect ();
83
84
}
85
+
84
86
if ($ specifyOptions ) {
85
87
$ notice = $ product ->getTypeInstance ()->getSpecifyOptionMessage ();
86
- $ this ->messageManager ->addNotice ($ notice );
88
+ $ this ->messageManager ->addNoticeMessage ($ notice );
87
89
}
90
+
88
91
if ($ this ->getRequest ()->isAjax ()) {
89
92
$ this ->getResponse ()->representJson (
90
93
$ this ->_objectManager ->get (\Magento \Framework \Json \Helper \Data::class)->jsonEncode ([
You can’t perform that action at this time.
0 commit comments