Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / All The More Complicated...multiple shipping rules for various products

All The More Complicated...multiple shipping rules for various products

Views: 2,064

Results 1 to 20 of 21
15 Mar 2012, 12:08 AM
#1
webmistressm avatar

webmistressm

New Zenner

Join Date:
Jan 2010
Location:
SoCal
Posts:
47
Plugin Contributions:
0

All The More Complicated...multiple shipping rules for various products

Okay, I have a slightly complicated website when it comes to shipping. My big problem is the variety of conditions I need depending on 1) what zone the item is being shipped to and 2) how to deal with the possibility that a customer might buy items with different sets of shipping rules/pricing.

Category 1
Subcategory A
Subcategory B
.........
Category 2
Subcategory A
Subcategory B
.........
Category 3
Subcategory A
Subcategory B
.........

For items in Category 1 & 2 (and all subcategories) I need the following rule, which would be true no matter how many items in these categories were ordered (i.e. dont need the price added per item of this kind ordered):

Zone 1 (California): $0.00
Zone 2 (USA except California): $0.00
Zone 3 (Rest of World: $3.00

For items in Category 3, I need the following rules.

Zone 1 (California): $6.00/per Category 3 item ordered
Zone 2 (USA except California): $6.00/per Category 3 item ordered
Zone 3 (Rest of World: $18/per Category 3 item ordered

Again, in the case of Category 3, shipping charges would actually be dependant on how many of Category 3 items are sold. So, if someone ordered 1x Category 3 item, shipping would be $6. If they ordered 2 of them, $12...and so on.


Trust me, Im doing the best not to tear my mohawk out trying to get this to work but I gotta say, shipping modules are pretty weak in Zencart as compared to other methods.

I do know how to manually clone flat and table modules but Im just not sure how to do the above. HOw would shipping be calculated if someone out of country purchased from both types of categories? Would it add the $3.00 (flat, no matter how many items of this type are ordered) to the $18/per Category 3 item ordered? Or, would it just check the highest shipping charge (in this case, the $18/per item) and go with that? I'd much prefer it to perform the former over the latter.

15 Mar 2012, 1:11 PM
#2
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,872
Plugin Contributions:
7

Re: All The More Complicated...multiple shipping rules for various products

At the risk of repeating myself, Advanced Shipper should be able to do this.

15 Mar 2012, 3:50 PM
#3
webmistressm avatar

webmistressm

New Zenner

Join Date:
Jan 2010
Location:
SoCal
Posts:
47
Plugin Contributions:
0

Re: All The More Complicated...multiple shipping rules for various products

Thanks for the suggestion. However, one of the reasons I posted this in the "Built-In Shipping & Payment Modules" section of the forums is because a premium add-on is likely not within my client's budget, so I didnt want to waste the time of people who are only going to suggest paid modules. Rather, I hoped to use this forum section to reach the people that, like me, are on a budget due to clients or otherwise need to work with what they have.

15 Mar 2012, 4:23 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: All The More Complicated...multiple shipping rules for various products

You could clone the Item Rate item shipping module for each Zone that you need and create a Zone Definition for each ...

Then adapt the code:

    function quote($method = '') {
      global $order, $total_count;

      global $cart;
      $chk_cat1 = $_SESSION['cart']->in_cart_check('master_categories_id','1');
      $chk_cat2 = $_SESSION['cart']->in_cart_check('master_categories_id','2');
      $chk_cat3 = $_SESSION['cart']->in_cart_check('master_categories_id','3');

      $cat_charge = 0.00;
      $cat_charge += $chk_cat1 * 0.00;
      $cat_charge += $chk_cat2 * 0.00;
      $cat_charge += $chk_cat3 * 6.00;

      // adjusted count for free shipping
      $item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();

      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                     'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
                                                     'cost' => ($cat_charge) + MODULE_SHIPPING_ITEM_HANDLING)));

      if ($this->tax_class > 0) {
15 Mar 2012, 4:52 PM
#5
webmistressm avatar

webmistressm

New Zenner

Join Date:
Jan 2010
Location:
SoCal
Posts:
47
Plugin Contributions:
0

Re: All The More Complicated...multiple shipping rules for various products

Re:

$cat_charge = 0.00;
      $cat_charge += $chk_cat1 * 0.00;
      $cat_charge += $chk_cat2 * 0.00;
      $cat_charge += $chk_cat3 * 6.00;

So, basically, you are saying in case of my 3rd category (which requires shipping costs to be added on as they buy multiple quantities from this Category 3), I just set Category 1 and 2 with a $0 amount (0.00 as seen in your example code above) for all the categories that DO NOT need per item calculations (seems that Categories 1 and 2 are gonna need a flat clone), with 6.00 being used for chk_cat3 since that pertains to Category 3's database ID?

From your example, it looks like you wrote your example code to cover items purchased from categories in my shop that have an ID (how do I find the ID #s?) corresponding to top Categories 1, 2 or 3.... . Does this cover sub categories within the "top" category (in this case Category 1, Category 2 or Category 3)?

Incidentally, I assume even for Category 1 & 2, a clone of flat would be needed (as I am sure you really shouldnt alter/edit the original flat.php files)

Incidentally, for anyone else who may come across the page and is using 1.5...here is the code of item.php in /includes/modules/shipping/

<?php
/**
 * @package shippingMethod
 * @copyright Copyright 2003-2009 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: item.php 14498 2009-10-01 20:16:16Z ajeh $
 */


  class item {
    var $code, $title, $description, $icon, $enabled;

// class constructor
    function item() {
      global $order, $db;

      $this->code = 'item';
      $this->title = MODULE_SHIPPING_ITEM_TEXT_TITLE;
      $this->description = MODULE_SHIPPING_ITEM_TEXT_DESCRIPTION;
      $this->sort_order = MODULE_SHIPPING_ITEM_SORT_ORDER;
      $this->icon = '';
      $this->tax_class = MODULE_SHIPPING_ITEM_TAX_CLASS;
      $this->tax_basis = MODULE_SHIPPING_ITEM_TAX_BASIS;

      // disable only when entire cart is free shipping
      if (zen_get_shipping_enabled($this->code)) {
        $this->enabled = ((MODULE_SHIPPING_ITEM_STATUS == 'True') ? true : false);
      }

      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_ITEM_ZONE > 0) ) {
        $check_flag = false;
        $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_ITEM_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
        while (!$check->EOF) {
          if ($check->fields['zone_id'] < 1) {
            $check_flag = true;
            break;
          } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
            $check_flag = true;
            break;
          }
		  $check->MoveNext();
        }

        if ($check_flag == false) {
          $this->enabled = false;
        }
      }
    }

// class methods
    function quote($method = '') {
      global $order, $total_count;

      // adjusted count for free shipping
      $item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();
      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                     'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
                                                     'cost' => (MODULE_SHIPPING_ITEM_COST * $item_total_count) + MODULE_SHIPPING_ITEM_HANDLING)));

      if ($this->tax_class > 0) {
        $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
      }

      if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);

      return $this->quotes;
    }

    function check() {
      global $db;
      if (!isset($this->_check)) {
        $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_ITEM_STATUS'");
        $this->_check = $check_query->RecordCount();
      }
      return $this->_check;
    }

    function install() {
      global $db;
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Item Shipping', 'MODULE_SHIPPING_ITEM_STATUS', 'True', 'Do you want to offer per item rate shipping?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Cost', 'MODULE_SHIPPING_ITEM_COST', '2.50', 'The shipping cost will be multiplied by the number of items in an order that uses this shipping method.', '6', '0', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_ITEM_HANDLING', '0', 'Handling fee for this shipping method.', '6', '0', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_ITEM_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_ITEM_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_ITEM_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_ITEM_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
    }

    function remove() {
      global $db;
      $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE\_SHIPPING\_ITEM\_%'");
    }

    function keys() {
      return array('MODULE_SHIPPING_ITEM_STATUS', 'MODULE_SHIPPING_ITEM_COST', 'MODULE_SHIPPING_ITEM_HANDLING', 'MODULE_SHIPPING_ITEM_TAX_CLASS', 'MODULE_SHIPPING_ITEM_TAX_BASIS', 'MODULE_SHIPPING_ITEM_ZONE', 'MODULE_SHIPPING_ITEM_SORT_ORDER');
    }
  }
?>

