Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2007
    Posts
    7
    Plugin Contributions
    0

    Default Redirect if Shopping Cart is Empty

    Due to some customization issues, my product description pages sit outside of Zen Cart. I go into zen cart just at the point where the user chooses the product adds to their cart. All the products are in zen cart, just the description pages sit outside of it.

    If the user removes everything from their cart, I need to re-direct back to my non-Zen site.

    Is there a way to over-ride the action for an empty cart and just redirect to a static page outside of Zen Cart?

    I'm very familiar with PHP and MySQL.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Redirect if Shopping Cart is Empty

    Quote Originally Posted by robgnyc View Post

    Is there a way to over-ride the action for an empty cart and just redirect to a static page outside of Zen Cart?

    I'm very familiar with PHP and MySQL.
    Sure, just add a PHP header redirect in the /includes/modules/pages/shopping_cart/header_php.php if the $_SESSION['cart']->count_contents() is 0.
    .
    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default Re: Redirect if Shopping Cart is Empty

    If you don't mind me asking - What is it about your product descriptions that aren't possible from within Zen Cart?
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  4. #4
    Join Date
    Jul 2007
    Posts
    7
    Plugin Contributions
    0

    Default Re: Redirect if Shopping Cart is Empty

    Quote Originally Posted by Kim View Post
    If you don't mind me asking - What is it about your product descriptions that aren't possible from within Zen Cart?
    Well I have a 4 basic products (categories really) which can be mens or womens, can be one of three levels and each product has 7 different file formats as options. Each file format has between 3 and 6 downloadable files attached to it.

    The way I want it to display is to have a product summary that applies to every product and level and then a nice way of choosing which level, gender and file type you want.

    I'm sure it is possible within zen cart but being a relatively new user, I found it very difficult to figure out how to set up this type of product and I was fighting the system more than having it work for me. The matrix of attributes required for this type of thing was just too much.

    Handling much of the product stuff outside of the system and then jumping in only for the shopping cart functionality seemed a much better solution after a few days of banging my head against the wall. I combined this with some dynamic PHP/MySQL stuff to access the products database on my own and came up with a relatively effective solution that met the clients needs without eating too much of my time.

  5. #5
    Join Date
    Jul 2007
    Posts
    7
    Plugin Contributions
    0

    Default Re: Redirect if Shopping Cart is Empty

    Quote Originally Posted by DrByte View Post
    Sure, just add a PHP header redirect in the /includes/modules/pages/shopping_cart/header_php.php if the $_SESSION['cart']->count_contents() is 0.
    Thanks so much. That works perfectly.

  6. #6
    Join Date
    Oct 2007
    Posts
    16
    Plugin Contributions
    0

    Default Re: Redirect if Shopping Cart is Empty

    For those of us who aren't sure on what PHP to write to accomplish this...can you give an example? I'm currently facing the same issue.

    Perhaps somewhere around here in header_php.php?

    $flagHasCartContents = ($_SESSION['cart']->count_contents() > 0);

    Just not sure on how to go about the if then else here :-( Still learning.
    Last edited by smallarmsdealer; 13 Nov 2007 at 12:17 AM. Reason: Forgot to add code.

 

 

Similar Threads

  1. Replies: 1
    Last Post: 22 Dec 2014, 08:55 PM
  2. Replies: 5
    Last Post: 21 Apr 2013, 11:37 PM
  3. customizing: Empty cart and redirect back to products listing page
    By Nick1973 in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 20 Jun 2012, 06:13 PM
  4. Redirect on empty cart?
    By riddler24a in forum General Questions
    Replies: 2
    Last Post: 2 Oct 2009, 10:04 AM
  5. forgetting shopping cart contacts 'your shopping cart is empty'
    By vandiermen in forum Installing on a Linux/Unix Server
    Replies: 15
    Last Post: 28 Apr 2009, 11:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg