Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Header Status Handler


Jack_mcs

Recommended Posts

Updated..installed...tested...working.   :thumbsup:

 

Thank you

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

  • 1 month later...

They serve different purposes. This one issues actual 404 and 410 errors for items not found. The custom server errors addon redirects to a certain page on those errors. I recommend installing them both. There is a setting in this one to tell it where to redirect to and you can enter in the custom server error page to serve that purpose.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I'm sorry but I've no idea what "extract the filed from that edge version" means.

 

this bit here what was quoted above.

 

"Go here, lower right part of screen where it says download zip.

 

https://github.com/g...sive-osCommerce

 

That's what is being called the "edge" with all the latest commits.  I tried it out a few days ago testing the installer that Gary updated.  The install went fine."

Link to comment
Share on other sites

I still don't understand. Extract the filed?  Regardless, I think the instructions are clear. You make the changes to the files mentioned, which exist in all oscommerce versions.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 2 weeks later...

Hi there

firstly thank-you for this contribution.

I am using it on a Boot Strap version all is working but I think I have found a bug.

 

When someone writes a review and presses enter the site goes to the error page I have set up. Instead of the thanks for your review it will be live soon message.

I realise this is because the review doesn't exist yet because as an admin I have not set it to approved.

So it is working as it should but causes customers to think the review system is not working.

Hope that makes sense.

Doug

Link to comment
Share on other sites

I don't have a BS shop with those addons installed here so I can't test it. I do have them installed in a pre-2.3 shop and am able to add a review without a redirect. But 2.3 handles the reviews differently so that may not be accurate. This will probably need a check in the application_top file where this addon is called to see if this condition exists and then skip the call if it does. But I can't tell you what to check for since I don't have that setup.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Ahh I see I didn't realise the reviews were handled differently in bootstrap.
 
Is there a way to disable the review part of  the handler until it is worked out.
 
Somewhere in here functions/headerstaushandler

 

else { //it's a review page
          $db_query = tep_db_query("select 1 from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where p.products_status = 1 and p.products_id = '" . (int)$pID . "' and pd.language_id = " . (int)$languages_id);
          if (tep_db_num_rows($db_query)) {
              $db_query = tep_db_query("SHOW COLUMNS FROM " . TABLE_REVIEWS . " LIKE 'approved'");
              $checkItem = (tep_db_num_rows($db_query) > 0 ?  'r.approved' : 'r.reviews_status');
              $db_query = tep_db_query("select " . $checkItem . " as status from " . TABLE_REVIEWS . " r left join " . TABLE_REVIEWS_DESCRIPTION . " rd on r.reviews_id = rd.reviews_id where r.products_id = '" . (int)$pID . "' and rd.languages_id = " . (int)$languages_id);
              
              if (tep_db_num_rows($db_query) == 0 && $pageType == FILENAME_PRODUCT_REVIEWS) {
                  return RTN_GOOD;  //a review doesn't exist but allow page to load so one can be written
              }
          } else {
              return RTN_410;  //doesn't exist so marks as not found for good
          }
      }
 
      if (tep_db_num_rows($db_query) == 0) {
          return RTN_410;  //doesn't exist so marks as not found for good
      }
 
      $db = tep_db_fetch_array($db_query);
 
      if ($db['status'] == 0) {
          return RTN_404;  //in database and may be shown again
      }
      
      return RTN_GOOD;  //product was found and can be shown
  }
Link to comment
Share on other sites

