Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2009
    Posts
    10
    Plugin Contributions
    0

    Default Shopping Cart: loop through products to turn off Flat Rate shipping for certain prods

    Using ZenCart for selling tickets to events. I am creating a mod that will turn off the flat rate shipping module if an event is within 7 days of current date (I have a new column in products_description that holds the event date).

    I am having a problem writing the loop in my function. Where are the shopping cart product ids kept? Or put another way how do I access the items in the shopping cart - $cart is a global var but I cannot fund docs on it.

    Any help getting the products_id out of the shopping cart from within a loop would be great.

  2. #2
    Join Date
    Nov 2009
    Posts
    10
    Plugin Contributions
    0

    Default Re: Shopping Cart: loop through products to turn off Flat Rate shipping for certain p

    I may not have been clear in my previous post but I am stuck on this. Here is the code I am trying to get going.

    Code:
    function flat_option_valid() {
        global $order, $db;
        // for admin always true if installed
        if (strstr($PHP_SELF, FILENAME_MODULES)) {
          return true;
        }
       $products = $_SESSION['cart']->get_products();
       $check_flag = true;
        for ($i=0, $n=sizeof($products); $i<$n; $i++) {
    	if ($products[$i]['STS_WillCallOnly'] == 1) {
    		$check_flag = false;
    		break;
    	}
        }   
        return $check_flag;
      }
    I have a new column called STS_WillCallOnly in product_description. I added that column to the get_products() function but cannot get the value in the loop.

    This function simply returns false if product in the cart has this flag set to true.

    I have tried getting $products[$i]['id'] but that does not bring back anything. The loop works - I go through once for each item in the shopping cart so I beleive I am on the right track.

  3. #3
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Shopping Cart: loop through products to turn off Flat Rate shipping for certain p

    Where did you add your information in the shopping_cart class?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. v151 Shopping cart is empty...turn off "New products for..."
    By doooomed in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 26 Feb 2013, 08:48 PM
  2. Flat Rate Shipping doesn't update to shopping cart
    By mrbandit in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 8 Apr 2011, 06:54 PM
  3. Flat rate shipping only for certain products
    By commdiver in forum Built-in Shipping and Payment Modules
    Replies: 12
    Last Post: 13 Mar 2011, 02:08 PM
  4. USPS and Disabling Flat Rate for Certain Products
    By accension in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 27 Mar 2008, 08:12 PM
  5. Flat rate, then another flat rate for certain heavy products?
    By JohneeMac in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 27 Mar 2007, 07:37 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR