If this is your first visit, check our documentation. To post, register or login.
Forums / Built-in Shipping and Payment Modules / Different shipping methods for different categories

Different shipping methods for different categories

Started by tylerd213 on 13 Mar 2008, 2:16 AM · Views: 107,884

Results 261 to 280 of 554
13 Sep 2010, 7:45 AM
#261
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Different shipping methods for different categories

raptor_55:

I sell computer parts online and for most people a box of parts to a postcode is a certain price that ozpost is working out but then other things like a computer case ordered with a monitor it is saying it is the same postage

Although there are times when multiple items won't affect the shipping cost, this doesn't sound like one of them.

raptor_55:

as if just the monitor when it is costing me double as two packages will need to be sent?

The ozpost module will combine the weights and dimensions of all items in the cart and produce a quote for a single package (under 'normal/default' conditions).

In your case it appears that even though the items could be sent as a single package you are opting to send them separately.
There is no way to cater for this scenario because the software doesn't know any better.

raptor_55:

some sort of code that worked out if cart has something from category 'monitors' or 'cases' shipping price is normal shipping price times the number of items from either of these categories.

There are many examples floating around that can make certain categories or products be treated different from the rest, but the problem is everyone has different needs and different categories, which essentially makes each one a 'custom' job - and even then the solutions aren't easy. If the cart contains one thing from category 'A' and another from category 'B' then how are the quotes displayed? Do we just combine both figures? What about when it comes to actual packing, will the merchant just 'know' the shipping cost displayed as $xx.yy really consists of $xx for Item A and $yy for item 'B'? As you can see, there are lots of potential problems and other issues/factors to consider that makes a seemingly simple task a major project.

Just my 2cents.

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

15 Sep 2010, 7:11 PM
#262
jeanie avatar

jeanie

New Zenner

Join Date:
Aug 2010
Posts:
2
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ajeh,

Like I said I'm using ceon advanced shipper. I couldn't find out how to charge by the total weight, the only optioins I get are price, weight (this takes the weight and multiplies it by the flat rate price of $8.95), numitems, and total order price. None of these do what I want to do. I paid for this shipping module so I'd really like for it to work right!
Thanks, for any advice in advance!
Jeanie

27 Oct 2010, 12:40 AM
#263
trice avatar

trice

New Zenner

Join Date:
Oct 2010
Posts:
26
Plugin Contributions:
0

Re: Different shipping methods for different categories

cellmonsters:

Alright, so i have been troubleshooting this for a while now since it is an option that I really want and all i have been able to do is change the code to instead of using master_categories_id i tested with :

// disable for one master_categories_id
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','SHP1') > 0)) {
$this->enabled = true;
}

now, everytime a product with this model "SHP1" is in the cart, the appropriate shipping module is activated. What i found out is that you cannot include more than 2 main_categories_id in the shipping module. for example you can use:

// disable for one master_categories_id
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','1') > 0)) {
$this->enabled = true;
}

and under this another:
// disable for one master_categories_id
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','2') > 0)) {
$this->enabled = false;
}

this would disable any products in category 2 from using whatever shipping module this code is in. however, you cannot repeat the same code to disable another category as it would not work. At least it did not work for me. so what i did was change the master_categories_id to products_model, therefore any products with the same Model, regardless of their categories would disable or enable a shipping module.

Hope this helps everyone that would like to include many products in different categories and would like these to activate different shipping options.

I am trying to use this in my shipping and for some reason it is not working, can someone look at this code and see what I am missing here? I guess I should have been a little more clear. I want to use the format that cellmonster is using so that if I put a code in the model section it will only use this shipping mod. Any help would be greatly appreciated.

27 Oct 2010, 2:51 AM
#264
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Could you either post the two php files for this or zip them and attach them ...

Working from a PDF is pretty useless in testing and I don't have time to try to translate this and clean it up from the PDF to a working php file ... thanks ... :smile:

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!]
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!

27 Oct 2010, 3:37 AM
#265
trice avatar

trice

New Zenner

Join Date:
Oct 2010
Posts:
26
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ajeh:

Could you either post the two php files for this or zip them and attach them ...

Working from a PDF is pretty useless in testing and I don't have time to try to translate this and clean it up from the PDF to a working php file ... thanks ... :smile:

I'm sorry....I'm extremely new at this and I just figured out how to post the php files for you :smile:

<?php
/**
 * @package shippingMethod
 * @copyright Copyright 2003-2010 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: bagship.php 15616 2010-03-06 04:07:11Z ajeh $
 */
/**
 * "Bag Ship" shipping module, allowing you to offer per-unit-rate shipping options
 *
 */
class bagship extends base {
  /**
   * $code determines the internal 'code' name used to designate "this" payment module
   *
   * @var string
   */
  var $code;
  /**
   * $title is the displayed name for this payment method
   *
   * @var string
   */
  var $title;
  /**
   * $description is a soft name for this payment method
   *
   * @var string
   */
  var $description;
  /**
   * module's icon
   *
   * @var string
   */
  var $icon;
  /**
   * $enabled determines whether this module shows or not... during checkout.
   *
   * @var boolean
   */
  var $enabled;
  /**
     * Constructor
   *
   * @return bagship
   */
  function bagship() {
    global $order, $db;

    $this->code = 'bagship';
    $this->title = MODULE_SHIPPING_BAGSHIP_TEXT_TITLE;
    $this->description = MODULE_SHIPPING_BAGSHIP_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_SHIPPING_BAGSHIP_SORT_ORDER;
    $this->icon = '';
    $this->tax_class = MODULE_SHIPPING_BAGSHIP_TAX_CLASS;
    $this->tax_basis = MODULE_SHIPPING_BAGSHIP_TAX_BASIS;

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

    // disable for one master_categories_id
    if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','bagship') > 0)) {
      $this->enabled = true;
    }    

    if ($this->enabled) {
      // check MODULE_SHIPPING_BAGSHIP_HANDLING_METHOD is in
      $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_BAGSHIP_HANDLING_METHOD'");
      if ($check_query->EOF) {
        $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Handling Per Order or Per Box', 'MODULE_SHIPPING_BAGSHIP_HANDLING_METHOD', 'Order', 'Do you want to charge Handling Fee Per Order or Per Box?', '6', '0', 'zen_cfg_select_option(array(\'Order\', \'Box\'), ', now())");
      }
    }

    if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_BAGSHIP_ZONE > 0) ) {
      $check_flag = false;
      $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . "
                             where geo_zone_id = '" . MODULE_SHIPPING_BAGSHIP_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;
      }
    }
  }
  /**
   * Obtain quote from shipping system/calculations
   *
   * @param string $method
   * @return array
   */
  function quote($method = '') {
    global $order, $shipping_weight, $shipping_num_boxes;

    $total_weight_units = $shipping_weight;
    $this->quotes = array('id' => $this->code,
                          'module' => MODULE_SHIPPING_BAGSHIP_TEXT_TITLE,
                          'methods' => array(array('id' => $this->code,
                                                   'title' => MODULE_SHIPPING_BAGSHIP_TEXT_WAY,
                                                   'cost' => MODULE_SHIPPING_BAGSHIP_COST * ($total_weight_units * $shipping_num_boxes) +
                                                   (MODULE_SHIPPING_BAGSHIP_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_BAGSHIP_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_BAGSHIP_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;
  }
  /**
   * Check to see whether module is installed
   *
   * @return boolean
   */
  function check() {
    global $db;
    if (!isset($this->_check)) {
      $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_BAGSHIP_STATUS'");
      $this->_check = $check_query->RecordCount();
    }
    return $this->_check;
  }
  /**
   * Install the shipping module and its configuration settings
   *
   */
  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 Per Weight Unit Shipping', 'MODULE_SHIPPING_BAGSHIP_STATUS', 'True', 'Do you want to offer per unit rate shipping?<br /><br />Product Quantity * Units (products_weight) * Cost per Unit', '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 per Unit', 'MODULE_SHIPPING_BAGSHIP_COST', '1', 'NOTE: When using this Shipping Module be sure to check the Tare settings in the Shipping/Packaging and set the Largest Weight high enough to handle the price, such as 5000.00 and the adjust the settings on Small and Large packages which will add to the price as well.<br /><br />The shipping cost will be used to determine shipping charges based on: Product Quantity * Units (products_weight) * Cost per Unit - 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_BAGSHIP_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, set_function, date_added) values ('Handling Per Order or Per Box', 'MODULE_SHIPPING_BAGSHIP_HANDLING_METHOD', 'Order', 'Do you want to charge Handling Fee Per Order or Per Box?', '6', '0', 'zen_cfg_select_option(array(\'Order\', \'Box\'), ', 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_BAGSHIP_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_BAGSHIP_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_BAGSHIP_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_BAGSHIP_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
  }
  /**
   * Remove the module and all its settings
   *
   */
  function remove() {
    global $db;
    $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key LIKE  'MODULE\_SHIPPING\_BAGSHIP\_%'");
  }
  /**
   * Internal list of configuration keys used for configuration of the module
   *
   * @return array
   */
  function keys() {
    return array('MODULE_SHIPPING_BAGSHIP_STATUS', 'MODULE_SHIPPING_BAGSHIP_COST', 'MODULE_SHIPPING_BAGSHIP_HANDLING', 'MODULE_SHIPPING_BAGSHIP_HANDLING_METHOD', 'MODULE_SHIPPING_BAGSHIP_TAX_CLASS', 'MODULE_SHIPPING_BAGSHIP_TAX_BASIS', 'MODULE_SHIPPING_BAGSHIP_ZONE', 'MODULE_SHIPPING_BAGSHIP_SORT_ORDER');
  }
}
?>
<?php
/**
 * @package languageDefines
 * @copyright Copyright 2003-2005 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: perweightunit.php 2667 2005-12-24 05:31:58Z drbyte $
 */

  define('MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_TITLE', 'Per Unit');
  define('MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_DESCRIPTION', 'Per Unit');
  define('MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_WAY', 'Best Way');
?>

I'm assuming that the second file is fine, because it does show up in shipping modules....Thank you sooo much for helping me!

27 Oct 2010, 3:46 AM
#266
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

What is it that you think this is doing ... :unsure:

    // disable for one master_categories_id
    if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','bagship') > 0)) {
      $this->enabled = true;
    }    

I am suspecting that you are not quite coding this to do what you really want here ...

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!]
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!

