Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

If no product is found - Redirect customer


Zuncan

Recommended Posts

Hi!

 

I have a tricky question. Lets say that a customers comes in to my store thru a link in some kinda forum. The link in that forum points directly to a product in my store. But if that product is removed from my store, the only thing the customer will see is a text saying "No product could be found". Isn't there a way to instantly redirect the customer to the first main page of the store, instead of displaying this dull meassage?

 

Would be more than greatful for a solution to this problem.

 

Be well / Zuncan

So what?! Who care in a hundred years anyway?

Link to comment
Share on other sites

Hi!

 

I have a tricky question. Lets say that a customers comes in to my store thru a link in some kinda forum. The link in that forum points directly to a product in my store. But if that product is removed from my store, the only thing the customer will see is a text saying "No product could be found". Isn't there a way to instantly redirect the customer to the first main page of the store, instead of displaying this dull meassage?

 

Would be more than greatful for a solution to this problem.

 

Be well / Zuncan

 

You can add

  if ($product_check['total'] < 1) {
  tep_redirect(tep_href_link(FILENAME_DEFAULT));
 }

just underneath

  $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);

and the customer will be redirected to your main page without intermediate screen.

Link to comment
Share on other sites

You can add

  if ($product_check['total'] < 1) {
  tep_redirect(tep_href_link(FILENAME_DEFAULT));
 }

just underneath

  $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);

and the customer will be redirected to your main page without intermediate screen.

 

What file is this query in?

 

Thanks,

 

Donna Gordon

Link to comment
Share on other sites

There is also a nice little contribution that puts

 

Item not found but...

 

Quote from the description

if we cannot find the product we check if it is still in the database and what category it belonged to.

If it is, we display the other products from that category using the product_listing module.

 

If it is really gone or never existed in the first place we mess a little with the given product_id and display

products with a variation on the number, a desperate move but we have little else to go on.

 

 

http://www.oscommerce.com/community/contributions,2821

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...