I assume that the part which you highlighted in red MUST BE PUT IN THE RIGHT PLACE within the document?

  function quote($method = '') {
      global $order, $total_count;

      global $cart;
      $chk_cat1 = $_SESSION['cart']->in_cart_check('master_categories_id','1');
      $chk_cat2 = $_SESSION['cart']->in_cart_check('master_categories_id','2');
      $chk_cat3 = $_SESSION['cart']->in_cart_check('master_categories_id','3');

      $cat_charge = 0.00;
      $cat_charge += $chk_cat1 * 0.00;
      $cat_charge += $chk_cat2 * 0.00;
      $cat_charge += $chk_cat3 * 6.00;

      // adjusted count for free shipping
      $item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();

      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                     'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
                                                     'cost' => ($cat_charge) + MODULE_SHIPPING_ITEM_HANDLING)));

      if ($this->tax_class > 0) {
15 Mar 2012, 5:15 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: All The More Complicated...multiple shipping rules for various products

You need to look at the immediate Category that the Product belongs to and use that ID ...

You can add on more Categories if needed such as say the Category for the Category 3 really has 4 subcategories that hold the products using categories_id 10, 12, 15 and 22 as the master_categories_id of the products ...

      $chk_cat3 += $_SESSION['cart']->in_cart_check('master_categories_id','10');
      $chk_cat3 += $_SESSION['cart']->in_cart_check('master_categories_id','12');
      $chk_cat3 += $_SESSION['cart']->in_cart_check('master_categories_id','15');
      $chk_cat3 += $_SESSION['cart']->in_cart_check('master_categories_id','22');

I picked Item Rate item but you could clone Flate Rate or what ever is easier for you ...

The code does have to be put in the right place, as in the example ...

15 Mar 2012, 5:30 PM
#7
webmistressm avatar

webmistressm

New Zenner

Join Date:
Jan 2010
Location:
SoCal
Posts:
47
Plugin Contributions:
0

Re: All The More Complicated...multiple shipping rules for various products

Im curious on the flat rate thing.... does it work on "per item in shopping cart" by default or is flat rate more for the situation I have with category 1 and 2 where the price is $3.00 no matter if they order 4 items from that category, 18 items of that category, or 100 items of that category?

Ajeh:

You need to look at the immediate Category that the Product belongs to and use that ID ...

Yeah. I think the terminology of "master" categories is what tripped me up. When I think of "master categories" I think of "top categories".

(warning: redundancy warning for the advanced Zencarters)
One thing I always noticed about Zen Cart is, that if you create a top category and then click into it... at that point you have 2 choices:

  1. Create an item in this top category. If you do this, you cannot create sub categories along side it
    Top Category 1
  • Item 1
  • Item 2
  • Item 3

OR...............

  1. Create a sub-category in this top category. If you do this, you cannot create items within the top category itself.

Top Category 1

  • Sub Category 1

  • Sub Category 2

  • Sub Category 3

Ajeh:

I picked Item Rate item but you could clone Flate Rate or what ever is easier for you ...

The code does have to be put in the right place, as in the example ...

Thanks for the clarification. PHP has a nasty habit of freaking out over one misplaced semi-colon so I figured that order is important.

Now, when I get this "per item" clone into Zencart and go to the shipping module section within the backend (Modules>Shipping), and click on the out-of-box per item module, I notice that an amount is given under "Shipping Cost". What would be the amount I would set here in case of my Category 3 example? In the attached image, you will see it got set to 2.50

WebmistressM:

For items in Category 3, I need the following rules.

Zone 1 (California): $6.00/per Category 3 item ordered
Zone 2 (USA except California): $6.00/per Category 3 item ordered
Zone 3 (Rest of World: $18/per Category 3 item ordered

15 Mar 2012, 5:46 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: All The More Complicated...multiple shipping rules for various products

It does not matter what you set the rate to as you are calculating your own rates based on your numbers in each of the master_categories_id ...

For example, to know how many items are in the cart for master_categories_id 12, this gets that number:
$_SESSION['cart']->in_cart_check('master_categories_id','12')

By building the counts, you can then multiply that by the rate you want to charge so if you need to get the number of items in categories_id 10, 12, 15, 22 that is what this code does:

      $chk_cat3 += $_SESSION['cart']->in_cart_check('master_categories_id','10');
      $chk_cat3 += $_SESSION['cart']->in_cart_check('master_categories_id','12');
      $chk_cat3 += $_SESSION['cart']->in_cart_check('master_categories_id','15');
      $chk_cat3 += $_SESSION['cart']->in_cart_check('master_categories_id','22');

it adds the count to the variable:
$chk_cat3

15 Mar 2012, 5:50 PM
#9
webmistressm avatar

webmistressm

New Zenner

Join Date:
Jan 2010
Location:
SoCal
Posts:
47
Plugin Contributions:
0

Re: All The More Complicated...multiple shipping rules for various products

Ajeh:

It does not matter what you set the rate to as you are calculating your own rates based on your numbers in each of the master_categories_id ...

For example, to know how many items are in the cart for master_categories_id 12, this gets that number:
$_SESSION['cart']->in_cart_check('master_categories_id','12')

By building the counts, you can then multiply that by the rate you want to charge so if you need to get the number of items in categories_id 10, 12, 15, 22 that is what this code does:

  $chk_cat3 += $_SESSION['cart']->in_cart_check('master_categories_id','10');
  $chk_cat3 += $_SESSION['cart']->in_cart_check('master_categories_id','12');
  $chk_cat3 += $_SESSION['cart']->in_cart_check('master_categories_id','15');
  $chk_cat3 += $_SESSION['cart']->in_cart_check('master_categories_id','22');
> 
> it adds the count to the variable:
> $chk_cat3

So with the code we put in for by-category calculations, you are saying that the "Shipping Cost" in the admin backend is completely ignored?
15 Mar 2012, 5:52 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: All The More Complicated...multiple shipping rules for various products

That is correct as you are now using for the cost the calculated variable:
$cat_charge

in the code:

      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                     'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
                                                     'cost' => ($cat_charge) + MODULE_SHIPPING_ITEM_HANDLING)));
15 Mar 2012, 6:04 PM
#11
webmistressm avatar

webmistressm

New Zenner

Join Date:
Jan 2010
Location:
SoCal
Posts:
47
Plugin Contributions:
0

Re: All The More Complicated...multiple shipping rules for various products

Great! So if it sees this code we added ABOVE " // adjusted count for free shipping" it loads that first and ignores the // adjusted count for free shipping commands/functions. Nice!

You mentioned I would have to do a peritem module for each of my 3 zones. Is that because I have the modules backend only lets you specify ONE zone in the Shipping Zone Drop down (seen in my earlier screen cap, right above "Sort Order"), rather than allowing for multiple zones to apply to that specific module? I have noticed this kind of thing is prevalent in Zen Cart and I am wondering if that is why the shipping and tax rate settings in Zencart seem so convoluted to me.


For Flat rate, would it be better for me to clone the original flat.php modules. Im still unsure if flat rate works on per item or not.

For example, if I use the default flat.php module, will it calculate that flat rate price PER item (I buy 3 items that have flat rate on them and so it goes $6.00 * 3)? Or will it just apply $6 no matter how many flat rate designated items are in the cart?

Since 90% of my store has items that fit this "3.00 shipping no matter how many items are ordered" do I need to do a master_category specified in my modified flat.php? If so, will I need to do it for each zone?

15 Mar 2012, 6:12 PM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: All The More Complicated...multiple shipping rules for various products

You can clone either Flat Rate flat or Item Rate item as you are "building your own calculations" for the shipping and it doesn't really matter which one you use ...

You need one shipping module for each Zone Definition that you want to use and add the Zone Definition to each of the modules to control which one works with whatever calculation you need for the shipping chargers ...

Since 90% of my store has items that fit this "3.00 shipping no matter how many items are ordered" do I need to do a master_category specified in my modified flat.php? If so, will I need to do it for each zone?

If you just care if 1 or more items from what ever categories are the 3.00 shipping no mater what, then you would just set the charge to that amount ...

15 Mar 2012, 6:18 PM
#13
webmistressm avatar

webmistressm

New Zenner

Join Date:
Jan 2010
Location:
SoCal
Posts:
47
Plugin Contributions:
0

Re: All The More Complicated...multiple shipping rules for various products

Ajeh:

You can clone either Flat Rate flat or Item Rate item as you are "building your own calculations" for the shipping and it doesn't really matter which one you use ...

What are the subtle differences between cloning flat rate or cloning item rate modules? Im a bit confused by the below quoted statement about "set the charge to that amount" .

Ajeh:

If you just care if 1 or more items from what ever categories are the 3.00 shipping no mater what, then you would just set the charge to that amount ...

15 Mar 2012, 6:25 PM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: All The More Complicated...multiple shipping rules for various products

The goal is to get the variable:
$cat_charge

to be the amount to charge for shipping ...

      $chk_cat3 += $_SESSION['cart']->in_cart_check('master_categories_id','10');

means to add to the variable the total number of items in the cart from the master_categories_id 10 ...

      $chk_cat3 += $_SESSION['cart']->in_cart_check('master_categories_id','12');

means to add the variable the total number of items in the cart from the master_categories_id 12 ...

Now, how much do you want to charge based on the:
$chk_cat3

If you just want to charge 3.00 if $chk_cat3 >= then you can us:

if ($chk_cat3 >= 1) {
  $cat_charge += 3.00;
}

If you want to charge 6.00 per item for $chk_cat3 then use:

$cat_charge += 6.00 * $chk_cat3;

You need to determine what charges to charge based on the results of calculations ...

15 Mar 2012, 6:30 PM
#15
webmistressm avatar

webmistressm

New Zenner

Join Date:
Jan 2010
Location:
SoCal
Posts:
47
Plugin Contributions:
0

Re: All The More Complicated...multiple shipping rules for various products

Ajeh:

The goal is to get the variable:
$cat_charge

to be the amount to charge for shipping ...

  $chk_cat3 += $_SESSION['cart']->in_cart_check('master_categories_id','10');
> 
> means to add to the variable the total number of items in the cart from the master_categories_id 10 ...
> 
> ```
      $chk_cat3 += $_SESSION['cart']->in_cart_check('master_categories_id','12');

means to add the variable the total number of items in the cart from the master_categories_id 12 ...

Now, how much do you want to charge based on the:
$chk_cat3

If you just want to charge 3.00 if $chk_cat3 >= then you can us:

if ($chk_cat3 >= 1) {
$cat_charge += 3.00;
}

> 
> If you want to charge 6.00 per item for $chk_cat3 then use:
> ```
$cat_charge += 6.00 * $chk_cat3;

You need to determine what charges to charge based on the results of calculations ...

So in the case of cloning the flat rate module, I assume Id only need to clone it 3 times, even though 2 of the 3 zones I have set up give FREE shipping, with the third zone being the only one that charges $3.00 shipping NO MATTER HOW MANY OF THAT ITEM ARE IN THE SHOPPING CART.

So, where would we put the code you specified within a flat.php clone?

<?php
/**
 * @package shippingMethod
 * @copyright Copyright 2003-2009 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 */
// $Id: flat.php 14498 2009-10-01 20:16:16Z ajeh $
//

  class flat {
    var $code, $title, $description, $icon, $enabled;

// class constructor
    function flat() {
      global $order, $db;

      $this->code = 'flat';
      $this->title = MODULE_SHIPPING_FLAT_TEXT_TITLE;
      $this->description = MODULE_SHIPPING_FLAT_TEXT_DESCRIPTION;
      $this->sort_order = MODULE_SHIPPING_FLAT_SORT_ORDER;
      $this->icon = '';
      $this->tax_class = MODULE_SHIPPING_FLAT_TAX_CLASS;
      $this->tax_basis = MODULE_SHIPPING_FLAT_TAX_BASIS;

      // disable only when entire cart is free shipping
      if (zen_get_shipping_enabled($this->code)) {
        $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
      }

      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {
        $check_flag = false;
        $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FLAT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
        while (!$check->EOF) {
          if ($check->fields['zone_id'] < 1) {
            $check_flag = true;
            break;
          } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
            $check_flag = true;
            break;
          }
          $check->MoveNext();
        }

        if ($check_flag == false) {
          $this->enabled = false;
        }
      }
    }

// class methods
    function quote($method = '') {
      global $order;

      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                     'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
                                                     'cost' => MODULE_SHIPPING_FLAT_COST)));
      if ($this->tax_class > 0) {
        $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
      }

      if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);

      return $this->quotes;
    }

    function check() {
      global $db;
      if (!isset($this->_check)) {
        $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FLAT_STATUS'");
        $this->_check = $check_query->RecordCount();
      }
      return $this->_check;
    }

    function install() {
      global $db;
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Flat Shipping', 'MODULE_SHIPPING_FLAT_STATUS', 'True', 'Do you want to offer flat rate shipping?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Cost', 'MODULE_SHIPPING_FLAT_COST', '5.00', 'The shipping cost for all orders using this shipping method.', '6', '0', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_FLAT_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_FLAT_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_FLAT_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_FLAT_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
    }

    function remove() {
      global $db;
      $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE\_SHIPPING\_FLAT\_%'");
    }

    function keys() {
      return array('MODULE_SHIPPING_FLAT_STATUS', 'MODULE_SHIPPING_FLAT_COST', 'MODULE_SHIPPING_FLAT_TAX_CLASS', 'MODULE_SHIPPING_FLAT_TAX_BASIS', 'MODULE_SHIPPING_FLAT_ZONE', 'MODULE_SHIPPING_FLAT_SORT_ORDER');
    }
  }
?>
15 Mar 2012, 6:37 PM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: All The More Complicated...multiple shipping rules for various products

This is the function you are customizing regardless of what shipping module you are using:

// class methods
    function quote($method = '') {
      global $order;

      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                     'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
                                                     'cost' => MODULE_SHIPPING_FLAT_COST)));
      if ($this->tax_class > 0) {
        $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
      }

      if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);

      return $this->quotes;
    }

So if you want to use Flat Rate flat as your model, then you adjust the code to fit that shipping module ...

The line in RED has to hold the new calculation for the shipping cost ... something like:

                                                 'cost' => $cat_charge)));

as you will be building the shipping cost into:
$cat_charge

15 Mar 2012, 6:42 PM
#17
webmistressm avatar

webmistressm

New Zenner

Join Date:
Jan 2010
Location:
SoCal
Posts:
47
Plugin Contributions:
0

Re: All The More Complicated...multiple shipping rules for various products

Wow.... that means Im building 6 clones today (3 for the flat price shipping of $3.00 no matter the amount of items... and 3 for the per item calculations)

Hmm..... this seems like its much better than my original solution of using Tax Rates to apply the strict rules rather than using master_category to do the same thing by product category

15 Mar 2012, 6:54 PM
#18
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: All The More Complicated...multiple shipping rules for various products

No not really ...

You need 3 Clones ... 1 for each Zone Definition that you want:
California
US except California
Rest of the World

Then you need to build your calculations for each of these Cloned shipping modules for how you want the calculations to work ...

I gave you multiple ways to determine how many Products are in the cart from multiple categories by storing them to 3 variables to do your calculations with ...

You say you have a Category or Categories for:
California: $0.00
California: $6.00/per Category 3 item ordered

So I made a variable to count how many Products are in the cart using:
$chk_cat1
$chk_cat2
$chk_cat3

Then, you need to determine how much to charge based on the results ...

It looks like your California clone would use:
$cat_charge += $chk_cat1 * 0.00; // no charge
$cat_charge += $chk_cat2 * 0.00; // no charge
$cat_charge += $chk_cat3 * 6.00; // $6.00 per item

You need to think over what you are trying to do for each of the Zones ...

Think about 1 Zone at a time and don't think about the others ...

What do you want to do with California shipping?

What Categories get what charge?

If this gets too complicated for you to write the code, then perhaps you should look into the Advanced Shipper by ceon ...

Meanwhile I have to go work now so take things slow and try to work through the calculations that you need to get your shipping charges ...

15 Mar 2012, 7:01 PM
#19
webmistressm avatar

webmistressm

New Zenner

Join Date:
Jan 2010
Location:
SoCal
Posts:
47
Plugin Contributions:
0

Re: All The More Complicated...multiple shipping rules for various products

Ajeh:

No not really ...

You need 3 Clones ... 1 for each Zone Definition that you want:
California
US except California
Rest of the World

Yeah. that is what I meant. For any shipping rule I have to set up (flat, per item, etc..) I have to make 3 copies of it since I have 3 zones to deal with.

So for the items that need a clone of flat.php, I need to make 3 (one for USA, one for California, One for Rest of the World)

And for the item categories which need shipping calculated per item, I need 3 as well (1 for each of the aforementioned zones)

15 Mar 2012, 10:02 PM
#20
webmistressm avatar

webmistressm

New Zenner

Join Date:
Jan 2010
Location:
SoCal
Posts:
47
Plugin Contributions:
0

Re: All The More Complicated...multiple shipping rules for various products

Ajeh:

Then adapt the code:

function quote($method = '') {
  global $order, $total_count;

global $cart;
$chk_cat1 = $_SESSION['cart']->in_cart_check('master_categories_id','1');
$chk_cat2 = $_SESSION['cart']->in_cart_check('master_categories_id','2');
$chk_cat3 = $_SESSION['cart']->in_cart_check('master_categories_id','3');

  $cat_charge = 0.00;
  $cat_charge += $chk_cat1 * 0.00;
  $cat_charge += $chk_cat2 * 0.00;
  $cat_charge += $chk_cat3 * 6.00;


// adjusted count for free shipping
$item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();

  $this->quotes = array('id' => $this->code,
                        'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
                        'methods' => array(array('id' => $this->code,
                                                 'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
                                                 'cost' => ($cat_charge) + MODULE_SHIPPING_ITEM_HANDLING)));

  if ($this->tax_class > 0) {

Okay... so far, I cant get my items within category 66 to work:

Here is what I have for includes/modules/shipping/itempershoesusa.php:

<?php /** * @package shippingMethod * @copyright Copyright 2003-2009 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: itempershoesusa.php 14498 2009-10-01 20:16:16Z ajeh $ */ class itempershoesusa { var $code, $title, $description, $icon, $enabled; // class constructor function itempershoesusa() { global $order, $db; $this->code = 'itempershoesusa'; $this->title = MODULE_SHIPPING_ITEMPERSHOESUSA_TEXT_TITLE; $this->description = MODULE_SHIPPING_ITEMPERSHOESUSA_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_ITEMPERSHOESUSA_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_ITEMPERSHOESUSA_TAX_CLASS; $this->tax_basis = MODULE_SHIPPING_ITEMPERSHOESUSA_TAX_BASIS; // disable only when entire cart is free shipping if (zen_get_shipping_enabled($this->code)) { $this->enabled = ((MODULE_SHIPPING_ITEMPERSHOESUSA_STATUS == 'True') ? true : false); } if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_ITEMPERSHOESUSA_ZONE > 0) ) { $check_flag = false; $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_ITEMPERSHOESUSA_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while (!$check->EOF) { if ($check->fields['zone_id'] < 1) { $check_flag = true; break; } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } $check->MoveNext(); } if ($check_flag == false) { $this->enabled = false; } } } // class methods function quote($method = '') { global $order, $total_count; global $cart; $chk_cat1 = $_SESSION['cart']->in_cart_check('master_categories_id','66'); $cat_charge = 0.00; $cat_charge = $chk_cat1 * 6.00; // adjusted count for free shipping $itempershoesusa_total_count = $total_count - $_SESSION['cart']->free_shipping_itempershoesusas(); $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ITEMPERSHOESUSA_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_ITEMPERSHOESUSA_TEXT_WAY, 'cost' => (MODULE_SHIPPING_ITEMPERSHOESUSA_COST * $itempershoesusa_total_count) + MODULE_SHIPPING_ITEMPERSHOESUSA_HANDLING))); if ($this->tax_class > 0) { $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title); return $this->quotes; } function check() { global $db; if (!isset($this->_check)) { $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_ITEMPERSHOESUSA_STATUS'"); $this->_check = $check_query->RecordCount(); } return $this->_check; } function install() { global $db; $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Item Shipping', 'MODULE_SHIPPING_ITEMPERSHOESUSA_STATUS', 'True', 'Do you want to offer per itempershoesusa rate shipping?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Cost', 'MODULE_SHIPPING_ITEMPERSHOESUSA_COST', '2.50', 'The shipping cost will be multiplied by the number of itempershoesusas in an order that uses this shipping method.', '6', '0', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_ITEMPERSHOESUSA_HANDLING', '0', 'Handling fee for this shipping method.', '6', '0', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_ITEMPERSHOESUSA_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_ITEMPERSHOESUSA_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_ITEMPERSHOESUSA_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_ITEMPERSHOESUSA_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())"); } function remove() { global $db; $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE\_SHIPPING\_ITEMPERSHOESUSA\_%'"); } function keys() { return array('MODULE_SHIPPING_ITEMPERSHOESUSA_STATUS', 'MODULE_SHIPPING_ITEMPERSHOESUSA_COST', 'MODULE_SHIPPING_ITEMPERSHOESUSA_HANDLING', 'MODULE_SHIPPING_ITEMPERSHOESUSA_TAX_CLASS', 'MODULE_SHIPPING_ITEMPERSHOESUSA_TAX_BASIS', 'MODULE_SHIPPING_ITEMPERSHOESUSA_ZONE', 'MODULE_SHIPPING_ITEMPERSHOESUSA_SORT_ORDER'); } } ?>
Here is what I have for includes/modules/shipping/itempershoesca.php:
<?php /** * @package shippingMethod * @copyright Copyright 2003-2009 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: itempershoesca.php 14498 2009-10-01 20:16:16Z ajeh $ */ class itempershoesca { var $code, $title, $description, $icon, $enabled; // class constructor function itempershoesca() { global $order, $db; $this->code = 'itempershoesca'; $this->title = MODULE_SHIPPING_ITEMPERSHOESCA_TEXT_TITLE; $this->description = MODULE_SHIPPING_ITEMPERSHOESCA_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_ITEMPERSHOESCA_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_ITEMPERSHOESCA_TAX_CLASS; $this->tax_basis = MODULE_SHIPPING_ITEMPERSHOESCA_TAX_BASIS; // disable only when entire cart is free shipping if (zen_get_shipping_enabled($this->code)) { $this->enabled = ((MODULE_SHIPPING_ITEMPERSHOESCA_STATUS == 'True') ? true : false); } if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_ITEMPERSHOESCA_ZONE > 0) ) { $check_flag = false; $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_ITEMPERSHOESCA_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while (!$check->EOF) { if ($check->fields['zone_id'] < 1) { $check_flag = true; break; } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } $check->MoveNext(); } if ($check_flag == false) { $this->enabled = false; } } } // class methods function quote($method = '') { global $order, $total_count; global $cart; $chk_cat1 = $_SESSION['cart']->in_cart_check('master_categories_id','66'); $cat_charge = 0.00; $cat_charge += $chk_cat1 * 6.00; // adjusted count for free shipping $itempershoesca_total_count = $total_count - $_SESSION['cart']->free_shipping_itempershoescas(); $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ITEMPERSHOESCA_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_ITEMPERSHOESCA_TEXT_WAY, 'cost' => (MODULE_SHIPPING_ITEMPERSHOESCA_COST * $itempershoesca_total_count) + MODULE_SHIPPING_ITEMPERSHOESCA_HANDLING))); if ($this->tax_class > 0) { $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title); return $this->quotes; } function check() { global $db; if (!isset($this->_check)) { $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_ITEMPERSHOESCA_STATUS'"); $this->_check = $check_query->RecordCount(); } return $this->_check; } function install() { global $db; $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Item Shipping', 'MODULE_SHIPPING_ITEMPERSHOESCA_STATUS', 'True', 'Do you want to offer per itempershoesca rate shipping?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Cost', 'MODULE_SHIPPING_ITEMPERSHOESCA_COST', '2.50', 'The shipping cost will be multiplied by the number of itempershoescas in an order that uses this shipping method.', '6', '0', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_ITEMPERSHOESCA_HANDLING', '0', 'Handling fee for this shipping method.', '6', '0', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_ITEMPERSHOESCA_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_ITEMPERSHOESCA_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_ITEMPERSHOESCA_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_ITEMPERSHOESCA_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())"); } function remove() { global $db; $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE\_SHIPPING\_ITEMPERSHOESCA\_%'"); } function keys() { return array('MODULE_SHIPPING_ITEMPERSHOESCA_STATUS', 'MODULE_SHIPPING_ITEMPERSHOESCA_COST', 'MODULE_SHIPPING_ITEMPERSHOESCA_HANDLING', 'MODULE_SHIPPING_ITEMPERSHOESCA_TAX_CLASS', 'MODULE_SHIPPING_ITEMPERSHOESCA_TAX_BASIS', 'MODULE_SHIPPING_ITEMPERSHOESCA_ZONE', 'MODULE_SHIPPING_ITEMPERSHOESCA_SORT_ORDER'); } } ?>