Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006
    Posts
    514
    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
    58,283
    Blog Entries
    3
    Plugin Contributions
    106

    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!
    Donations always welcome: www.zen-cart.com/donate

    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
    514
    Plugin Contributions
    0

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

    Works Perfectly!

    Thank you DrByte!

 

 

Similar Threads

  1. display conditional terms from product type in cart?
    By jayenne in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 1 Aug 2007, 10:31 AM
  2. shipping cost based on product type?
    By shopper1 in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 19 Jul 2006, 07:14 PM

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
  •