27 Oct 2010, 3:49 AM
#267
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

The language file that you posted belongs to the:
/includes/modules/shipping/perweightunit.php

shipping module ...

Or, you have renamed the file to:
/includes/languages/modules/shipping/bagship.php

but you have not customized the constants to work with the code in the:
/includes/modules/shipping/bagship.php

code file ...

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!]
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!

27 Oct 2010, 3:53 AM
#268
trice avatar

trice

New Zenner

Join Date:
Oct 2010
Posts:
26
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ajeh:

What is it that you think this is doing ... :unsure:

// disable for one master_categories_id
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','bagship') > 0)) {
  $this->enabled = true;
}    
> 
> I am suspecting that you are not quite coding this to do what you really want here ...

You probably suspect correctly.....I'm am so new at php and zen cart....but I'm gonna give it a try

This is what I want....:smile:

I want to use a perunit shipping mod only for products that have the code bagship as the model number.  I want my client to be able to put the shipping amount in as the weight so she can determine the shipping for each product.

I also want to use a table mod in the same manner 

And then also have store pickup as an option

I know I'm not asking much...:smile:  yea right!
27 Oct 2010, 4:08 AM
#269
trice avatar

trice

New Zenner

Join Date:
Oct 2010
Posts:
26
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ajeh:

The language file that you posted belongs to the:
/includes/modules/shipping/perweightunit.php

shipping module ...

Or, you have renamed the file to:
/includes/languages/modules/shipping/bagship.php

but you have not customized the constants to work with the code in the:
/includes/modules/shipping/bagship.php

code file ...

ok so in order not to confuse you (and myself)

this file is under /includes/modules/shipping

<?php
/**
 * @package shippingMethod
 * @copyright Copyright 2003-2010 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: bagship.php 15616 2010-03-06 04:07:11Z ajeh $
 */
/**
 * "Bag Ship" shipping module, allowing you to offer per-unit-rate shipping options
 *
 */
class bagship extends base {
  /**
   * $code determines the internal 'code' name used to designate "this" payment module
   *
   * @var string
   */
  var $code;
  /**
   * $title is the displayed name for this payment method
   *
   * @var string
   */
  var $title;
  /**
   * $description is a soft name for this payment method
   *
   * @var string
   */
  var $description;
  /**
   * module's icon
   *
   * @var string
   */
  var $icon;
  /**
   * $enabled determines whether this module shows or not... during checkout.
   *
   * @var boolean
   */
  var $enabled;
  /**
     * Constructor
   *
   * @return bagship
   */
  function bagship() {
    global $order, $db;

    $this->code = 'bagship';
    $this->title = MODULE_SHIPPING_BAGSHIP_TEXT_TITLE;
    $this->description = MODULE_SHIPPING_BAGSHIP_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_SHIPPING_BAGSHIP_SORT_ORDER;
    $this->icon = '';
    $this->tax_class = MODULE_SHIPPING_BAGSHIP_TAX_CLASS;
    $this->tax_basis = MODULE_SHIPPING_BAGSHIP_TAX_BASIS;

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

    // disable for one master_categories_id
    if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','bagship') > 0)) {
      $this->enabled = true;
    }    

