Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006
    Posts
    512
    Plugin Contributions
    0

    Default Display Cart After Adding Product based on Product Type?

    hello!

    I currently have "Display Cart After Adding Product set to false" in my admin. It works great, but I was wondering if it was at all possible have a different product type Display the Cart After Adding Product? while leaving the default false in the admin?


    or is there coding some work around for this?

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Display Cart After Adding Product based on Product Type?

    /includes/init_includes/init_cart_handler.php has this:
    Code:
      if (DISPLAY_CART == 'true') {
        $goto =  FILENAME_SHOPPING_CART;
        $parameters = array('action', 'cPath', 'products_id', 'pid', 'main_page');
      } else {
        $goto = $_GET['main_page'];
        if ($_GET['action'] == 'buy_now') {
          $parameters = array('action', 'products_id');
        } else {
          $parameters = array('action', 'pid', 'main_page');
        }
      }
    If you change it to the following, you can probably accomplish what you're after:
    Code:
      $prod_type = 0;
      $sql = "select products_type from " . TABLE_PRODUCTS . " where products_id = '" . (int)$_GET['products_id'] . "'";
      $zp_type = $db->Execute($sql);
      if ($zp_type->RecordCount() != 0) {
        $prod_type = $zp_type->fields['products_type'];
      }
      if (DISPLAY_CART == 'true' || in_array($prod_type, array(1, 2, 3))) {
        $goto =  FILENAME_SHOPPING_CART;
        $parameters = array('action', 'cPath', 'products_id', 'pid', 'main_page');
      } else {
        $goto = $_GET['main_page'];
        if ($_GET['action'] == 'buy_now') {
          $parameters = array('action', 'products_id');
        } else {
          $parameters = array('action', 'pid', 'main_page');
        }
      }
    where 1,2,3 is a comma-separated list of product-type numbers for which you want it to go to the shopping cart even though the admin setting is set at false.
    Last edited by DrByte; 26 Jun 2008 at 06:53 AM. Reason: fix syntax error
    .

    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
    Nov 2006
    Posts
    512
    Plugin Contributions
    0

    Default Re: Display Cart After Adding Product based on Product Type?

    Works Perfectly!

    Thank you DrByte!

 

 

Similar Threads

  1. v139h Page not display after adding a product to the cart
    By versitek in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 9 Dec 2012, 03:45 AM
  2. Display Shopping Cart After Adding Product
    By Semenek in forum General Questions
    Replies: 1
    Last Post: 12 Sep 2010, 04:09 AM
  3. Shopping Cart wont display after adding product to cart
    By fmf_tactical in forum General Questions
    Replies: 2
    Last Post: 6 Mar 2009, 03:43 AM
  4. Display Cart After Adding Product with custom template
    By bazfr in forum Addon Templates
    Replies: 1
    Last Post: 3 Aug 2008, 04:31 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR