Zen Cart Logo
Forums / General Questions / Redirect on empty cart?

Redirect on empty cart?

Locked

Views: 1,018

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
1 Oct 2009, 10:32 AM
#1
riddler24a avatar

riddler24a

New Zenner

Join Date:
Oct 2006
Location:
UK
Posts:
14
Plugin Contributions:
0

Redirect on empty cart?

Hi,

what is the best way to redirect the page after someone empties their shopping cart?

At the moment if you clear your cart of all items, you get sent to a page with text saying:

"Your Shopping Cart is empty.

New Products for ...."

Is there a way to redirect to the home page when you empty your cart?

Regards
Alan

2 Oct 2009, 1:03 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Redirect on empty cart?

You could customize the shopping_Cart for this in the file:
/includes/modules/pages/shopping_cart/header_php.php

Change this:

// This should be first line of the script:
$zco_notifier->notify('NOTIFY_HEADER_START_SHOPPING_CART');

to read:

// This should be first line of the script:
$zco_notifier->notify('NOTIFY_HEADER_START_SHOPPING_CART');

// if there is nothing in the customers cart, redirect them from the shopping cart page to home page
  if ($_SESSION['cart']->count_contents() <= 0) {
    zen_redirect(zen_href_link(FILENAME_DEFAULT));
  }
2 Oct 2009, 9:04 AM
#3
riddler24a avatar

riddler24a

New Zenner

Join Date:
Oct 2006
Location:
UK
Posts:
14
Plugin Contributions:
0

Re: Redirect on empty cart?

Thanks, works a treat.

Regards
Alan