File tree Expand file tree Collapse file tree 4 files changed +35
-2
lines changed
Controller/Product/Compare
view/frontend/templates/messages
dev/tests/integration/testsuite/Magento/Catalog/Controller/Product Expand file tree Collapse file tree 4 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,14 @@ public function execute()
3636 $ productName = $ this ->_objectManager ->get (
3737 \Magento \Framework \Escaper::class
3838 )->escapeHtml ($ product ->getName ());
39- $ this ->messageManager ->addSuccess (__ ('You added product %1 to the comparison list. ' , $ productName ));
39+ $ this ->messageManager ->addComplexSuccessMessage (
40+ 'addCompareAddSuccessMessage ' ,
41+ [
42+ 'product_name ' => $ productName ,
43+ 'compare_list_url ' => $ this ->_url ->getUrl ('catalog/product_compare ' )
44+ ]
45+ );
46+
4047 $ this ->_eventManager ->dispatch ('catalog_product_compare_add_product ' , ['product ' => $ product ]);
4148 }
4249
Original file line number Diff line number Diff line change 7979 <argument name =" typeId" xsi : type =" string" >recently_compared_product</argument >
8080 </arguments >
8181 </virtualType >
82+ <type name =" Magento\Framework\View\Element\Message\MessageConfigurationsPool" >
83+ <arguments >
84+ <argument name =" configurationsMap" xsi : type =" array" >
85+ <item name =" addCompareAddSuccessMessage" xsi : type =" array" >
86+ <item name =" renderer" xsi : type =" const" >\Magento\Framework\View\Element\Message\Renderer\BlockRenderer::CODE</item >
87+ <item name =" data" xsi : type =" array" >
88+ <item name =" template" xsi : type =" string" >Magento_Catalog::messages/addCompareAddSuccessMessage.phtml</item >
89+ </item >
90+ </item >
91+ </argument >
92+ </arguments >
93+ </type >
8294</config >
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright © Magento, Inc. All rights reserved.
4+ * See COPYING.txt for license details.
5+ */
6+ // @codingStandardsIgnoreFile
7+ /** @var \Magento\Framework\View\Element\Template $block */
8+ ?>
9+ <?= $ block ->escapeHtml (__ (
10+ 'You added product %1 to the <a href="%2">comparison list</a>. ' ,
11+ $ block ->getData ('product_name ' ),
12+ $ block ->getData ('compare_list_url ' )),
13+ ['a ' ]
14+ );
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public function testAddAction()
4747 );
4848
4949 $ this ->assertSessionMessages (
50- $ this ->equalTo (['You added product Simple Product 1 Name to the comparison list. ' ]),
50+ $ this ->equalTo (['You added product Simple Product 1 Name to the <a href="http://localhost/index.php/catalog/product_compare/"> comparison list</a> . ' ]),
5151 MessageInterface::TYPE_SUCCESS
5252 );
5353
You can’t perform that action at this time.
0 commit comments