Skip to content

Commit 361965b

Browse files
author
Arjen Miedema
committed
Fix the 404 message for product alerts when not logged in
When the user isn't logged in and presses the product alert link (either stock or price), the user has to login and gets redirected to a 404 page. This is because the redirect done by the login page is a `GET` call. The fix done is to change the used interface for the product alerts from `POST` to `GET`, as this is the easy fix and there's no reason to use `POST` here at this moment, as all parameters for the call are all in get URL parameters.
1 parent bb3cede commit 361965b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

app/code/Magento/ProductAlert/Controller/Add/Price.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Magento\ProductAlert\Controller\Add;
88

9-
use Magento\Framework\App\Action\HttpPostActionInterface;
9+
use Magento\Framework\App\Action\HttpGetActionInterface;
1010
use Magento\ProductAlert\Controller\Add as AddController;
1111
use Magento\Framework\App\Action\Context;
1212
use Magento\Customer\Model\Session as CustomerSession;
@@ -20,7 +20,7 @@
2020
/**
2121
* Controller for notifying about price.
2222
*/
23-
class Price extends AddController implements HttpPostActionInterface
23+
class Price extends AddController implements HttpGetActionInterface
2424
{
2525
/**
2626
* @var \Magento\Store\Model\StoreManagerInterface

app/code/Magento/ProductAlert/Controller/Add/Stock.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Magento\ProductAlert\Controller\Add;
88

9-
use Magento\Framework\App\Action\HttpPostActionInterface;
9+
use Magento\Framework\App\Action\HttpGetActionInterface;
1010
use Magento\ProductAlert\Controller\Add as AddController;
1111
use Magento\Framework\App\Action\Context;
1212
use Magento\Customer\Model\Session as CustomerSession;
@@ -19,7 +19,7 @@
1919
/**
2020
* Controller for notifying about stock.
2121
*/
22-
class Stock extends AddController implements HttpPostActionInterface
22+
class Stock extends AddController implements HttpGetActionInterface
2323
{
2424
/**
2525
* @var \Magento\Catalog\Api\ProductRepositoryInterface

app/code/Magento/ProductAlert/view/frontend/templates/product/view.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
?>
77
<?php /* @var $block \Magento\ProductAlert\Block\Product\View */?>
88
<div class="product alert <?= $block->getHtmlClass() ?>">
9-
<a href="#" data-post='<?= /* @noEscape */ $block->getPostAction() ?>'
9+
<a href="<?= $block->escapeUrl($block->getSignupUrl()) ?>"
1010
title="<?= $block->escapeHtml(__($block->getSignupLabel())) ?>" class="action alert">
1111
<?= $block->escapeHtml(__($block->getSignupLabel())) ?>
1212
</a>

0 commit comments

Comments
 (0)