In includes/application_top.php change this line

      if (strpos($_SERVER['PHP_SELF'], FILENAME_PRODUCT_INFO) !== FALSE || strpos($_SERVER['PHP_SELF'], FILENAME_PRODUCT_REVIEWS) !== FALSE) {

to this

      if (strpos($_SERVER['PHP_SELF'], FILENAME_PRODUCT_INFO) !== FALSE ) {

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Thank you so much for the super fast replies really appreciate it.

The other work around I found ...

In product_reviews_write.php

 

I changed the redirect which normally goes back to the just made review --- to redirect to the product you have just written about and show a success message.

That way the product exists and the user is somewhere they understand.

If anyone can see something I have missed which could cause a problem please let me know.

Doug

Link to comment
Share on other sites

  • 2 weeks later...

@@Jack_mcs Hi Jack, I've installed this - along with Custom Server Error page here on 2.3.4 BS. As I debug my install, I have an issue when Header Status handler on I receive a "malformed syntax" error when I write a review.

 

Have you seen such a thing? The review posts... but I end of at server_error.php with the error;

 

0 Unknown Error:
This server incountered an unknown error due to malformed syntax

I'm using fwr url's and I've tested it both on and off... with the same result.

 

If I turn the header status handler off the review posts with no error.

 

Seems only to happen on BS... Works fine on my live 2.3.4 store.

Link to comment
Share on other sites

The error code is 0, which shouldn't be. Please make sure the "redirect to" setting is something like 

server_error.php?id=404

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

If you are having 500 error when you add the .htaccess code remove some  codes,

 

i so in my c panel, customizable errors

 

 

And o make the same in Jack´s code

 

  
#START Custom Server Error Pages
ErrorDocument 400 /server_error.php?id=400
ErrorDocument 401 /server_error.php?id=401
ErrorDocument 402 /server_error.php?id=402
ErrorDocument 403 /server_error.php?id=403
ErrorDocument 404 /server_error.php?id=404
ErrorDocument 405 /server_error.php?id=405
ErrorDocument 406 /server_error.php?id=406
ErrorDocument 407 /server_error.php?id=407
ErrorDocument 408 /server_error.php?id=408
ErrorDocument 409 /server_error.php?id=409
ErrorDocument 410 /server_error.php?id=410
ErrorDocument 411 /server_error.php?id=411
ErrorDocument 412 /server_error.php?id=412
ErrorDocument 413 /server_error.php?id=413
ErrorDocument 414 /server_error.php?id=414
ErrorDocument 415 /server_error.php?id=415
ErrorDocument 416 /server_error.php?id=416
ErrorDocument 417 /server_error.php?id=417
ErrorDocument 422 /server_error.php?id=422
ErrorDocument 423 /server_error.php?id=423
ErrorDocument 424 /server_error.php?id=424
ErrorDocument 500 /server_error.php?id=500
ErrorDocument 501 /server_error.php?id=501
ErrorDocument 502 /server_error.php?id=502
ErrorDocument 503 /server_error.php?id=503
ErrorDocument 504 /server_error.php?id=504
ErrorDocument 505 /server_error.php?id=505
ErrorDocument 506 /server_error.php?id=506
ErrorDocument 507 /server_error.php?id=507
ErrorDocument 510 /server_error.php?id=510
#END Custom Server Error Pages
 

 

it´s working fine for me

 

http://www.apopular.com.br/index.php

 

 

Thank you @@Jack_mcs you are the best person in oscommerce man, thanhks

Marcelo

São Paulo,Brazil

I did, helped or traslate.

http://addons.oscommerce.com/profile/104964

 

My english it´s só poor, but of you need help in portuguese, like shipping and payment that´s make a diference in brazil, come one,

Obrigado (thank´s)

 

Link to comment
Share on other sites

  • 2 months later...

The code that gets altered is the same in all versions of oscommerce. The instructions may not match the BS version exactly but I think what to change will be apparent.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

For 2.3.4 Bootstrap, the changed mentioned above in post# 62 for the includes/application_top.php file needs to be made otherwise it will take you to the 404 error page when a customer submits a review as well as if you click the reviews link for a product that has no reviews.

Link to comment
Share on other sites

  • 2 years later...

On my upgraded BS 2.3.4.1 version

I've lot's of errors on my google search console for URL's like this:

domain.com/product_info.php/products_id/82

I tried manually this URL and
which is then redirecting to

domain.com/product_info.php/products_id/server_error.php?id=404
and keeps refreshing this URL in an infinite loop.

Any ideas what might be wrong?

And also, should this not rewrite the URL to SEO friendly URL anyway, since product id 82 is a valid product with SEO URLs installed?

Link to comment
Share on other sites

This addon doesn't have anything to do with url rewriting. It looks like you have a problem with the rewriter you have installed. The format you see in google is one created when the seo friendly option is set in admin. But that setting is turned off automatically when either Ultimate SEO or SEO 5 is installed. If you are using some other rewriter, or if that setting is still on, try turning it off and see what happens.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 11 months later...

I use BS Edge, I added this exactly, including the change in post 62 above. Now, when I visit a link to a product that is no longer in stock, instead of the usual "product not found" page, I just get nothing, a blank white page.

When I turn this "off" in admin, I still just get a blank white page when visiting a link to an out of stock product. Up in the browser bar is the link to the product, it doiesn't redirect to anything, the page is just blank white.

Is this a javascript issue, or where do you think the problem would be?

Thanks in advance if anbyone has an answer they can share.

 

Link to comment
Share on other sites

I got this email after installing this contribution:

Pingdom DOWN alert:
uptime (*my website*) is down since 10/27/2018 04:23:36 PM.
Reason: HTTP Server Error 500 Internal Server Error

So I restored backups of the edited files in this contribution and instantly got my site back up....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...