Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23
  1. #11
    Join Date
    Feb 2007
    Posts
    90
    Plugin Contributions
    0

    Default Re: Cloned shipping module problem

    Yes that was the public_HTML/includes/languages/english/modules/shipping/cod.php

    This is the other one

    <?php
    /**
    * @package shippingMethod
    * @copyright Copyright 2003-2006 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: cod.php 4821 2006-10-23 10:54:15Z drbyte $
    */
    /**
    * cod / Will-Call shipping method
    *
    */
    class storepickup 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 cod
    */
    function cod() {
    global $order, $db;
    $this->code = 'cod';
    $this->title = MODULE_SHIPPING_COD_TEXT_TITLE;
    $this->description = MODULE_SHIPPING_COD_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_SHIPPING_COD_SORT_ORDER;
    $this->icon = '';
    $this->tax_class = MODULE_SHIPPING_COD_TAX_CLASS;
    $this->tax_basis = MODULE_SHIPPING_COD_TAX_BASIS;
    $this->enabled = ((MODULE_SHIPPING_COD_STATUS == 'True') ? true : false);
    if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_COD_ZONE > 0) ) {
    $check_flag = false;
    $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . "
    where geo_zone_id = '" . MODULE_SHIPPING_COD_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;
    $this->quotes = array('id' => $this->code,
    'module' => MODULE_SHIPPING_COD_TEXT_TITLE,
    'methods' => array(array('id' => $this->code,
    'title' => MODULE_SHIPPING_COD_TEXT_WAY,
    'cost' => MODULE_SHIPPING_COD_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;
    }
    /**
    * 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_COD_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 Store Pickup Shipping', 'MODULE_SHIPPING_COD_STATUS', 'True', 'Do you want to offer In Store 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_COD_COST', '0.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_COD_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_COD_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\'), ', 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_COD_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_COD_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 in ('" . implode("', '", $this->keys()) . "')");
    }
    /**
    * Internal list of configuration keys used for configuration of the module
    *
    * @return array
    */
    function keys() {
    return array('MODULE_SHIPPING_COD_STATUS', 'MODULE_SHIPPING_COD_COST', 'MODULE_SHIPPING_COD_TAX_CLASS', 'MODULE_SHIPPING_COD_TAX_BASIS', 'MODULE_SHIPPING_COD_ZONE', 'MODULE_SHIPPING_COD_SORT_ORDER');
    }
    }
    ?>

  2. #12
    Join Date
    Jun 2007
    Location
    Texas, USA
    Posts
    1,400
    Plugin Contributions
    1

    Default Re: Cloned shipping module problem

    Quote Originally Posted by psr racing View Post
    Yes that was the public_HTML/includes/languages/english/modules/shipping/cod.php

    This is the other one

    <?php
    /**
    * @package shippingMethod
    * @copyright Copyright 2003-2006 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: cod.php 4821 2006-10-23 10:54:15Z drbyte $
    */
    /**
    * cod / Will-Call shipping method
    *
    */
    class storepickup 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 cod
    */
    function cod() {
    global $order, $db;
    $this->code = 'cod';
    $this->title = MODULE_SHIPPING_COD_TEXT_TITLE;
    $this->description = MODULE_SHIPPING_COD_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_SHIPPING_COD_SORT_ORDER;
    $this->icon = '';
    $this->tax_class = MODULE_SHIPPING_COD_TAX_CLASS;
    $this->tax_basis = MODULE_SHIPPING_COD_TAX_BASIS;
    $this->enabled = ((MODULE_SHIPPING_COD_STATUS == 'True') ? true : false);
    if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_COD_ZONE > 0) ) {
    $check_flag = false;
    $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . "
    where geo_zone_id = '" . MODULE_SHIPPING_COD_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;
    $this->quotes = array('id' => $this->code,
    'module' => MODULE_SHIPPING_COD_TEXT_TITLE,
    'methods' => array(array('id' => $this->code,
    'title' => MODULE_SHIPPING_COD_TEXT_WAY,
    'cost' => MODULE_SHIPPING_COD_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;
    }
    /**
    * 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_COD_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 Store Pickup Shipping', 'MODULE_SHIPPING_COD_STATUS', 'True', 'Do you want to offer In Store 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_COD_COST', '0.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_COD_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_COD_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\'), ', 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_COD_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_COD_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 in ('" . implode("', '", $this->keys()) . "')");
    }
    /**
    * Internal list of configuration keys used for configuration of the module
    *
    * @return array
    */
    function keys() {
    return array('MODULE_SHIPPING_COD_STATUS', 'MODULE_SHIPPING_COD_COST', 'MODULE_SHIPPING_COD_TAX_CLASS', 'MODULE_SHIPPING_COD_TAX_BASIS', 'MODULE_SHIPPING_COD_ZONE', 'MODULE_SHIPPING_COD_SORT_ORDER');
    }
    }
    ?>

    Just as I suspected!

    class storepickup extends base {

    change to:

    class cod extends base {

    should work then....

    looks like you did a find and replace and missed that one


    Shrimp-Gumbo

  3. #13
    Join Date
    Feb 2007
    Posts
    90
    Plugin Contributions
    0

    Default Re: Cloned shipping module problem

    Your a legend how could I miss it right at the top there

  4. #14
    Join Date
    Feb 2007
    Posts
    90
    Plugin Contributions
    0

    Default Re: Cloned shipping module problem

    What do I have to change to make my most expensive shipping option the default choice? (Per Unit)

  5. #15
    Join Date
    May 2005
    Location
    Bath, Somerset
    Posts
    1,053
    Plugin Contributions
    3

    Default Re: Cloned shipping module problem

    The default shipping method is calculated using a cheapest shipping class function. If you use the developers tool in the admin, oyu can see which file this function exists within. You would need to go through and either replace this with a new function, or butcher the cheapest function to return the most expensive method.

    Personally, I would go with creating a new class function, so that it is obvious when you return the code in a year or so what is happening.

    Absolute

  6. #16
    Join Date
    Jun 2007
    Location
    Texas, USA
    Posts
    1,400
    Plugin Contributions
    1

    Default Re: Cloned shipping module problem

    Quote Originally Posted by Absolute View Post
    The default shipping method is calculated using a cheapest shipping class function. If you use the developers tool in the admin, oyu can see which file this function exists within. You would need to go through and either replace this with a new function, or butcher the cheapest function to return the most expensive method.

    Personally, I would go with creating a new class function, so that it is obvious when you return the code in a year or so what is happening.

    Absolute

    Absolute,

    Does this also determine the way that it is ordered at checkout?

    Thanks,

    Shrimp

  7. #17
    Join Date
    May 2005
    Location
    Bath, Somerset
    Posts
    1,053
    Plugin Contributions
    3

    Default Re: Cloned shipping module problem

    The ordering in checkout is determined by the sort order in teh admin, if you have more than 1 module installed. If there is only 1 module installed, it is normally ordered depending on how it coded for each of the methods of transport. As you are cloning this aprticular method, then I would guess that you have more than 1 shipping module installed, in whioch case, you just need to change the module's sort order.

    Absolute

  8. #18
    Join Date
    Feb 2007
    Posts
    90
    Plugin Contributions
    0

    Default Re: Cloned shipping module problem

    Well unfortunately it seems this error has come back to haunt me. I'm sure I got it working a month ago with the help of the people who posted above but now I have discovered it is returning the exact same error message when COD is selected. I don't know how long it has been doing this but I have tried recloning the shipping modules 3 times, even tried cloning different modules but cannot stop the error from coming up. I just cannot see what I have missed during the cloning process?

  9. #19
    Join Date
    May 2005
    Location
    Bath, Somerset
    Posts
    1,053
    Plugin Contributions
    3

    Default Re: Cloned shipping module problem

    Firstly, what is the error - please paste errors so that we have a better idea of your problem.

    Secondly, what is the filename of the new shipping module.

    Thirdly, have you gone through and replaced all three references to 'storepickup' to 'cod'?

    Absolute

  10. #20
    Join Date
    Feb 2007
    Posts
    90
    Plugin Contributions
    0

    Default Re: Cloned shipping module problem

    I've quoted the first post from this thread as this is what is happening again.
    Only difference now is the mistake found earlier is now not the cause
    Quote Originally Posted by psr racing View Post
    I just attemted to clone a shipping module (storepickup) to create an identical module (COD). I went through and changed 'storepickup' to 'cod' and 'STOREPICKUP' to 'COD' in both the relevant files but now i get this error under the Admin/ shipping modules
    Fatal error: Cannot redeclare class storepickup in /home/pow10934/public_html/includes/modules/shipping/storepickup.php on line 13

    I cant work out where I went wrong, especially as line 13 doesn't seem relevant to the operation of the file?
    Also the 'storepickup' module now doesnt show under 'shipping modules' and the 'COD' module is showing as MODULE_SHIPPING_COD_TEXT_TITLE instead of just 'COD'
    Storepickup still shows up as an option to shoppers though?

 

 
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. v154 Help with cloned shipping module
    By gwynwyffar in forum Addon Shipping Modules
    Replies: 2
    Last Post: 17 Feb 2016, 03:36 PM
  2. Help...weird problem with cloned UPS shipping module
    By nomoremoo in forum Addon Shipping Modules
    Replies: 0
    Last Post: 7 Sep 2010, 01:12 AM
  3. Using a cloned shipping module
    By Verne in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 2 Aug 2009, 10:13 PM
  4. Cloned Shipping Module problem?
    By slannesh in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 19 Jun 2009, 04:18 PM
  5. Cloned Shipping Module not working
    By Sake in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 24 Sep 2007, 04:12 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR