Post by rockyalifept » Sun Mar 04, 2012 9:17 am

I want to have a custom error page, I wonder if it's possible?
I want to buy one from this site, for example this one: http://themeforest.net/item/simplistic-404/1538456
But I don't know if it's possible to insert ir or how to do it, can anybody help me?
Thanks in advance ;)

(I have the 1.5.1.3.1 Opencart version.)

Newbie

Posts

Joined
Sun Mar 04, 2012 9:10 am

Post by SamNabz » Sun Mar 04, 2012 12:23 pm

Hi rockyalifept,

Download the custom 404 page you want, edit it to suit your website (e.g. colours links etc.). Once you've done that, copy all the coding (including styling) and paste it into the not_found.tpl file located in catalog/view/theme/yourthemename/template/error/

Paste the code within <div class="content"> </div> and be sure to de-activate or delete this <?php echo $text_error; ?> - to de-active, replace this:

Code: Select all

<?php echo $text_error; ?>
with this

Code: Select all

<!--<?php echo $text_error; ?>-->
Let me know how you go...

Cheers, Sam


Active Member

Posts

Joined
Wed Jul 06, 2011 7:32 am
Location - Sydney, Australia

Post by rockyalifept » Sun Mar 04, 2012 6:38 pm

I'm very thankful for your help!
As soon as I buy the custom page I will install it and tell you how it went!
Thanks

Newbie

Posts

Joined
Sun Mar 04, 2012 9:10 am

Post by MrTech » Tue Mar 20, 2012 5:18 am

Your solution doesn't really work because you will get this page when you visit an empty cart page or goto checkout and there are no items in your cart.

I've been searching the forums for an answer and the closest I've found is this:
http://forum.opencart.com/viewtopic.php?f=20&t=20507

The code posted is for an older version of opencart and doesn't support seo url's as per the author. Just wondering if anyone has found a working solution to what should be an easy peasy fix?

~
Install Extensions OR OpenCart Fast Service! PayPal Accepted
I will professionally install and configure any free or purchased theme, module or extension.

Visit http://www.mrtech.ca if you need an OpenCart webmaster
~


User avatar
Active Member

Posts

Joined
Mon Jan 09, 2012 2:39 pm
Location - Canada, Eh!

Post by smifis » Tue Mar 20, 2012 5:32 am

This isn't really all that hard to do,

The not_found.tpl file is only for 404 errors in version 1.4.x and 1.5.x and you can safely edit this file, it will not affect the cart or any other errors pages as these are made using their respective controller.

Active Member

Posts

Joined
Sat Jan 15, 2011 10:37 pm


Post by MrTech » Tue Mar 20, 2012 6:33 am

@smifis - Can you confirm this is working for you currently on v1.5.2.1? The reason I ask is because I've gone ahead and tried again based on your post and get the same results. Here's an example of a quick edit to the file, please correct me where I'm wrong...

This is the file I modified:

Code: Select all

catalog\view\theme\default\template\error\not_found.tpl
This is the code that I modified:

Code: Select all

<div class="content"><?php echo $text_error; ?></div>
I added 'HELLO WORLD' after the error message like this:

Code: Select all

<div class="content"><?php echo $text_error; ?>HELLO WORLD!</div>
Now, as I posted initially, I will see the error message along with the words "HELLO WORLD!" on the 404 page, checkout page and shopping cart page. If I remove the entire error string, then I only see the two words, again displayed across all pages.

Can someone else test the above and let me know your results? Thanks!

~
Install Extensions OR OpenCart Fast Service! PayPal Accepted
I will professionally install and configure any free or purchased theme, module or extension.

Visit http://www.mrtech.ca if you need an OpenCart webmaster
~


User avatar
Active Member

Posts

Joined
Mon Jan 09, 2012 2:39 pm
Location - Canada, Eh!

Post by smifis » Tue Mar 20, 2012 6:44 am

Just looked into it a little bit deeper,

here's what to do, create a 2nd copy of '/catalog/controller/view/default/template/error/not_found.tpl' called 'error_404.tpl'

In the file 'catalog/controller/error/not_found.php', replace

Code: Select all

		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/error/not_found.tpl';
		} else {
			$this->template = 'default/template/error/not_found.tpl';
		}
