Results 1 to 10 of 52

Hybrid View

  1. #1
    Join Date
    Jan 2006
    Posts
    224
    Plugin Contributions
    0

    Default Re: COD only above certain order amount?

    did I miss something?? the COD is still shown?

    my code
    -----------------------------------
    // turn off COD for low value
    if (zen_get_shipping_enabled($this->code) and $total_cart >= 50) {
    $this->enabled = ((MODULE_SHIPPING_COD_STATUS == 'True') ? true : false);
    }
    // turn off COD for table
    if (substr_count($_SESSION['shipping']['id'], 'table') == 1) {
    $this->enabled = false;
    }

    // disable the module if the order only contains virtual products
    if ($this->enabled == true) {
    if ($order->content_type != 'physical') {
    $this->enabled = false;
    }
    }
    }

    -----------------------------------

  2. #2
    Join Date
    Jan 2006
    Posts
    224
    Plugin Contributions
    0

    Default Re: COD only above certain order amount?

    Hi, what is this MODULE_SHIPPING_COD_STATUS?
    Does not appear any where else in any other file.... I am using 1.36, if that matters

  3. #3
    Join Date
    Dec 2005
    Posts
    1,509
    Plugin Contributions
    6

    Default Re: COD only above certain order amount?

    Quote Originally Posted by ronwong View Post
    Hi, what is this MODULE_SHIPPING_COD_STATUS?
    Does not appear any where else in any other file.... I am using 1.36, if that matters
    That is probably why it isn't working for you. That was just a DEMO variable I used to represent the actual one (which would be in the module you are trying to edit). I do not have that module in front of me so I don't know the exact terminology.

    "MODULE_SHIPPING_COD_STATUS" is the Constant that refers back to the language file for that module (cod).

    To make it work, you should replace that with the proper constant value (found in that shipping module you are trying to edit).
    Eric
    20 Ways to Increase Sales Using Zen Cart
    Zen Cart contribs: Simple Google Analytics, Export Shipping Information

  4. #4
    Join Date
    Jan 2006
    Posts
    224
    Plugin Contributions
    0

    Default Re: COD only above certain order amount?

    Hi, this does not work either

    ------------------------
    // turn off COD for low value
    if (zen_get_shipping_enabled($this->code) and $total_cart >= 50) {
    $this->enabled = ((MODULE_PAYMENT_COD_STATUS == 'True') ? true : false);
    }
    -----------------------

  5. #5
    Join Date
    Dec 2005
    Posts
    1,509
    Plugin Contributions
    6

    Default Re: COD only above certain order amount?

    I'd have to actually see the page of code you are trying to alter to tell you where to place it and to find out if that code is the exact code you need.

    It is the "style" you want to follow though. I used it on a few sites (for shipping etc..) and it worked fine. Again, though, those are different modules.
    Eric
    20 Ways to Increase Sales Using Zen Cart
    Zen Cart contribs: Simple Google Analytics, Export Shipping Information

  6. #6
    Join Date
    Jan 2006
    Posts
    224
    Plugin Contributions
    0

    Default Re: COD only above certain order amount?

    The following is the standard cod.php file that came with the installation,

    '// turn off COD for table' and '// turn off COD for low value' is what I tried to add, both does not work

    I really appreciate your help...

    --------------------------
    <?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: cod.php 1105 2005-04-04 22:05:35Z birdbrain $
    //

    class cod {
    var $code, $title, $description, $enabled;

    // class constructor
    function cod() {
    global $order;

    $this->code = 'cod';
    $this->title = MODULE_PAYMENT_COD_TEXT_TITLE;
    $this->description = MODULE_PAYMENT_COD_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_PAYMENT_COD_SORT_ORDER;

    $this->enabled = ((MODULE_PAYMENT_COD_STATUS == 'True') ? true : false);

    if ((int)MODULE_PAYMENT_COD_ORDER_STATUS_ID > 0) {
    $this->order_status = MODULE_PAYMENT_COD_ORDER_STATUS_ID;
    }

    if (is_object($order)) $this->update_status();
    }

    // class methods
    function update_status() {
    global $order, $db;

    if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_COD_ZONE > 0) ) {
    $check_flag = false;
    $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_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;
    }
    }

    // turn off COD for table
    if (substr_count($_SESSION['shipping']['id'], 'table') == 1) {
    $this->enabled = false;
    }


    // turn off COD for low value
    if (zen_get_shipping_enabled($this->code) and $total_cart >= 50) {
    $this->enabled = ((MODULE_PAYMENT_COD_STATUS == 'True') ? true : false);
    }



    // disable the module if the order only contains virtual products
    if ($this->enabled == true) {
    if ($order->content_type != 'physical') {
    $this->enabled = false;
    }
    }
    }

    function javascript_validation() {
    return false;
    }

    function selection() {
    return array('id' => $this->code,
    'module' => $this->title);
    }

    function pre_confirmation_check() {
    return false;
    }

    function confirmation() {
    return false;
    }

    function process_button() {
    return false;
    }

    function before_process() {
    return false;
    }

    function after_process() {
    return false;
    }

    function get_error() {
    return false;
    }

    function check() {
    global $db;
    if (!isset($this->_check)) {
    $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_COD_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 Cash On Delivery Module', 'MODULE_PAYMENT_COD_STATUS', 'True', 'Do you want to accept Cash On Delivery payments?', '6', '1', '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, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_COD_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', '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 of display.', 'MODULE_PAYMENT_COD_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_COD_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
    }

    function remove() {
    global $db;
    $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }

    function keys() {
    return array('MODULE_PAYMENT_COD_STATUS', 'MODULE_PAYMENT_COD_ZONE', 'MODULE_PAYMENT_COD_ORDER_STATUS_ID', 'MODULE_PAYMENT_COD_SORT_ORDER');
    }
    }
    ?>

  7. #7
    Join Date
    Dec 2005
    Posts
    1,509
    Plugin Contributions
    6

    Default Re: COD only above certain order amount?

    You want it to look like this. As I mentioned in the previous post, the information I sent you was for example only to get you moving in the right direction. You had the wrong variable and did not specify the order total to run your figures against on the page.

    --------------------------
    <?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: cod.php 1105 2005-04-04 22:05:35Z birdbrain $
    //

    class cod {
    var $code, $title, $description, $enabled;

    // class constructor
    function cod() {
    global $order;

    $this->code = 'cod';
    $this->title = MODULE_PAYMENT_COD_TEXT_TITLE;
    $this->description = MODULE_PAYMENT_COD_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_PAYMENT_COD_SORT_ORDER;

    //$this->enabled = ((MODULE_PAYMENT_COD_STATUS == 'True') ? true : false);
    $total_cart = $_SESSION['cart']->show_total();
    if ($total_cart >= 50) {
    $this->enabled = ((MODULE_PAYMENT_COD_STATUS == 'True') ? true : false);
    }


    if ((int)MODULE_PAYMENT_COD_ORDER_STATUS_ID > 0) {
    $this->order_status = MODULE_PAYMENT_COD_ORDER_STATUS_ID;
    }

    if (is_object($order)) $this->update_status();
    }

    // class methods
    function update_status() {
    global $order, $db;

    if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_COD_ZONE > 0) ) {
    $check_flag = false;
    $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_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;
    }
    }

    // turn off COD for table
    if (substr_count($_SESSION['shipping']['id'], 'table') == 1) {
    $this->enabled = false;
    }


    // turn off COD for low value
    if (zen_get_shipping_enabled($this->code) and $total_cart >= 50) {
    $this->enabled = ((MODULE_PAYMENT_COD_STATUS == 'True') ? true : false);
    }



    // disable the module if the order only contains virtual products
    if ($this->enabled == true) {
    if ($order->content_type != 'physical') {
    $this->enabled = false;
    }
    }
    }

    function javascript_validation() {
    return false;
    }

    function selection() {
    return array('id' => $this->code,
    'module' => $this->title);
    }

    function pre_confirmation_check() {
    return false;
    }

    function confirmation() {
    return false;
    }

    function process_button() {
    return false;
    }

    function before_process() {
    return false;
    }

    function after_process() {
    return false;
    }

    function get_error() {
    return false;
    }

    function check() {
    global $db;
    if (!isset($this->_check)) {
    $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_COD_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 Cash On Delivery Module', 'MODULE_PAYMENT_COD_STATUS', 'True', 'Do you want to accept Cash On Delivery payments?', '6', '1', '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, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_COD_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', '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 of display.', 'MODULE_PAYMENT_COD_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_COD_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
    }

    function remove() {
    global $db;
    $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }

    function keys() {
    return array('MODULE_PAYMENT_COD_STATUS', 'MODULE_PAYMENT_COD_ZONE', 'MODULE_PAYMENT_COD_ORDER_STATUS_ID', 'MODULE_PAYMENT_COD_SORT_ORDER');
    }
    }
    ?>
    Eric
    20 Ways to Increase Sales Using Zen Cart
    Zen Cart contribs: Simple Google Analytics, Export Shipping Information

  8. #8
    Join Date
    Jan 2006
    Posts
    224
    Plugin Contributions
    0

    Default Re: COD only above certain order amount?

    Hi Linda, your code has problem as well, with a clean cod.php file and your additional codes, its ok on the customer side checkout. It is also ok in admin when I click modules-payment. But when I open the admin-customers-orders, and click to open each order, orders with COD as payment will not open, and there is a line:

    PHP Fatal error: Call to a member function on a non-object in C:\Program Files\Ensim\Sitedata\onlineshop\Inetpub\wwwroot\includes\modules\payment\cod.php on line 74

    line 74 refers to this line:

    if ($_SESSION['cart']->show_total() < 50) {

    I have taken out all other codes regarding the other conditions. so its down to the baisc total>50 codes only.

    Any idea?

  9. #9
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: COD only above certain order amount?

    Where exactly are you when you see this error?

    I am trying to reproduce it ...
    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!

 

 

Similar Threads

  1. Set up International Shipping ONLY if below a certain dollar amount?
    By dat311 in forum Built-in Shipping and Payment Modules
    Replies: 7
    Last Post: 23 May 2013, 04:01 AM
  2. How do I ship free over a certain amount for only 1 zone?
    By boy1da in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 22 Oct 2010, 06:44 PM
  3. COD only apply to certain user group
    By yosemirza in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 21 Oct 2010, 07:12 PM
  4. Taxes only apply to orders over a certain amount??
    By apemusic in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 7
    Last Post: 30 Jan 2008, 11:41 PM
  5. Allowing a gift cert. only over a certain amount in cart
    By Dashizna in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 1
    Last Post: 15 Jun 2007, 11:53 PM

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