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

    Default programmatically excluding a shipping module, ref $_SESSION from admin

    Zen-Cart - v1.3.8a

    I have several flat rate shipping modules derived from flat.php. One of those must be excluded at checkout if the order total is $50 or more.

    I added the following code at line ~60.

    if ($_SESSION['cart']->show_total() > 49.99) {
    $this->enabled = false;
    }
    It works fine at checkout but any reference to the $_SESSION when the module is called from Admin/Shipping Modules causes the module to fail. If $_SESSION is referenced in anyway from Admin, even isset(), defined(), or function_exists(), the module failsand all remaining shipping items and the editing box to the right on that page fail to display.

    Given that my objective is to disable this shipping method if order amount is $50 or greater:

    1) Is there a way to reference the order total that will work from admin and the catalog?

    2) Is there a way to ignore the code block from just admin?

  2. #2
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default Re: programmatically excluding a shipping module, ref $_SESSION from admin

    You need to use a slightly different approach and edit the file a few lines further down. Leave the enable check as per the original.

    at line 78, edit this line:
    PHP Code:
          return $this->quotes
    to include your minimum cost check
    PHP Code:
    if ($_SESSION['cart']->show_total() > 49.99) {
    return 
    $this->quotes;
    } else {
    return 
    false;

    Neville
    An assumption is what you arrive at when you get tired of thinking...

  3. #3
    Join Date
    Nov 2006
    Posts
    44
    Plugin Contributions
    0

    Default Re: programmatically excluding a shipping module, ref $_SESSION from admin

    Worked great. Thanks!

 

 

Similar Threads

  1. v150 USPS shipping module...trying to restrict shipping options programmatically
    By ecclescake in forum Addon Shipping Modules
    Replies: 11
    Last Post: 13 Dec 2024, 05:24 AM
  2. Replies: 1
    Last Post: 19 Mar 2013, 01:58 AM
  3. Excluding a singal country from shipping
    By aikisho in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 27 Jan 2011, 01:45 AM
  4. Excluding certain CC brands in default CC module
    By ksolito in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 27 Feb 2008, 06:39 PM
  5. Excluding gift certs from order total for free shipping
    By KTNaturals in forum Built-in Shipping and Payment Modules
    Replies: 9
    Last Post: 18 Feb 2007, 03:49 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