    if ($this->enabled) {
      // check MODULE_SHIPPING_BAGSHIP_HANDLING_METHOD is in
      $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_BAGSHIP_HANDLING_METHOD'");
      if ($check_query->EOF) {
        $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Handling Per Order or Per Box', 'MODULE_SHIPPING_BAGSHIP_HANDLING_METHOD', 'Order', 'Do you want to charge Handling Fee Per Order or Per Box?', '6', '0', 'zen_cfg_select_option(array(\'Order\', \'Box\'), ', now())");
      }
    }

    if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_BAGSHIP_ZONE > 0) ) {
      $check_flag = false;
      $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . "
                             where geo_zone_id = '" . MODULE_SHIPPING_BAGSHIP_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;
      }
    }
  }
  /**
   * Obtain quote from shipping system/calculations
   *
   * @param string $method
   * @return array
   */
  function quote($method = '') {
    global $order, $shipping_weight, $shipping_num_boxes;

    $total_weight_units = $shipping_weight;
    $this->quotes = array('id' => $this->code,
                          'module' => MODULE_SHIPPING_BAGSHIP_TEXT_TITLE,
                          'methods' => array(array('id' => $this->code,
                                                   'title' => MODULE_SHIPPING_BAGSHIP_TEXT_WAY,
                                                   'cost' => MODULE_SHIPPING_BAGSHIP_COST * ($total_weight_units * $shipping_num_boxes) +
                                                   (MODULE_SHIPPING_BAGSHIP_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_BAGSHIP_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_BAGSHIP_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;
  }
  /**
   * Check to see whether module is installed
   *
   * @return boolean
   */
  function check() {
    global $db;
    if (!isset($this->_check)) {
      $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_BAGSHIP_STATUS'");
      $this->_check = $check_query->RecordCount();
    }
    return $this->_check;
  }
  /**
   * Install the shipping module and its configuration settings
   *
   */
  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 Per Weight Unit Shipping', 'MODULE_SHIPPING_BAGSHIP_STATUS', 'True', 'Do you want to offer per unit rate shipping?<br /><br />Product Quantity * Units (products_weight) * Cost per Unit', '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 per Unit', 'MODULE_SHIPPING_BAGSHIP_COST', '1', 'NOTE: When using this Shipping Module be sure to check the Tare settings in the Shipping/Packaging and set the Largest Weight high enough to handle the price, such as 5000.00 and the adjust the settings on Small and Large packages which will add to the price as well.<br /><br />The shipping cost will be used to determine shipping charges based on: Product Quantity * Units (products_weight) * Cost per Unit - 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_BAGSHIP_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, set_function, date_added) values ('Handling Per Order or Per Box', 'MODULE_SHIPPING_BAGSHIP_HANDLING_METHOD', 'Order', 'Do you want to charge Handling Fee Per Order or Per Box?', '6', '0', 'zen_cfg_select_option(array(\'Order\', \'Box\'), ', 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_BAGSHIP_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_BAGSHIP_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_BAGSHIP_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_BAGSHIP_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
  }
  /**
   * Remove the module and all its settings
   *
   */
  function remove() {
    global $db;
    $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key LIKE  'MODULE\_SHIPPING\_BAGSHIP\_%'");
  }
  /**
   * Internal list of configuration keys used for configuration of the module
   *
   * @return array
   */
  function keys() {
    return array('MODULE_SHIPPING_BAGSHIP_STATUS', 'MODULE_SHIPPING_BAGSHIP_COST', 'MODULE_SHIPPING_BAGSHIP_HANDLING', 'MODULE_SHIPPING_BAGSHIP_HANDLING_METHOD', 'MODULE_SHIPPING_BAGSHIP_TAX_CLASS', 'MODULE_SHIPPING_BAGSHIP_TAX_BASIS', 'MODULE_SHIPPING_BAGSHIP_ZONE', 'MODULE_SHIPPING_BAGSHIP_SORT_ORDER');
  }
}
?>

and this file is under /includes/languages/english/modules/shipping
and I did make changes to it just recently after seeing it still had the perunit references

<?php
/**
 * @package languageDefines
 * @copyright Copyright 2003-2005 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: bagship.php 2667 2005-12-24 05:31:58Z drbyte $
 */

  define('MODULE_SHIPPING_BAGSHIP_TEXT_TITLE', 'Per Unit');
  define('MODULE_SHIPPING_BAGSHIP_TEXT_DESCRIPTION', 'Per Unit');
  define('MODULE_SHIPPING_BAGSHIP_TEXT_WAY', 'Shipping');
?>
27 Oct 2010, 4:54 AM
#270
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Do you think this code is going to "make this show" when the products_model matches: bagship

    // disable for one master_categories_id
    if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','bagship') > 0)) {
      $this->enabled = true;
    }

The reason I ask is, if the module is installed, then the:
$this->enabled

is already true ...

I think you want to reverse the logic and use:

    // disable for one master_categories_id
    if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','bagship') < 1)) {
      $this->enabled = false;
    }

