I am trying to add link to the success message in Magento 2
I am trying to add a product details link in the success message after a user clicks the add to cart button. So I create a variable in my controller but and want to send cart link. Here is file location vendor/magento/module-checkout/Controller/Cart
Here is some code from a similar question which was never solved. Can I include this with
if (!$this->_checkoutSession->getNoCartRedirect(true)) {
if (!$this->cart->getQuote()->getHasError()) {
$cartLink = '<a href="'. $this->_url->getUrl('checkout/cart') .'">View Cart/Checkout</a>';
$message = __('You added %1 to your shopping cart.', $product->getName()) .
'<a href="'.$cartLink .'">'. __('View Cart/Checkout') .'</a>';
$this->messageManager->addSuccessMessage($message);
}
magento2 addtocart
add a comment |
I am trying to add a product details link in the success message after a user clicks the add to cart button. So I create a variable in my controller but and want to send cart link. Here is file location vendor/magento/module-checkout/Controller/Cart
Here is some code from a similar question which was never solved. Can I include this with
if (!$this->_checkoutSession->getNoCartRedirect(true)) {
if (!$this->cart->getQuote()->getHasError()) {
$cartLink = '<a href="'. $this->_url->getUrl('checkout/cart') .'">View Cart/Checkout</a>';
$message = __('You added %1 to your shopping cart.', $product->getName()) .
'<a href="'.$cartLink .'">'. __('View Cart/Checkout') .'</a>';
$this->messageManager->addSuccessMessage($message);
}
magento2 addtocart
Should check my updated answer.
– Khoa TruongDinh
May 23 '17 at 12:48
add a comment |
I am trying to add a product details link in the success message after a user clicks the add to cart button. So I create a variable in my controller but and want to send cart link. Here is file location vendor/magento/module-checkout/Controller/Cart
Here is some code from a similar question which was never solved. Can I include this with
if (!$this->_checkoutSession->getNoCartRedirect(true)) {
if (!$this->cart->getQuote()->getHasError()) {
$cartLink = '<a href="'. $this->_url->getUrl('checkout/cart') .'">View Cart/Checkout</a>';
$message = __('You added %1 to your shopping cart.', $product->getName()) .
'<a href="'.$cartLink .'">'. __('View Cart/Checkout') .'</a>';
$this->messageManager->addSuccessMessage($message);
}
magento2 addtocart
I am trying to add a product details link in the success message after a user clicks the add to cart button. So I create a variable in my controller but and want to send cart link. Here is file location vendor/magento/module-checkout/Controller/Cart
Here is some code from a similar question which was never solved. Can I include this with
if (!$this->_checkoutSession->getNoCartRedirect(true)) {
if (!$this->cart->getQuote()->getHasError()) {
$cartLink = '<a href="'. $this->_url->getUrl('checkout/cart') .'">View Cart/Checkout</a>';
$message = __('You added %1 to your shopping cart.', $product->getName()) .
'<a href="'.$cartLink .'">'. __('View Cart/Checkout') .'</a>';
$this->messageManager->addSuccessMessage($message);
}
magento2 addtocart
magento2 addtocart
edited May 11 '17 at 18:00
asked May 10 '17 at 11:49
sanjay
107112
107112
Should check my updated answer.
– Khoa TruongDinh
May 23 '17 at 12:48
add a comment |
Should check my updated answer.
– Khoa TruongDinh
May 23 '17 at 12:48
Should check my updated answer.
– Khoa TruongDinh
May 23 '17 at 12:48
Should check my updated answer.
– Khoa TruongDinh
May 23 '17 at 12:48
add a comment |
5 Answers
5
active
oldest
votes
You can try with:
$message = __('You added %1 to your shopping cart.', $product->getName()) .
'<a href="'. $customLinkHere .'">'. __('View Cart/Checkout') .'</a>';
See an sample here: MagentoAdminNotificationBlockGridRendererActions::render()
[EDIT]
Change addSuccessMessage()
to addSuccess()
[EDIT] 13 May 2018
We should try with addComplexSuccessMessage()
app/code/Vendor/Module/etc/frontend/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCheckoutControllerCartAdd"
type="VendorModuleControllerRewriteCartAdd" />
<type name="MagentoFrameworkViewElementMessageMessageConfigurationsPool">
<arguments>
<argument name="configurationsMap" xsi:type="array">
<item name="addCartSuccessMessage" xsi:type="array">
<item name="renderer" xsi:type="const">MagentoFrameworkViewElementMessageRendererBlockRenderer::CODE</item>
<item name="data" xsi:type="array">
<item name="template" xsi:type="string">Vendor_Module::messages/addCartSuccessMessage.phtml</item>
</item>
</item>
</argument>
</arguments>
</type>
</config>
Vendor/Module/Controller/Rewrite/Cart/Add.php
<?php
namespace VendorModuleControllerRewriteCart;
class Add extends MagentoCheckoutControllerCartAdd
{
public function execute()
{
if (!$this->_formKeyValidator->validate($this->getRequest())) {
return $this->resultRedirectFactory->create()->setPath('*/*/');
}
$params = $this->getRequest()->getParams();
try {
if (isset($params['qty'])) {
$filter = new Zend_Filter_LocalizedToNormalized(
['locale' => $this->_objectManager->get(
MagentoFrameworkLocaleResolverInterface::class
)->getLocale()]
);
$params['qty'] = $filter->filter($params['qty']);
}
$product = $this->_initProduct();
$related = $this->getRequest()->getParam('related_product');
/**
* Check product availability
*/
if (!$product) {
return $this->goBack();
}
$this->cart->addProduct($product, $params);
if (!empty($related)) {
$this->cart->addProductsByIds(explode(',', $related));
}
$this->cart->save();
/**
* @todo remove wishlist observer MagentoWishlistObserverAddToCart
*/
$this->_eventManager->dispatch(
'checkout_cart_add_product_complete',
['product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse()]
);
if (!$this->_checkoutSession->getNoCartRedirect(true)) {
if (!$this->cart->getQuote()->getHasError()) {
if ($this->shouldRedirectToCart()) {
$message = __(
'You added %1 to your shopping cart.',
$product->getName()
);
$this->messageManager->addSuccessMessage($message);
} else {
$this->messageManager->addComplexSuccessMessage(
'addCartSuccessMessage',
[
'product_name' => $product->getName(),
'cart_url' => $this->getCartUrl(),
]
);
}
}
return $this->goBack(null, $product);
}
} catch (MagentoFrameworkExceptionLocalizedException $e) {
if ($this->_checkoutSession->getUseNotice(true)) {
$this->messageManager->addNotice(
$this->_objectManager->get(MagentoFrameworkEscaper::class)->escapeHtml($e->getMessage())
);
} else {
$messages = array_unique(explode("n", $e->getMessage()));
foreach ($messages as $message) {
$this->messageManager->addError(
$this->_objectManager->get(MagentoFrameworkEscaper::class)->escapeHtml($message)
);
}
}
$url = $this->_checkoutSession->getRedirectUrl(true);
if (!$url) {
$url = $this->_redirect->getRedirectUrl($this->getCartUrl());
}
return $this->goBack($url);
} catch (Exception $e) {
$this->messageManager->addException($e, __('We can't add this item to your shopping cart right now.'));
$this->_objectManager->get(PsrLogLoggerInterface::class)->critical($e);
return $this->goBack();
}
}
/**
* @return string
*/
private function getCartUrl()
{
return $this->_url->getUrl('checkout/cart', ['_secure' => true]);
}
/**
* @return bool
*/
private function shouldRedirectToCart()
{
return $this->_scopeConfig->isSetFlag(
'checkout/cart/redirect_to_cart',
MagentoStoreModelScopeInterface::SCOPE_STORE
);
}
}
Vendor/Module/view/frontend/templates/messages/addCartSuccessMessage.phtml
<?php
// @codingStandardsIgnoreFile
/** @var MagentoFrameworkViewElementTemplate $block */
?>
<?= $block->escapeHtml(__(
'You added %1 to your <a href="%2">shopping cart</a>.',
$block->getData('product_name'),
$block->getData('cart_url')
), ['a']);
We can see this commit: https://github.com/magento/magento2/pull/13904/files#diff-1
Khoa TruongDinh@ when I use this then I am getting error message
– sanjay
May 11 '17 at 17:48
Khoa through showing error @ Undefined variable: customLinkHere in
– sanjay
May 11 '17 at 17:50
Khoa through @ please see the updated question
– sanjay
May 11 '17 at 18:01
@sanjay See my update answer: ChangeaddSuccessMessage()
toaddSuccess()
.
– Khoa TruongDinh
May 12 '17 at 11:17
OMG!! It works!!
– zhartaunik
Jun 30 '18 at 13:02
add a comment |
You need to override this file to achieve this.
vendor/magento/module-checkout/Controller/Cart/Add.php
You can override by creating a custom module at
app/code/Vendor/ModuleName/Controller/Cart/Add.php
and change this part of the code:
if (!$this->cart->getQuote()->getHasError()) {
$message = __(
'You added %1 to your shopping cart.',
$product->getName()
);
$this->messageManager->addSuccessMessage($message);
}
Any other way ,
– sanjay
May 11 '17 at 10:07
sejal @@ please see my updated question any idea , to print chekout url
– sanjay
May 11 '17 at 11:57
@sanjay which link you wish to add ? Product detail link or cart link?
– Sejal Shah
May 12 '17 at 5:57
add a comment |
I'm not sure why, but in my case, by calling the obsolete method without "Message" solves the issue with the links.
Instead of using addNoticeMessage
, I changed to addNotice
, and the links were displayed.
In my case:
$noticeMsg = __('You must be <a href="%1">logged in</a> or <a href="%2">registered</a> to purchase these products.',
$this->_storeManager->getStore()->getUrl('customer/account/login'),
$this->_storeManager->getStore()->getUrl('customer/account/create')
);
$this->_messageManager->addNotice($noticeMsg);
add a comment |
That will a wrong way, you just want to add text to the message after product is added to cart thus you have to modify at the place from where text is coming:-
i.e, vendormagentomodule-checkoutControllerCart.php
On line 121
$message = __(
'You added %1 to your shopping cart.',
$product->getName()
);
Modify above message as you want.
I have include this line or I have to replace this with any script
– sanjay
May 10 '17 at 13:07
You need to override the controller and replace the text, either by replacing the text or replacing $product->getName() with content you need
– arushi
May 10 '17 at 13:14
why we can not send a link with a varible pass in success function , see this updated question
– sanjay
May 11 '17 at 11:21
arushi Please see the error , I just updated question
– sanjay
May 11 '17 at 18:00
You need to review magento.stackexchange.com/questions/134702/… link for this, Here it has explained the same think how to add a link with success message.
– arushi
May 12 '17 at 6:31
add a comment |
Try the below code in your controller its work for me
protected $_urlInterface;
public function __construct(
MagentoFrameworkUrlInterface $urlInterface
) {
$this->_urlInterface = $urlInterface;
parent::__construct($context);
}
public function execute() {
$url = $this->_urlInterface->getUrl('checkout/cart', ['_secure' => true]);
try{
$message = __('You added '.$_product->getName().'to your <a href="'.$url.'">shopping cart.</a>');
$this->messageManager->addSuccess($message);
} catch (Exception $e) {
$message = __("We don't have as many %1 as you requested.",$_product->getName());
$this->messageManager->addErrorMessage($message);
}
}
The result should be like this See The Result Here
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f173819%2fi-am-trying-to-add-link-to-the-success-message-in-magento-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can try with:
$message = __('You added %1 to your shopping cart.', $product->getName()) .
'<a href="'. $customLinkHere .'">'. __('View Cart/Checkout') .'</a>';
See an sample here: MagentoAdminNotificationBlockGridRendererActions::render()
[EDIT]
Change addSuccessMessage()
to addSuccess()
[EDIT] 13 May 2018
We should try with addComplexSuccessMessage()
app/code/Vendor/Module/etc/frontend/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCheckoutControllerCartAdd"
type="VendorModuleControllerRewriteCartAdd" />
<type name="MagentoFrameworkViewElementMessageMessageConfigurationsPool">
<arguments>
<argument name="configurationsMap" xsi:type="array">
<item name="addCartSuccessMessage" xsi:type="array">
<item name="renderer" xsi:type="const">MagentoFrameworkViewElementMessageRendererBlockRenderer::CODE</item>
<item name="data" xsi:type="array">
<item name="template" xsi:type="string">Vendor_Module::messages/addCartSuccessMessage.phtml</item>
</item>
</item>
</argument>
</arguments>
</type>
</config>
Vendor/Module/Controller/Rewrite/Cart/Add.php
<?php
namespace VendorModuleControllerRewriteCart;
class Add extends MagentoCheckoutControllerCartAdd
{
public function execute()
{
if (!$this->_formKeyValidator->validate($this->getRequest())) {
return $this->resultRedirectFactory->create()->setPath('*/*/');
}
$params = $this->getRequest()->getParams();
try {
if (isset($params['qty'])) {
$filter = new Zend_Filter_LocalizedToNormalized(
['locale' => $this->_objectManager->get(
MagentoFrameworkLocaleResolverInterface::class
)->getLocale()]
);
$params['qty'] = $filter->filter($params['qty']);
}
$product = $this->_initProduct();
$related = $this->getRequest()->getParam('related_product');
/**
* Check product availability
*/
if (!$product) {
return $this->goBack();
}
$this->cart->addProduct($product, $params);
if (!empty($related)) {
$this->cart->addProductsByIds(explode(',', $related));
}
$this->cart->save();
/**
* @todo remove wishlist observer MagentoWishlistObserverAddToCart
*/
$this->_eventManager->dispatch(
'checkout_cart_add_product_complete',
['product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse()]
);
if (!$this->_checkoutSession->getNoCartRedirect(true)) {
if (!$this->cart->getQuote()->getHasError()) {
if ($this->shouldRedirectToCart()) {
$message = __(
'You added %1 to your shopping cart.',
$product->getName()
);
$this->messageManager->addSuccessMessage($message);
} else {
$this->messageManager->addComplexSuccessMessage(
'addCartSuccessMessage',
[
'product_name' => $product->getName(),
'cart_url' => $this->getCartUrl(),
]
);
}
}
return $this->goBack(null, $product);
}
} catch (MagentoFrameworkExceptionLocalizedException $e) {
if ($this->_checkoutSession->getUseNotice(true)) {
$this->messageManager->addNotice(
$this->_objectManager->get(MagentoFrameworkEscaper::class)->escapeHtml($e->getMessage())
);
} else {
$messages = array_unique(explode("n", $e->getMessage()));
foreach ($messages as $message) {
$this->messageManager->addError(
$this->_objectManager->get(MagentoFrameworkEscaper::class)->escapeHtml($message)
);
}
}
$url = $this->_checkoutSession->getRedirectUrl(true);
if (!$url) {
$url = $this->_redirect->getRedirectUrl($this->getCartUrl());
}
return $this->goBack($url);
} catch (Exception $e) {
$this->messageManager->addException($e, __('We can't add this item to your shopping cart right now.'));
$this->_objectManager->get(PsrLogLoggerInterface::class)->critical($e);
return $this->goBack();
}
}
/**
* @return string
*/
private function getCartUrl()
{
return $this->_url->getUrl('checkout/cart', ['_secure' => true]);
}
/**
* @return bool
*/
private function shouldRedirectToCart()
{
return $this->_scopeConfig->isSetFlag(
'checkout/cart/redirect_to_cart',
MagentoStoreModelScopeInterface::SCOPE_STORE
);
}
}
Vendor/Module/view/frontend/templates/messages/addCartSuccessMessage.phtml
<?php
// @codingStandardsIgnoreFile
/** @var MagentoFrameworkViewElementTemplate $block */
?>
<?= $block->escapeHtml(__(
'You added %1 to your <a href="%2">shopping cart</a>.',
$block->getData('product_name'),
$block->getData('cart_url')
), ['a']);
We can see this commit: https://github.com/magento/magento2/pull/13904/files#diff-1
Khoa TruongDinh@ when I use this then I am getting error message
– sanjay
May 11 '17 at 17:48
Khoa through showing error @ Undefined variable: customLinkHere in
– sanjay
May 11 '17 at 17:50
Khoa through @ please see the updated question
– sanjay
May 11 '17 at 18:01
@sanjay See my update answer: ChangeaddSuccessMessage()
toaddSuccess()
.
– Khoa TruongDinh
May 12 '17 at 11:17
OMG!! It works!!
– zhartaunik
Jun 30 '18 at 13:02
add a comment |
You can try with:
$message = __('You added %1 to your shopping cart.', $product->getName()) .
'<a href="'. $customLinkHere .'">'. __('View Cart/Checkout') .'</a>';
See an sample here: MagentoAdminNotificationBlockGridRendererActions::render()
[EDIT]
Change addSuccessMessage()
to addSuccess()
[EDIT] 13 May 2018
We should try with addComplexSuccessMessage()
app/code/Vendor/Module/etc/frontend/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCheckoutControllerCartAdd"
type="VendorModuleControllerRewriteCartAdd" />
<type name="MagentoFrameworkViewElementMessageMessageConfigurationsPool">
<arguments>
<argument name="configurationsMap" xsi:type="array">
<item name="addCartSuccessMessage" xsi:type="array">
<item name="renderer" xsi:type="const">MagentoFrameworkViewElementMessageRendererBlockRenderer::CODE</item>
<item name="data" xsi:type="array">
<item name="template" xsi:type="string">Vendor_Module::messages/addCartSuccessMessage.phtml</item>
</item>
</item>
</argument>
</arguments>
</type>
</config>
Vendor/Module/Controller/Rewrite/Cart/Add.php
<?php
namespace VendorModuleControllerRewriteCart;
class Add extends MagentoCheckoutControllerCartAdd
{
public function execute()
{
if (!$this->_formKeyValidator->validate($this->getRequest())) {
return $this->resultRedirectFactory->create()->setPath('*/*/');
}
$params = $this->getRequest()->getParams();
try {
if (isset($params['qty'])) {
$filter = new Zend_Filter_LocalizedToNormalized(
['locale' => $this->_objectManager->get(
MagentoFrameworkLocaleResolverInterface::class
)->getLocale()]
);
$params['qty'] = $filter->filter($params['qty']);
}
$product = $this->_initProduct();
$related = $this->getRequest()->getParam('related_product');
/**
* Check product availability
*/
if (!$product) {
return $this->goBack();
}
$this->cart->addProduct($product, $params);
if (!empty($related)) {
$this->cart->addProductsByIds(explode(',', $related));
}
$this->cart->save();
/**
* @todo remove wishlist observer MagentoWishlistObserverAddToCart
*/
$this->_eventManager->dispatch(
'checkout_cart_add_product_complete',
['product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse()]
);
if (!$this->_checkoutSession->getNoCartRedirect(true)) {
if (!$this->cart->getQuote()->getHasError()) {
if ($this->shouldRedirectToCart()) {
$message = __(
'You added %1 to your shopping cart.',
$product->getName()
);
$this->messageManager->addSuccessMessage($message);
} else {
$this->messageManager->addComplexSuccessMessage(
'addCartSuccessMessage',
[
'product_name' => $product->getName(),
'cart_url' => $this->getCartUrl(),
]
);
}
}
return $this->goBack(null, $product);
}
} catch (MagentoFrameworkExceptionLocalizedException $e) {
if ($this->_checkoutSession->getUseNotice(true)) {
$this->messageManager->addNotice(
$this->_objectManager->get(MagentoFrameworkEscaper::class)->escapeHtml($e->getMessage())
);
} else {
$messages = array_unique(explode("n", $e->getMessage()));
foreach ($messages as $message) {
$this->messageManager->addError(
$this->_objectManager->get(MagentoFrameworkEscaper::class)->escapeHtml($message)
);
}
}
$url = $this->_checkoutSession->getRedirectUrl(true);
if (!$url) {
$url = $this->_redirect->getRedirectUrl($this->getCartUrl());
}
return $this->goBack($url);
} catch (Exception $e) {
$this->messageManager->addException($e, __('We can't add this item to your shopping cart right now.'));
$this->_objectManager->get(PsrLogLoggerInterface::class)->critical($e);
return $this->goBack();
}
}
/**
* @return string
*/
private function getCartUrl()
{
return $this->_url->getUrl('checkout/cart', ['_secure' => true]);
}
/**
* @return bool
*/
private function shouldRedirectToCart()
{
return $this->_scopeConfig->isSetFlag(
'checkout/cart/redirect_to_cart',
MagentoStoreModelScopeInterface::SCOPE_STORE
);
}
}
Vendor/Module/view/frontend/templates/messages/addCartSuccessMessage.phtml
<?php
// @codingStandardsIgnoreFile
/** @var MagentoFrameworkViewElementTemplate $block */
?>
<?= $block->escapeHtml(__(
'You added %1 to your <a href="%2">shopping cart</a>.',
$block->getData('product_name'),
$block->getData('cart_url')
), ['a']);
We can see this commit: https://github.com/magento/magento2/pull/13904/files#diff-1
Khoa TruongDinh@ when I use this then I am getting error message
– sanjay
May 11 '17 at 17:48
Khoa through showing error @ Undefined variable: customLinkHere in
– sanjay
May 11 '17 at 17:50
Khoa through @ please see the updated question
– sanjay
May 11 '17 at 18:01
@sanjay See my update answer: ChangeaddSuccessMessage()
toaddSuccess()
.
– Khoa TruongDinh
May 12 '17 at 11:17
OMG!! It works!!
– zhartaunik
Jun 30 '18 at 13:02
add a comment |
You can try with:
$message = __('You added %1 to your shopping cart.', $product->getName()) .
'<a href="'. $customLinkHere .'">'. __('View Cart/Checkout') .'</a>';
See an sample here: MagentoAdminNotificationBlockGridRendererActions::render()
[EDIT]
Change addSuccessMessage()
to addSuccess()
[EDIT] 13 May 2018
We should try with addComplexSuccessMessage()
app/code/Vendor/Module/etc/frontend/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCheckoutControllerCartAdd"
type="VendorModuleControllerRewriteCartAdd" />
<type name="MagentoFrameworkViewElementMessageMessageConfigurationsPool">
<arguments>
<argument name="configurationsMap" xsi:type="array">
<item name="addCartSuccessMessage" xsi:type="array">
<item name="renderer" xsi:type="const">MagentoFrameworkViewElementMessageRendererBlockRenderer::CODE</item>
<item name="data" xsi:type="array">
<item name="template" xsi:type="string">Vendor_Module::messages/addCartSuccessMessage.phtml</item>
</item>
</item>
</argument>
</arguments>
</type>
</config>
Vendor/Module/Controller/Rewrite/Cart/Add.php
<?php
namespace VendorModuleControllerRewriteCart;
class Add extends MagentoCheckoutControllerCartAdd
{
public function execute()
{
if (!$this->_formKeyValidator->validate($this->getRequest())) {
return $this->resultRedirectFactory->create()->setPath('*/*/');
}
$params = $this->getRequest()->getParams();
try {
if (isset($params['qty'])) {
$filter = new Zend_Filter_LocalizedToNormalized(
['locale' => $this->_objectManager->get(
MagentoFrameworkLocaleResolverInterface::class
)->getLocale()]
);
$params['qty'] = $filter->filter($params['qty']);
}
$product = $this->_initProduct();
$related = $this->getRequest()->getParam('related_product');
/**
* Check product availability
*/
if (!$product) {
return $this->goBack();
}
$this->cart->addProduct($product, $params);
if (!empty($related)) {
$this->cart->addProductsByIds(explode(',', $related));
}
$this->cart->save();
/**
* @todo remove wishlist observer MagentoWishlistObserverAddToCart
*/
$this->_eventManager->dispatch(
'checkout_cart_add_product_complete',
['product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse()]
);
if (!$this->_checkoutSession->getNoCartRedirect(true)) {
if (!$this->cart->getQuote()->getHasError()) {
if ($this->shouldRedirectToCart()) {
$message = __(
'You added %1 to your shopping cart.',
$product->getName()
);
$this->messageManager->addSuccessMessage($message);
} else {
$this->messageManager->addComplexSuccessMessage(
'addCartSuccessMessage',
[
'product_name' => $product->getName(),
'cart_url' => $this->getCartUrl(),
]
);
}
}
return $this->goBack(null, $product);
}
} catch (MagentoFrameworkExceptionLocalizedException $e) {
if ($this->_checkoutSession->getUseNotice(true)) {
$this->messageManager->addNotice(
$this->_objectManager->get(MagentoFrameworkEscaper::class)->escapeHtml($e->getMessage())
);
} else {
$messages = array_unique(explode("n", $e->getMessage()));
foreach ($messages as $message) {
$this->messageManager->addError(
$this->_objectManager->get(MagentoFrameworkEscaper::class)->escapeHtml($message)
);
}
}
$url = $this->_checkoutSession->getRedirectUrl(true);
if (!$url) {
$url = $this->_redirect->getRedirectUrl($this->getCartUrl());
}
return $this->goBack($url);
} catch (Exception $e) {
$this->messageManager->addException($e, __('We can't add this item to your shopping cart right now.'));
$this->_objectManager->get(PsrLogLoggerInterface::class)->critical($e);
return $this->goBack();
}
}
/**
* @return string
*/
private function getCartUrl()
{
return $this->_url->getUrl('checkout/cart', ['_secure' => true]);
}
/**
* @return bool
*/
private function shouldRedirectToCart()
{
return $this->_scopeConfig->isSetFlag(
'checkout/cart/redirect_to_cart',
MagentoStoreModelScopeInterface::SCOPE_STORE
);
}
}
Vendor/Module/view/frontend/templates/messages/addCartSuccessMessage.phtml
<?php
// @codingStandardsIgnoreFile
/** @var MagentoFrameworkViewElementTemplate $block */
?>
<?= $block->escapeHtml(__(
'You added %1 to your <a href="%2">shopping cart</a>.',
$block->getData('product_name'),
$block->getData('cart_url')
), ['a']);
We can see this commit: https://github.com/magento/magento2/pull/13904/files#diff-1
You can try with:
$message = __('You added %1 to your shopping cart.', $product->getName()) .
'<a href="'. $customLinkHere .'">'. __('View Cart/Checkout') .'</a>';
See an sample here: MagentoAdminNotificationBlockGridRendererActions::render()
[EDIT]
Change addSuccessMessage()
to addSuccess()
[EDIT] 13 May 2018
We should try with addComplexSuccessMessage()
app/code/Vendor/Module/etc/frontend/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCheckoutControllerCartAdd"
type="VendorModuleControllerRewriteCartAdd" />
<type name="MagentoFrameworkViewElementMessageMessageConfigurationsPool">
<arguments>
<argument name="configurationsMap" xsi:type="array">
<item name="addCartSuccessMessage" xsi:type="array">
<item name="renderer" xsi:type="const">MagentoFrameworkViewElementMessageRendererBlockRenderer::CODE</item>
<item name="data" xsi:type="array">
<item name="template" xsi:type="string">Vendor_Module::messages/addCartSuccessMessage.phtml</item>
</item>
</item>
</argument>
</arguments>
</type>
</config>
Vendor/Module/Controller/Rewrite/Cart/Add.php
<?php
namespace VendorModuleControllerRewriteCart;
class Add extends MagentoCheckoutControllerCartAdd
{
public function execute()
{
if (!$this->_formKeyValidator->validate($this->getRequest())) {
return $this->resultRedirectFactory->create()->setPath('*/*/');
}
$params = $this->getRequest()->getParams();
try {
if (isset($params['qty'])) {
$filter = new Zend_Filter_LocalizedToNormalized(
['locale' => $this->_objectManager->get(
MagentoFrameworkLocaleResolverInterface::class
)->getLocale()]
);
$params['qty'] = $filter->filter($params['qty']);
}
$product = $this->_initProduct();
$related = $this->getRequest()->getParam('related_product');
/**
* Check product availability
*/
if (!$product) {
return $this->goBack();
}
$this->cart->addProduct($product, $params);
if (!empty($related)) {
$this->cart->addProductsByIds(explode(',', $related));
}
$this->cart->save();
/**
* @todo remove wishlist observer MagentoWishlistObserverAddToCart
*/
$this->_eventManager->dispatch(
'checkout_cart_add_product_complete',
['product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse()]
);
if (!$this->_checkoutSession->getNoCartRedirect(true)) {
if (!$this->cart->getQuote()->getHasError()) {
if ($this->shouldRedirectToCart()) {
$message = __(
'You added %1 to your shopping cart.',
$product->getName()
);
$this->messageManager->addSuccessMessage($message);
} else {
$this->messageManager->addComplexSuccessMessage(
'addCartSuccessMessage',
[
'product_name' => $product->getName(),
'cart_url' => $this->getCartUrl(),
]
);
}
}
return $this->goBack(null, $product);
}
} catch (MagentoFrameworkExceptionLocalizedException $e) {
if ($this->_checkoutSession->getUseNotice(true)) {
$this->messageManager->addNotice(
$this->_objectManager->get(MagentoFrameworkEscaper::class)->escapeHtml($e->getMessage())
);
} else {
$messages = array_unique(explode("n", $e->getMessage()));
foreach ($messages as $message) {
$this->messageManager->addError(
$this->_objectManager->get(MagentoFrameworkEscaper::class)->escapeHtml($message)
);
}
}
$url = $this->_checkoutSession->getRedirectUrl(true);
if (!$url) {
$url = $this->_redirect->getRedirectUrl($this->getCartUrl());
}
return $this->goBack($url);
} catch (Exception $e) {
$this->messageManager->addException($e, __('We can't add this item to your shopping cart right now.'));
$this->_objectManager->get(PsrLogLoggerInterface::class)->critical($e);
return $this->goBack();
}
}
/**
* @return string
*/
private function getCartUrl()
{
return $this->_url->getUrl('checkout/cart', ['_secure' => true]);
}
/**
* @return bool
*/
private function shouldRedirectToCart()
{
return $this->_scopeConfig->isSetFlag(
'checkout/cart/redirect_to_cart',
MagentoStoreModelScopeInterface::SCOPE_STORE
);
}
}
Vendor/Module/view/frontend/templates/messages/addCartSuccessMessage.phtml
<?php
// @codingStandardsIgnoreFile
/** @var MagentoFrameworkViewElementTemplate $block */
?>
<?= $block->escapeHtml(__(
'You added %1 to your <a href="%2">shopping cart</a>.',
$block->getData('product_name'),
$block->getData('cart_url')
), ['a']);
We can see this commit: https://github.com/magento/magento2/pull/13904/files#diff-1
edited May 13 '18 at 8:49
answered May 11 '17 at 12:48
Khoa TruongDinh
20.9k63884
20.9k63884
Khoa TruongDinh@ when I use this then I am getting error message
– sanjay
May 11 '17 at 17:48
Khoa through showing error @ Undefined variable: customLinkHere in
– sanjay
May 11 '17 at 17:50
Khoa through @ please see the updated question
– sanjay
May 11 '17 at 18:01
@sanjay See my update answer: ChangeaddSuccessMessage()
toaddSuccess()
.
– Khoa TruongDinh
May 12 '17 at 11:17
OMG!! It works!!
– zhartaunik
Jun 30 '18 at 13:02
add a comment |
Khoa TruongDinh@ when I use this then I am getting error message
– sanjay
May 11 '17 at 17:48
Khoa through showing error @ Undefined variable: customLinkHere in
– sanjay
May 11 '17 at 17:50
Khoa through @ please see the updated question
– sanjay
May 11 '17 at 18:01
@sanjay See my update answer: ChangeaddSuccessMessage()
toaddSuccess()
.
– Khoa TruongDinh
May 12 '17 at 11:17
OMG!! It works!!
– zhartaunik
Jun 30 '18 at 13:02
Khoa TruongDinh@ when I use this then I am getting error message
– sanjay
May 11 '17 at 17:48
Khoa TruongDinh@ when I use this then I am getting error message
– sanjay
May 11 '17 at 17:48
Khoa through showing error @ Undefined variable: customLinkHere in
– sanjay
May 11 '17 at 17:50
Khoa through showing error @ Undefined variable: customLinkHere in
– sanjay
May 11 '17 at 17:50
Khoa through @ please see the updated question
– sanjay
May 11 '17 at 18:01
Khoa through @ please see the updated question
– sanjay
May 11 '17 at 18:01
@sanjay See my update answer: Change
addSuccessMessage()
to addSuccess()
.– Khoa TruongDinh
May 12 '17 at 11:17
@sanjay See my update answer: Change
addSuccessMessage()
to addSuccess()
.– Khoa TruongDinh
May 12 '17 at 11:17
OMG!! It works!!
– zhartaunik
Jun 30 '18 at 13:02
OMG!! It works!!
– zhartaunik
Jun 30 '18 at 13:02
add a comment |
You need to override this file to achieve this.
vendor/magento/module-checkout/Controller/Cart/Add.php
You can override by creating a custom module at
app/code/Vendor/ModuleName/Controller/Cart/Add.php
and change this part of the code:
if (!$this->cart->getQuote()->getHasError()) {
$message = __(
'You added %1 to your shopping cart.',
$product->getName()
);
$this->messageManager->addSuccessMessage($message);
}
Any other way ,
– sanjay
May 11 '17 at 10:07
sejal @@ please see my updated question any idea , to print chekout url
– sanjay
May 11 '17 at 11:57
@sanjay which link you wish to add ? Product detail link or cart link?
– Sejal Shah
May 12 '17 at 5:57
add a comment |
You need to override this file to achieve this.
vendor/magento/module-checkout/Controller/Cart/Add.php
You can override by creating a custom module at
app/code/Vendor/ModuleName/Controller/Cart/Add.php
and change this part of the code:
if (!$this->cart->getQuote()->getHasError()) {
$message = __(
'You added %1 to your shopping cart.',
$product->getName()
);
$this->messageManager->addSuccessMessage($message);
}
Any other way ,
– sanjay
May 11 '17 at 10:07
sejal @@ please see my updated question any idea , to print chekout url
– sanjay
May 11 '17 at 11:57
@sanjay which link you wish to add ? Product detail link or cart link?
– Sejal Shah
May 12 '17 at 5:57
add a comment |
You need to override this file to achieve this.
vendor/magento/module-checkout/Controller/Cart/Add.php
You can override by creating a custom module at
app/code/Vendor/ModuleName/Controller/Cart/Add.php
and change this part of the code:
if (!$this->cart->getQuote()->getHasError()) {
$message = __(
'You added %1 to your shopping cart.',
$product->getName()
);
$this->messageManager->addSuccessMessage($message);
}
You need to override this file to achieve this.
vendor/magento/module-checkout/Controller/Cart/Add.php
You can override by creating a custom module at
app/code/Vendor/ModuleName/Controller/Cart/Add.php
and change this part of the code:
if (!$this->cart->getQuote()->getHasError()) {
$message = __(
'You added %1 to your shopping cart.',
$product->getName()
);
$this->messageManager->addSuccessMessage($message);
}
answered May 10 '17 at 13:20
Sejal Shah
991420
991420
Any other way ,
– sanjay
May 11 '17 at 10:07
sejal @@ please see my updated question any idea , to print chekout url
– sanjay
May 11 '17 at 11:57
@sanjay which link you wish to add ? Product detail link or cart link?
– Sejal Shah
May 12 '17 at 5:57
add a comment |
Any other way ,
– sanjay
May 11 '17 at 10:07
sejal @@ please see my updated question any idea , to print chekout url
– sanjay
May 11 '17 at 11:57
@sanjay which link you wish to add ? Product detail link or cart link?
– Sejal Shah
May 12 '17 at 5:57
Any other way ,
– sanjay
May 11 '17 at 10:07
Any other way ,
– sanjay
May 11 '17 at 10:07
sejal @@ please see my updated question any idea , to print chekout url
– sanjay
May 11 '17 at 11:57
sejal @@ please see my updated question any idea , to print chekout url
– sanjay
May 11 '17 at 11:57
@sanjay which link you wish to add ? Product detail link or cart link?
– Sejal Shah
May 12 '17 at 5:57
@sanjay which link you wish to add ? Product detail link or cart link?
– Sejal Shah
May 12 '17 at 5:57
add a comment |
I'm not sure why, but in my case, by calling the obsolete method without "Message" solves the issue with the links.
Instead of using addNoticeMessage
, I changed to addNotice
, and the links were displayed.
In my case:
$noticeMsg = __('You must be <a href="%1">logged in</a> or <a href="%2">registered</a> to purchase these products.',
$this->_storeManager->getStore()->getUrl('customer/account/login'),
$this->_storeManager->getStore()->getUrl('customer/account/create')
);
$this->_messageManager->addNotice($noticeMsg);
add a comment |
I'm not sure why, but in my case, by calling the obsolete method without "Message" solves the issue with the links.
Instead of using addNoticeMessage
, I changed to addNotice
, and the links were displayed.
In my case:
$noticeMsg = __('You must be <a href="%1">logged in</a> or <a href="%2">registered</a> to purchase these products.',
$this->_storeManager->getStore()->getUrl('customer/account/login'),
$this->_storeManager->getStore()->getUrl('customer/account/create')
);
$this->_messageManager->addNotice($noticeMsg);
add a comment |
I'm not sure why, but in my case, by calling the obsolete method without "Message" solves the issue with the links.
Instead of using addNoticeMessage
, I changed to addNotice
, and the links were displayed.
In my case:
$noticeMsg = __('You must be <a href="%1">logged in</a> or <a href="%2">registered</a> to purchase these products.',
$this->_storeManager->getStore()->getUrl('customer/account/login'),
$this->_storeManager->getStore()->getUrl('customer/account/create')
);
$this->_messageManager->addNotice($noticeMsg);
I'm not sure why, but in my case, by calling the obsolete method without "Message" solves the issue with the links.
Instead of using addNoticeMessage
, I changed to addNotice
, and the links were displayed.
In my case:
$noticeMsg = __('You must be <a href="%1">logged in</a> or <a href="%2">registered</a> to purchase these products.',
$this->_storeManager->getStore()->getUrl('customer/account/login'),
$this->_storeManager->getStore()->getUrl('customer/account/create')
);
$this->_messageManager->addNotice($noticeMsg);
answered Sep 25 '17 at 2:06
Ricardo Martins
580420
580420
add a comment |
add a comment |
That will a wrong way, you just want to add text to the message after product is added to cart thus you have to modify at the place from where text is coming:-
i.e, vendormagentomodule-checkoutControllerCart.php
On line 121
$message = __(
'You added %1 to your shopping cart.',
$product->getName()
);
Modify above message as you want.
I have include this line or I have to replace this with any script
– sanjay
May 10 '17 at 13:07
You need to override the controller and replace the text, either by replacing the text or replacing $product->getName() with content you need
– arushi
May 10 '17 at 13:14
why we can not send a link with a varible pass in success function , see this updated question
– sanjay
May 11 '17 at 11:21
arushi Please see the error , I just updated question
– sanjay
May 11 '17 at 18:00
You need to review magento.stackexchange.com/questions/134702/… link for this, Here it has explained the same think how to add a link with success message.
– arushi
May 12 '17 at 6:31
add a comment |
That will a wrong way, you just want to add text to the message after product is added to cart thus you have to modify at the place from where text is coming:-
i.e, vendormagentomodule-checkoutControllerCart.php
On line 121
$message = __(
'You added %1 to your shopping cart.',
$product->getName()
);
Modify above message as you want.
I have include this line or I have to replace this with any script
– sanjay
May 10 '17 at 13:07
You need to override the controller and replace the text, either by replacing the text or replacing $product->getName() with content you need
– arushi
May 10 '17 at 13:14
why we can not send a link with a varible pass in success function , see this updated question
– sanjay
May 11 '17 at 11:21
arushi Please see the error , I just updated question
– sanjay
May 11 '17 at 18:00
You need to review magento.stackexchange.com/questions/134702/… link for this, Here it has explained the same think how to add a link with success message.
– arushi
May 12 '17 at 6:31
add a comment |
That will a wrong way, you just want to add text to the message after product is added to cart thus you have to modify at the place from where text is coming:-
i.e, vendormagentomodule-checkoutControllerCart.php
On line 121
$message = __(
'You added %1 to your shopping cart.',
$product->getName()
);
Modify above message as you want.
That will a wrong way, you just want to add text to the message after product is added to cart thus you have to modify at the place from where text is coming:-
i.e, vendormagentomodule-checkoutControllerCart.php
On line 121
$message = __(
'You added %1 to your shopping cart.',
$product->getName()
);
Modify above message as you want.
edited Sep 25 '17 at 6:26
Manoj Deswal
4,27581742
4,27581742
answered May 10 '17 at 13:02
arushi
521215
521215
I have include this line or I have to replace this with any script
– sanjay
May 10 '17 at 13:07
You need to override the controller and replace the text, either by replacing the text or replacing $product->getName() with content you need
– arushi
May 10 '17 at 13:14
why we can not send a link with a varible pass in success function , see this updated question
– sanjay
May 11 '17 at 11:21
arushi Please see the error , I just updated question
– sanjay
May 11 '17 at 18:00
You need to review magento.stackexchange.com/questions/134702/… link for this, Here it has explained the same think how to add a link with success message.
– arushi
May 12 '17 at 6:31
add a comment |
I have include this line or I have to replace this with any script
– sanjay
May 10 '17 at 13:07
You need to override the controller and replace the text, either by replacing the text or replacing $product->getName() with content you need
– arushi
May 10 '17 at 13:14
why we can not send a link with a varible pass in success function , see this updated question
– sanjay
May 11 '17 at 11:21
arushi Please see the error , I just updated question
– sanjay
May 11 '17 at 18:00
You need to review magento.stackexchange.com/questions/134702/… link for this, Here it has explained the same think how to add a link with success message.
– arushi
May 12 '17 at 6:31
I have include this line or I have to replace this with any script
– sanjay
May 10 '17 at 13:07
I have include this line or I have to replace this with any script
– sanjay
May 10 '17 at 13:07
You need to override the controller and replace the text, either by replacing the text or replacing $product->getName() with content you need
– arushi
May 10 '17 at 13:14
You need to override the controller and replace the text, either by replacing the text or replacing $product->getName() with content you need
– arushi
May 10 '17 at 13:14
why we can not send a link with a varible pass in success function , see this updated question
– sanjay
May 11 '17 at 11:21
why we can not send a link with a varible pass in success function , see this updated question
– sanjay
May 11 '17 at 11:21
arushi Please see the error , I just updated question
– sanjay
May 11 '17 at 18:00
arushi Please see the error , I just updated question
– sanjay
May 11 '17 at 18:00
You need to review magento.stackexchange.com/questions/134702/… link for this, Here it has explained the same think how to add a link with success message.
– arushi
May 12 '17 at 6:31
You need to review magento.stackexchange.com/questions/134702/… link for this, Here it has explained the same think how to add a link with success message.
– arushi
May 12 '17 at 6:31
add a comment |
Try the below code in your controller its work for me
protected $_urlInterface;
public function __construct(
MagentoFrameworkUrlInterface $urlInterface
) {
$this->_urlInterface = $urlInterface;
parent::__construct($context);
}
public function execute() {
$url = $this->_urlInterface->getUrl('checkout/cart', ['_secure' => true]);
try{
$message = __('You added '.$_product->getName().'to your <a href="'.$url.'">shopping cart.</a>');
$this->messageManager->addSuccess($message);
} catch (Exception $e) {
$message = __("We don't have as many %1 as you requested.",$_product->getName());
$this->messageManager->addErrorMessage($message);
}
}
The result should be like this See The Result Here
add a comment |
Try the below code in your controller its work for me
protected $_urlInterface;
public function __construct(
MagentoFrameworkUrlInterface $urlInterface
) {
$this->_urlInterface = $urlInterface;
parent::__construct($context);
}
public function execute() {
$url = $this->_urlInterface->getUrl('checkout/cart', ['_secure' => true]);
try{
$message = __('You added '.$_product->getName().'to your <a href="'.$url.'">shopping cart.</a>');
$this->messageManager->addSuccess($message);
} catch (Exception $e) {
$message = __("We don't have as many %1 as you requested.",$_product->getName());
$this->messageManager->addErrorMessage($message);
}
}
The result should be like this See The Result Here
add a comment |
Try the below code in your controller its work for me
protected $_urlInterface;
public function __construct(
MagentoFrameworkUrlInterface $urlInterface
) {
$this->_urlInterface = $urlInterface;
parent::__construct($context);
}
public function execute() {
$url = $this->_urlInterface->getUrl('checkout/cart', ['_secure' => true]);
try{
$message = __('You added '.$_product->getName().'to your <a href="'.$url.'">shopping cart.</a>');
$this->messageManager->addSuccess($message);
} catch (Exception $e) {
$message = __("We don't have as many %1 as you requested.",$_product->getName());
$this->messageManager->addErrorMessage($message);
}
}
The result should be like this See The Result Here
Try the below code in your controller its work for me
protected $_urlInterface;
public function __construct(
MagentoFrameworkUrlInterface $urlInterface
) {
$this->_urlInterface = $urlInterface;
parent::__construct($context);
}
public function execute() {
$url = $this->_urlInterface->getUrl('checkout/cart', ['_secure' => true]);
try{
$message = __('You added '.$_product->getName().'to your <a href="'.$url.'">shopping cart.</a>');
$this->messageManager->addSuccess($message);
} catch (Exception $e) {
$message = __("We don't have as many %1 as you requested.",$_product->getName());
$this->messageManager->addErrorMessage($message);
}
}
The result should be like this See The Result Here
answered yesterday
chris
7110
7110
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f173819%2fi-am-trying-to-add-link-to-the-success-message-in-magento-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Should check my updated answer.
– Khoa TruongDinh
May 23 '17 at 12:48