I would like to have master cat 62 & 76 set to flat rate of $3.00 and the rest set to a flat rate of $8.00.
I have cloned the flat rate BUT I am lost on how to implement it into my zen cart.
Right now I just have a flat rate of $8.00.
Please help![]()
I would like to have master cat 62 & 76 set to flat rate of $3.00 and the rest set to a flat rate of $8.00.
I have cloned the flat rate BUT I am lost on how to implement it into my zen cart.
Right now I just have a flat rate of $8.00.
Please help![]()
You can customize the Flat Rate shipping module that should not work for categories_id 62 and 76 with:
Then for the one that should run for categories_id 62 and 76 with:Code:// bof: disable for these master_categories_id if (IS_ADMIN_FLAG == false) { // check master_categories_id add one line per master_categories_id $chk_cat = 0; $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','62'); $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','76'); if ($chk_cat > 0) { $this->enabled = false; } } // eof: disable for these master_categories_id
What happens when you have Products from Categories 62, 76 and 48?Code:// bof: disable for these master_categories_id if (IS_ADMIN_FLAG == false) { // check master_categories_id add one line per master_categories_id $chk_cat = 0; $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','62'); $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','76'); if ($chk_cat < 1) { $this->enabled = false; } } // eof: disable for these master_categories_id![]()
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.1]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Hi, Ms. A and thanks for the reply.
Here is what I am trying to do and this is what I have gathered here from searching on the forum.
My objective is to have two different flat rates.
One flat rate being $8.00 and the other flat rate being $3.00.
Master Cat 62 & 76 I would like to be $3.00. All others $8.00.
Here is what I have done so far.
I cloned flat.php and added these files to the below referenced directories. Every time I tried to add some code my whole shipping module is admin disappears.
/includes/modules/shipping/flat3.php
/includes/languages/english/modules/shipping/flat3.php
Then I tried adding code to flat.php but not sure which file directory? Or both?
/includes/modules/shipping/flat.php
/includes/languages/english/modules/shipping/flat.php
I need to tell flat.php not include Mast Cat 62 & 76. And I need to tell flat3.php only to include Mast Cat 62 & 76.
I am not sure which code to add to flat.php and which code to add to flat3.php.
And lastly...I have not tried to resolved "what if" they buy from both categories...
I need a little help from Ms. A if possible on coding.
Thank you for your time.![]()
Last edited by PinkLeopard; 1 Apr 2011 at 12:24 AM.
If you read my post ...
The first set of code is to NOT show if Products from 62 or 76 are in the cart ...
The second set of code is to NOT show if Products from 62 or 76 are NOT in the cart ...
So this means that the first piece of code would show that shipping module on a cart that has Products from 62 or 76 -- or -- either of those two categories and any other category at the same time ...
The code always go into the files in the code directory for:
/includes/modules/shipping
The language defines go in the:
/includes/languages/english/modules/shipping
You add the code right after the existing code for:
Code:// disable only when entire cart is free shipping if (zen_get_shipping_enabled($this->code)) { $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false); }
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.1]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Hi thanks so much for your help. I have done what you said.
Both flat rates are showing up in the cart.
I will attached both files.
Can you take a moment to let me know what I have done wrong.
Thanks again for your help
<?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');
}
}
// bof: disable for these master_categories_id
if (IS_ADMIN_FLAG == false) {
// check master_categories_id add one line per master_categories_id
$chk_cat = 0;
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','62');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','76');
if ($chk_cat > 0) {
$this->enabled = false;
}
}
// eof: disable for these master_categories_id
?>
<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | license@zen-cart.com so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: flatClone.php 1969 2008-01-25 01:15:21p DWells $
// cloned from $Id: flat.php 1969 2005-09-13 06:57:21Z drbyte $
//
class flatClone {
var $code, $title, $description, $icon, $enabled;
// class constructor
function flatClone() {
global $order, $db;
$this->code = 'flatClone';
$this->title = MODULE_SHIPPING_FLATCLONE_TEXT_TITLE;
$this->description = MODULE_SHIPPING_FLATCLONE_TEXT_DESCRIPTION;
$this->sort_order = MODULE_SHIPPING_FLATCLONE_SORT_ORDER;
$this->icon = '';
$this->tax_class = MODULE_SHIPPING_FLATCLONE_TAX_CLASS;
$this->tax_basis = MODULE_SHIPPING_FLATCLONE_TAX_BASIS;
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_FLATCLONE_STATUS == 'True') ? true : false);
}
if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLATCLONE_ZONE > 0) ) {
$check_flag = false;
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FLATCLONE_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_FLATCLONE_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_FLATCLONE_TEXT_WAY,
'cost' => MODULE_SHIPPING_FLATCLONE_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_FLATCLONE_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_FLATCLONE_STATUS', 'True', 'Do you want to offer flatClone 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_FLATCLONE_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_FLATCLONE_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_FLATCLONE_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_FLATCLONE_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_FLATCLONE_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
}
function remove() {
global $db;
$db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_SHIPPING_FLATCLONE_STATUS', 'MODULE_SHIPPING_FLATCLONE_COST', 'MODULE_SHIPPING_FLATCLONE_TAX_CLASS', 'MODULE_SHIPPING_FLATCLONE_TAX_BASIS', 'MODULE_SHIPPING_FLATCLONE_ZONE', 'MODULE_SHIPPING_FLATCLONE_SORT_ORDER');
}
}
// bof: disable for these master_categories_id
if (IS_ADMIN_FLAG == false) {
// check master_categories_id add one line per master_categories_id
$chk_cat = 0;
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','62');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','76');
if ($chk_cat < 1) {
$this->enabled = false;
}
}
// eof: disable for these master_categories_id
?>
You stuck the new code in the bottom of the files where it does nothing ...
Place it under the code:
and in the clone code under the code:Code:// disable only when entire cart is free shipping if (zen_get_shipping_enabled($this->code)) { $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false); }
Code:// disable only when entire cart is free shipping if (zen_get_shipping_enabled($this->code)) { $this->enabled = ((MODULE_SHIPPING_FLATCLONE_STATUS == 'True') ? true : false); }
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.1]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
You are amazing and after I went through learning how to do this...it was not that painful. I just did not know where to add the code. And I tried a zillion times over.
Do you mind if I add it to the free downloads?
And trust me...I will donate. I feel confident I will get some sales now because I think my shipping was too high.
Thanks again.
I don't know that it is worth being an add on as there are so many different methods and a zillion are already posted on the Free Forums ...
Glad you have this working now ...![]()
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.1]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Bookmarks