Setting up a 404 page in OpenCart

In OpenCart, the 404 error page is generated directly in the CMS, which is why the setup instructions your 404 page will not give the desired result.

You can create your 404 page in OpenCart by:

To change the layout of your 404 page, do the following:
  1. Go to section "Design → Layouts":
  2. Add a new layout by clicking "+":
  3. Specify the data for creating the layout:
    1. "Layout name" — specify an arbitrary name for the layout.
    2. In a table with columns "Invoice" and "Way" click "+" and in the field "Invoice" select your active store, and in the field "Way" indicate error/not_found.
    3. In chapter "Select the location of the modules" clicking on "+" you can add a block with the desired element to the desired panel. The choice of such blocks must be done at your own discretion.
  4. Save your changes.
To change the text of the 404 page, you need to change the file catalog\language\ru-ru\error\not_found.phpwhere instead of ru-ru you need to specify the language you are using.

Only a few parameters will be specified in the file:

  • Title:
    // Heading
    $_['heading_title'] = 'The requested page was not found!';
  • Page text:
    // Text
    $_['text_error'] = 'Sorry, the page you requested was not found. Probably, you specified a non-existent address, the page was deleted, moved or is now temporarily unavailable!';

Both parameters can be changed to suit your needs. If you want to add any styles or pictures, you can use the standard HTML-tags. For example, to display a picture, you can do this:

// Heading
$_['heading_title'] = 'The requested page was not found!';
// Text
$_['text_error'] = 'Sorry, the page you requested was not found. <img src = "https://example.com/404.png">';