Forums / General Questions / empty cart, return to home page

empty cart, return to home page

Views: 600

Results 1 to 3 of 3
7 Dec 2011, 5:42 AM
#1
skylab001 avatar

skylab001

New Zenner

Join Date:
Jan 2008
Posts:
67
Plugin Contributions:
0

empty cart, return to home page

I would like to mod the system so that when a customer empties their cart on the shopping cart page, they will be automatically returned to the main index page of the site?

I assume it will require tweaking of the code in the tpl_shopping_cart_default.php somewhere around line 180?

I just have no idea how to implement a command for an auto return like that?

Anybody know this?

7 Dec 2011, 9:41 PM
#2
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: empty cart, return to home page

Better to go into includes/modules/pages/shopping_cart/header_php.php

Try this at about line 60 or so

$products = $_SESSION['cart']->get_products();

if(!count($products))
{
zen_redirect(zen_href_link('index', '', 'SSL'));
}

the first line already exists the rest just add underneath it. It will go to the home page whenever the cart is empty.

edit --------------------------
whoops - you don't need it to be SSL so just take that out. Sorry

zen_redirect(zen_href_link('index'));

Nick
iszent.com

8 Dec 2011, 1:26 AM
#3
skylab001 avatar

skylab001

New Zenner

Join Date:
Jan 2008
Posts:
67
Plugin Contributions:
0

Re: empty cart, return to home page

perfect! thanks!!