with

Code: Select all

		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/error_404.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/error/error_404.tpl';
		} else {
			$this->template = 'default/template/error/error_404.tpl';
		}
error_404.tpl is your new 404 error file, you can replace its entire contents if you wish.
Last edited by smifis on Sat Feb 09, 2013 9:56 pm, edited 1 time in total.

Active Member

Posts

Joined
Sat Jan 15, 2011 10:37 pm


Post by MrTech » Tue Mar 20, 2012 11:22 am

That did the trick! Thanks for your time...

~
Install Extensions OR OpenCart Fast Service! PayPal Accepted
I will professionally install and configure any free or purchased theme, module or extension.

Visit http://www.mrtech.ca if you need an OpenCart webmaster
~


User avatar
Active Member

Posts

Joined
Mon Jan 09, 2012 2:39 pm
Location - Canada, Eh!

Post by techfi » Wed Jul 18, 2012 9:03 pm

Hi there!
I have done everything said here, but I dont have an error_404.tpl page, only an error_404.php page, can I edit the PHP file as I please or have I missed a step?

Also, my URL is livinthing.com , if I add /test123 , should an error page appear ? because when this happens to me I get

Not Found

The requested URL /test123 was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Any ideas on how I can fix this and get a propper error 404 page which I can edit?

Newbie

Posts

Joined
Wed Jul 18, 2012 6:15 am

Post by Cleo » Sat Feb 09, 2013 7:13 pm

I know this is an old thread but since I don't know if the problem have been corrected in the new version I prefer to ask.

@smifis


You said:
here's what to do, create a 2nd copy of '/catalog/controller/view/default/template/error/not_found.tpl' called 'error_404.php'
If the file to be copied has the extension .tpl shouldn't the second file be .tpl as well or is it really .php?

Just want to be sure :drunk:

tks

Cleo

Opencart v1.5.4.1 fr/en
Theme: Custom
vqmod-2.6.0
PHP: 7.3 (ea-php73)


User avatar
Active Member

Posts

Joined
Wed Mar 09, 2011 5:19 am

Post by smifis » Sat Feb 09, 2013 9:55 pm

Sorry that should be .tpl and not .php

I will edit the post to remove any confusion.

Active Member

Posts

Joined
Sat Jan 15, 2011 10:37 pm


Post by Cleo » Sun Feb 10, 2013 11:13 am

Fine, thank you for the reply and clarification!

Cleo

Opencart v1.5.4.1 fr/en
Theme: Custom
vqmod-2.6.0
PHP: 7.3 (ea-php73)


User avatar
Active Member

Posts

Joined
Wed Mar 09, 2011 5:19 am

Post by pringle12345 » Sun Feb 17, 2013 3:08 am

Has anyone here ever worked with Smifis?

Newbie

Posts

Joined
Mon Nov 26, 2012 10:16 am

Post by Cleo » Sun Feb 17, 2013 3:20 am

Well it didn't work anyway :(



@ pringle

Never did!

Cleo

Opencart v1.5.4.1 fr/en
Theme: Custom
vqmod-2.6.0
PHP: 7.3 (ea-php73)


User avatar
Active Member

Posts

Joined
Wed Mar 09, 2011 5:19 am

Post by slewman » Mon Sep 02, 2013 11:32 am

@smifis a big thank you to you for this solution. Works perfectly for 1.5.6
You saved what's left of my hair O0

Newbie

Posts

Joined
Thu Aug 29, 2013 12:12 am

Post by hnimzpig » Thu Jun 26, 2014 2:13 am

Step 1:
open file /catalog/controller/error/not_found.php
add "//" before this line
$this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . '/1.1 404 Not Found');
like this:
//$this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . '/1.1 404 Not Found');
Step 2:
open file /catalog/controller/view/your_current_theme/template/error/not_found.tpl to modify what you want to show.

That the way I do with my site http://www.d-city.net. Hope this way could help you!

www.d-city.net | Danang shopping online


Newbie

Posts

Joined
Thu Jun 26, 2014 1:51 am
Who is online

Users browsing this forum: Amazon [Bot], Baidu [Spider], Google [Bot] and 116 guests