Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / error with cloned shipping module

error with cloned shipping module

Locked

Views: 1,471

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
12 Sep 2008, 12:23 AM
#1
sailordraco avatar

sailordraco

New Zenner

Join Date:
Sep 2008
Location:
Texas
Posts:
6
Plugin Contributions:
0

error with cloned shipping module

I followed a tutorial here on the board to clone a shipping module. I did it with the flate rate shippin module. I created flate rate shipping for USA, APO, Canada, Mexico, and Elsewhere. However, when I tested ordering something under a Jane Doe account, I put in a US shipping address and the checkout told me it was not a place we ship to. How do I fix this?

12 Sep 2008, 12:33 AM
#2
sailordraco avatar

sailordraco

New Zenner

Join Date:
Sep 2008
Location:
Texas
Posts:
6
Plugin Contributions:
0

Re: error with cloned shipping module

I forgot this information may be helpful:

I created the following cloned files:
flatapofpo.php
flatcanada.php
flatmexico.php
flatusa.php
flatother.php

Here is what one of the clones looks like:

<?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 | // | [email protected] so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // $Id: flatusa.php 1969 2005-09-13 06:57:21Z drbyte $ // class flatusa { var $code, $title, $description, $icon, $enabled; // class constructor function flatusa() { global $order, $db; $this->code = 'flatusa'; $this->title = MODULE_SHIPPING_FLATUSA_TEXT_TITLE; $this->description = MODULE_SHIPPING_FLATUSA_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_FLATUSA_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_FLATUSA_TAX_CLASS; $this->tax_basis = MODULE_SHIPPING_FLATUSA_TAX_BASIS; // disable only when entire cart is free shipping if (zen_get_shipping_enabled($this->code)) { $this->enabled = ((MODULE_SHIPPING_FLATUSA_STATUS == 'True') ? true : false); } if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLATUSA_ZONE > 0) ) { $check_flag = false; $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FLATUSA_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_FLATUSA_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_FLATUSA_TEXT_WAY, 'cost' => MODULE_SHIPPING_FLATUSA_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_FLATUSA_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 USA Shipping', 'MODULE_SHIPPING_FLATUSA_STATUS', 'True', 'Do you want to offer flat USA 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_FLATUSA_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_FLATUSA_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_FLATUSA_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_FLATUSA_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_FLATUSA_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_FLATUSA_STATUS', 'MODULE_SHIPPING_FLATUSA_COST', 'MODULE_SHIPPING_FLATUSA_TAX_CLASS', 'MODULE_SHIPPING_FLATUSA_TAX_BASIS', 'MODULE_SHIPPING_FLATUSA_ZONE', 'MODULE_SHIPPING_FLATUSA_SORT_ORDER'); } } ?>
13 Sep 2008, 5:41 AM
#3
ajeh avatar

ajeh

Oba-san

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

Re: error with cloned shipping module

And after you cloned the modules ... you then went and built each of the Zones to add to each of these modules, right? :unsure:

15 Sep 2008, 3:20 AM
#4
sailordraco avatar

sailordraco

New Zenner

Join Date:
Sep 2008
Location:
Texas
Posts:
6
Plugin Contributions:
0

Re: error with cloned shipping module

Correct, I did create the following zones: USA, Canada, Mexico, APO/FPO, and Other.

Now when I go to the admin shipping module page I am getting the following error messages:

Warning: main(/home/animeadd/public_html/store/includes/languages/english/modules/shipping/flatapofpo.php) [function.main]: failed to open stream: No such file or directory in /home/animeadd/public_html/store/admin/modules.php on line 173

Warning: main(/home/animeadd/public_html/store/includes/languages/english/modules/shipping/flatapofpo.php) [function.main]: failed to open stream: No such file or directory in /home/animeadd/public_html/store/admin/modules.php on line 173

Warning: main() [function.include]: Failed opening '/home/animeadd/public_html/store/includes/languages/english/modules/shipping/flatapofpo.php' for inclusion (include_path='.:/usr/php4/lib/php:/usr/local/php4/lib/php') in /home/animeadd/public_html/store/admin/modules.php on line 173

16 Sep 2008, 4:37 AM
#5
ajeh avatar

ajeh

Oba-san

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

Re: error with cloned shipping module

You made from:
/includes/modules/shipping/flat.php
/includes/languages/english/modules/shipping/flat.php

/includes/modules/shipping/flatapofpo.php
/includes/languages/english/modules/shipping/flatapofpo.php

You did not leave any extra copies of backup files or extra files that might use these filenames in side?

20 Sep 2008, 2:44 PM
#6
sailordraco avatar

sailordraco

New Zenner

Join Date:
Sep 2008
Location:
Texas
Posts:
6
Plugin Contributions:
0

Re: error with cloned shipping module

Nope, I just did a search to be sure.

20 Sep 2008, 3:48 PM
#7
ajeh avatar

ajeh

Oba-san

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

Re: error with cloned shipping module

Check these files:
/store/includes/modules/shipping/flatapofpo.php
/store/includes/languages/english/modules/shipping/flatapofpo.php

Make sure the code is in the /modules and that the language defines are in the /languages ...

24 Sep 2008, 3:25 AM
#8
sailordraco avatar

sailordraco

New Zenner

Join Date:
Sep 2008
Location:
Texas
Posts:
6
Plugin Contributions:
0

Re: error with cloned shipping module

Yeah, they are there.

Here is what the shipping module in includes/languages/english/modules/shipping/flatusa.php looks like:

<?php // // +----------------------------------------------------------------------+ // |zen-cart Open Source E-commerce | // +----------------------------------------------------------------------+ // | Copyright (c) 2003 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 | // | [email protected] so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // $Id: flatusa.php 1969 2005-09-13 06:57:21Z drbyte $ // define('MODULE_SHIPPING_FLATUSA_TEXT_TITLE', 'Flat USA Rate'); define('MODULE_SHIPPING_FLATUSA_TEXT_DESCRIPTION', 'Flat USA Rate'); define('MODULE_SHIPPING_FLATUSA_TEXT_WAY', 'Best Way'); ?>
24 Sep 2008, 3:48 AM
#9
sailordraco avatar

sailordraco

New Zenner

Join Date:
Sep 2008
Location:
Texas
Posts:
6
Plugin Contributions:
0

Re: error with cloned shipping module

Do I need to change anything in
admin/modules.php

25 Sep 2008, 2:56 AM
#10
ajeh avatar

ajeh

Oba-san

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

Re: error with cloned shipping module

The error is saying flatapofpo and you are showing us the flatusa ...

Make sure, on the server, that the code file(s) are in the:
/includes/modules/shipping

and that the language file(s) are in the:
/includes/languages/english/modules/shipping