Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

redirect if shopping_cart is empty?


Dennis_gull

Recommended Posts

Hello, im trying to redirect the customer back to the main page if the shopping cart is empty (but only if the customer is on the shopping_cart.php page of course). So I placed this code in shopping_cart.php:

 

 tep_redirect(tep_href_link(FILENAME_DEFAULT));

 

But I just get an error saying:

Warning: Cannot modify header information - headers already sent by (output started at ....

 

So I thought I would try to write the code in application_top.php and it looked like this:

if  (basename ($PHP_SELF,".php") != 'shopping_cart') {
 if ($cart->count_contents() < 1) {
  tep_redirect(tep_href_link(FILENAME_DEFAULT));
 }
 }

 

But nothing happens if I do it that way, what could I do to solve this issue?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...