1

I am new to Magento and can't able to find out why to reorder link in the order history of the customer account redirects to a 404 error. it is redirect to a URL sales/order/reorder/order_id/ but it gives me 404 error.

3 Answers 3

1

app/code/Vendor/Module/Controller/Order/Reorder.php

<?php

namespace Vendor\Module\Controller\Order;

use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
use Magento\Sales\Controller\OrderInterface;

class Reorder extends \Magento\Sales\Controller\AbstractController\Reorder implements OrderInterface, HttpGetActionInterface
{
}

app/code/Vendor/Module/General/etc/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    
    <preference for="Magento\Sales\Controller\Order\Reorder" type="Vendor\Module\Controller\Order\Reorder"/>

</config>

app/code/Vendor/Module/etc/module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_Module">
        <sequence>
              <module name="Magento_Sales"/>
        </sequence>
    </module>
</config>
1
  • This worked for me. Wow!!!! Thanks! Aug 6 at 22:41
0

Dealing with exactly the same issue! really weird.

More info:

Logs say nothing. (nginx + php7.4 + redis + 2.4.3-p1) - Backend works perfectly.

I have spent more than 10 hours in the logs. All logs: Magento logs, Nginx, Php-fpm. It's really weird because the only related info is the one in the Nginx access logs mentioning the redirect which I already knew 😟

My journey in Xdebug has not been easy! I really really wish there was a good tutorial about this. The ones that exist only explain tracking the flow of data (setData & getData) to debug and diagnose the issues which can not be applied to my case here. Any tips about how can I track the router or setting up a conditional "break point" on the router?

In other words how can I see the "Frames/stack" right before the redirection? There must be a way to define a [conditional] break point related to routing, but I don't know how.

0

We had this exact problem, after spending more than 10 hours watching the logs and inspecting the "cms_noroute_index", turned out for some weird reason a third-party extension was the fault here. In our case we found out: "Amasty Improved Layered Navigation: SEO URLS" was the culprit. Go there and change the settings.

Unfortunately there was nothing in the logs, anywhere saying the router has failed and why. Which is really important imo.

For those wondering how to to debug and inspect such issues here's what you have to do: Create a custom module and an observer.

    public function execute(Observer $observer)
{
    $mageerequest = $observer->getEvent()->getRequest();
    $mageeFullActionName = strtolower($mageerequest->getFullActionName());
    // conditionally check what you need
    if (strpos($mageeFullActionName, 'cms_noroute_index') !== false) {
    
        $mageeDebug = true;


        // Set the break point to $mageeDebug = true;
        // And then inspect the request flow prior to that.
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.