so that the module is turned OFF is there is not at least 1 Product with the products_model of: bagship

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!]
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!

27 Oct 2010, 5:03 AM
#271
trice avatar

trice

New Zenner

Join Date:
Oct 2010
Posts:
26
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ajeh:

Do you think this code is going to "make this show" when the products_model matches: bagship

// disable for one master_categories_id
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','bagship') > 0)) {
  $this->enabled = true;
}
> 
> The reason I ask is, if the module is installed, then the:
> $this->enabled 
> 
> is already true ...
> 
> I think you want to reverse the logic and use:
> ```
    // disable for one master_categories_id
    if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','bagship') < 1)) {
      $this->enabled = false;
    }

so that the module is turned OFF is there is not at least 1 Product with the products_model of: bagship

Oh thank you so much that works, now it only shows when there is something with bagslip - but i must have missed a step somewhere because the shipping price that I entered into the weight is not showing up (I know I remember reading how to make that work, but for some reason I lost it) can you explain that?

27 Oct 2010, 5:18 AM
#272
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Define "lost" ...

Did you set the Per Unit to 1.00 when you installed it? :unsure:

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!]
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!

27 Oct 2010, 5:32 AM
#273
trice avatar

trice

New Zenner

Join Date:
Oct 2010
Posts:
26
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ajeh:

Define "lost" ...

Did you set the Per Unit to 1.00 when you installed it? :unsure:

Lost - meaing I read the thread somewhere and thought I did what it asked me to do, but now can't find the thread with the instruction -

But I found it!! You are awesome.

But I really really hate to be a pain in the ########, but now I think somewhere along the line I didn't think it all through, because now if I have a product with bagship as the model and then a product with reg (which is my table rate mod that I want to use for products with reg as the model Both shipping mods are coming up as choices for the customer. How can I make the shipping either combine ?? Please see the screen print attached

27 Oct 2010, 5:34 AM
#274
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

How does your Table Rate shipping module work? Off of Weight, Price or Item count?

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!]
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!

27 Oct 2010, 5:38 AM
#275
trice avatar

trice

New Zenner

Join Date:
Oct 2010
Posts:
26
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ajeh:

How does your Table Rate shipping module work? Off of Weight, Price or Item count?

item count

<?php
/**
 * @package shippingMethod
 * @copyright Copyright 2003-2005 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: table2.php 6347 2007-05-20 19:46:59Z ajeh $
 */
/**
 * Enter description here...
 *
 */
class table2 extends base {
  /**
   * Enter description here...
   *
   * @var unknown_type
   */
  var $code;
  /**
   * Enter description here...
   *
   * @var unknown_type
   */
  var $title;
  /**
   * Enter description here...
   *
   * @var unknown_type
   */
  var $description;
  /**
   * Enter description here...
   *
   * @var unknown_type
   */
  var $icon;
  /**
   * Enter description here...
   *
   * @var unknown_type
   */
  var $enabled;
  /**
   * Enter description here...
   *
   * @return _2
   */
  function table2() {
    global $order, $db;

    $this->code = 'table2';
    $this->title = MODULE_SHIPPING_TABLE2_TEXT_TITLE;
    $this->description = MODULE_SHIPPING_TABLE2_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_SHIPPING_TABLE2_SORT_ORDER;
    $this->icon = '';
    $this->tax_class = MODULE_SHIPPING_TABLE2_TAX_CLASS;
    $this->tax_basis = MODULE_SHIPPING_TABLE2_TAX_BASIS;
   
    // disable only when entire cart is free shipping 
    if (zen_get_shipping_enabled($this->code)) { 
      $this->enabled = ((MODULE_SHIPPING_BAGSHIP_STATUS == 'True') ? true : false); 
    } 

      // disable for one master_categories_id
    if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','reg') < 1)) {
      $this->enabled = false;
    }     


    if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_TABLE2_ZONE > 0) ) {
      $check_flag = false;
      $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_TABLE2_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 (zen_get_shipping_enabled($this->code)) { 
          $this->enabled = ((MODULE_SHIPPING_ITEM_STATUS == 'True') ? true : false); 
     } 

      
      if ($check_flag == false) {
        $this->enabled = false;
      }
    }
  }
  /**
   * Enter description here...
   *
   * @param unknown_type $method
   * @return unknown
   */
27 Oct 2010, 5:53 AM
#276
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

You have some mixed up code ...

This should be working with the constants for the table2.php code not the bagship.php code:

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

I have to work out the code for this ... but I am now sleeping ...

Based on the fact that you are using weight for the bagship products and item count for the reg products ... this could actually be done with the table2.php module by itself ...

The difference it to make calculations a little different where you leave table2.php setup as it is for the count or items, but reduce the count by the number of products that are bagship and then apply the table rate calculation ...

Then, add in the weight to account for the bagship products ...

But I have to actually think this through for more than 5 minutes and I went to sleep 15 minutes ago ... :lamo:

So give this a slow think ... and see if you can work out the calculations ... and if not, I will look at it in the morning to work out the calcuations based on how much weight belongs to the bagship products which is all the weight as the reg products have no weight plus the calculation of the number of items - the number of items that are bagship ...

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!]
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!

27 Oct 2010, 5:58 AM
#277
trice avatar

trice

New Zenner

Join Date:
Oct 2010
Posts:
26
Plugin Contributions:
0

Re: Different shipping methods for different categories

I am right there with ya :sleepy:....thanks so much for your help. I will look at this with a fresh set of eyes tomorrow when I get home from work. Thanks again!!! I'm sure you will be hearing from me, like I said this is my first crack at php and a shopping cart, but I think I'm grasping some of it anyway....thanks again....night night!!

27 Oct 2010, 11:30 PM
#278
trice avatar

trice

New Zenner

Join Date:
Oct 2010
Posts:
26
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ajeh:

You have some mixed up code ...

This should be working with the constants for the table2.php code not the bagship.php code:

// disable only when entire cart is free shipping 
if (zen_get_shipping_enabled($this->code)) { 
  $this->enabled = ((MODULE_SHIPPING_BAGSHIP_STATUS == 'True') ? true : false); 
} 
> 
> I have to work out the code for this ... but I am now sleeping ... 
> 
> Based on the fact that you are using weight for the bagship products and item count for the reg products ... this could actually be done with the table2.php module by itself ...
> 
> The difference it to make calculations a little different where you leave table2.php setup as it is for the count or items, but reduce the count by the number of products that are bagship and then apply the table rate calculation ...
> 
> Then, add in the weight to account for the bagship products ...
> 
> But I have to actually think this through for more than 5 minutes and I went to sleep 15 minutes ago ... :lamo:
> 
> So give this a slow think ... and see if you can work out the calculations ... and if not, I will look at it in the morning to work out the calcuations based on how much weight belongs to the bagship products which is all the weight as the reg products have no weight plus the calculation of the number of items - the number of items that are bagship ...

I appreciate all your help with this.  I have looked at this and wonder if I'm not getting in over my head.  I have figured out that I also want to add a discount for shipping of products under the bagship label.  So if someone purchase 1 bagship product the second item that is a bagship would be 50% off the shipping cost that was put into the weight section by the store owner.  Am I still going to be able to do this they way that you suggested?
28 Oct 2010, 2:57 AM
#279
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

It would take quite a bit of customizing to work in a 50% discount ...

What happens when 3 bagship are in the cart or 4? :unsure:

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!]
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!

28 Oct 2010, 9:21 PM
#280
trice avatar

trice

New Zenner

Join Date:
Oct 2010
Posts:
26
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ajeh:

It would take quite a bit of customizing to work in a 50% discount ...

What happens when 3 bagship are in the cart or 4? :unsure:

Ok so I talked the person that I am creating this for into making my life simple. I told her I was gonna lock her in the closet if she didn't cut me a break.....:D

Anyway I'm going to work on this later tonight, but will you tell me if this is possible

Going to use the table rate for both bagship and reg (still basising it on what is entered into the model number)

Will I be able to combine those into one table shipping module?