Post by qahar » Sat Sep 25, 2010 12:39 am

I've been change not_found.tpl design into 404 error page not found. When i'm done, i noticed that empty cart is showing 404 eror page, also the empty download and empty purchase history page.
Is there any simply way to make 404 error page? or we need to duplicate the not_found.tpl ?
If someone had post this and resolved, please tell me the link.
Thanks for your help..

Regards,
Qahar
Last edited by qahar on Wed Oct 06, 2010 4:01 am, edited 1 time in total.

User avatar
Expert Member

Posts

Joined
Tue Jun 29, 2010 10:24 pm
Location - Indonesia

Post by qahar » Sat Sep 25, 2010 9:47 pm

any help or information plz.. :)

User avatar
Expert Member

Posts

Joined
Tue Jun 29, 2010 10:24 pm
Location - Indonesia

Post by qahar » Wed Oct 06, 2010 3:59 am

Solved, the main ide is how to separate error page (not found) and empty page (empty cart, download and history).

1. Open stylesheet.css
add:

Code: Select all

.hidden {display:none;}
2. Open: not_found.tpl
Find class "middle", duplicate and give different ID

Code: Select all

  <div id="empty" class="middle hidden">
    <div class="content"><?php echo $text_error; ?></div>
    <div class="buttons">
      <table>
        <tr>
          <td align="right"><a onclick="location = '<?php echo str_replace('&', '&', $continue); ?>'" class="button"><span><?php echo $button_continue; ?></span></a></td>
        </tr>
      </table>
    </div>
  </div>
  <div id="notfound" class="middle hidden">
    <div class="content">

<p>Why this happen: <?php echo $text_error; ?></p>
<p>May be you can find what you need on:</p>
<ol>
<li>link to sitemap</li>
<li>link to advanced search</li>
</ol>

   </div>
    <div class="buttons">
      <table>
        <tr>
          <td align="right"><a onclick="location = '<?php echo str_replace('&', '&', $continue); ?>'" class="button"><span><?php echo $button_continue; ?></span></a></td>
        </tr>
      </table>
    </div>
  </div>

3. Still on: not_found.tpl
before <?php echo $footer; ?> add this:

Code: Select all

<script type="text/javascript"><!-- 
$(document).ready(function() {
	route = getURLVar('route');
	
		if (route == 'checkout/cart') {
			$('#empty').removeClass('hidden');
		} else if (route == 'account/download') {
			$('#empty').removeClass('hidden');	
		} else if (route == 'account/history') {
			$('#empty').removeClass('hidden');	
		}  else {
			$('#notfound').removeClass('hidden');
		}

});  
//--></script>
4. what this use for?
- if some one go to empty cart page, they will see not_found.tpl message: Your shopping cart is empty!
- if they visit the unavailable page (info or category, they will see: the not found message + your suggestion

note: but i think this will not work with seo site

User avatar
Expert Member

Posts

Joined
Tue Jun 29, 2010 10:24 pm
Location - Indonesia

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

@qahar - Any chance you've updated your code to work with v1.5.2.1? 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 rajithg » Thu May 10, 2012 6:55 pm

is it possible to create a custom 404 error page with images stc.. in open cart....?

New member

Posts

Joined
Tue Mar 27, 2012 11:28 am

Post by qahar » Thu May 10, 2012 7:40 pm

MrTech wrote:@qahar - Any chance you've updated your code to work with v1.5.2.1? Thanks!
rajithg wrote:is it possible to create a custom 404 error page with images stc.. in open cart....?
May be next week I will make tutorial on this.

User avatar
Expert Member

Posts

Joined
Tue Jun 29, 2010 10:24 pm
Location - Indonesia

Post by eWarrior » Fri Jan 18, 2013 6:16 pm

I know this is an old thread but I thought I would post my solution for the benefit of others.

I am not really a fan of hiding text via CSS unless this is required from a functional perspective such as drop down menu's etc.

Why not just use PHP if statements to check against the desired page and insert the custom code accordingly?

For example, in catalog/view/theme/*/template/error/not_found.tpl

Replace

Code: Select all

<div class="content"><?php echo $text_error; ?></div>
With

Code: Select all

<?php if ((isset($this->request->get['route']) && $this->request->get['route'] == 'error/not_found')) { ?>
<div class="content">

<!--Insert your custom design here-->

</div>
<?php } else { ?>
<div class="content"><?php echo $text_error; ?></div>
<?php } ?>
Obviously you could do this with as much of the template code as you like, including the entire template if you choose to. The section above is only an example.

New member

Posts

Joined
Wed Aug 29, 2012 4:27 pm

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

@eWarrior.

Thanks for posting you solution. For a non-programmer like me. What would I put in the

<!--Insert your custom design here-->

is this a path? if so, could you give an example.

Cheers Mate
Daz

Newbie

Posts

Joined
Thu Aug 29, 2013 12:12 am

Post by JEfromCanada » Fri Sep 06, 2013 3:55 am

@eWarrior:

I was looking through my server logs last night and noticed that several shoppers had been continuously trying to click the "checkout" link. I found that behavior curious, so I tried it too. Imagine my shock when I saw my customized 404 page come up!

I determined the 404 page only displayed when the cart was empty, and today, I found your solution. I tried it and it worked perfectly!

Thank you SO MUCH for that pearl of wisdom. I'll be checking out your profile to see if you have authored any OpenCart plug-ins that I can purchase as a thank you.

New member

Posts

Joined
Thu May 23, 2013 1:49 am
Who is online

Users browsing this forum: No registered users and 149 guests