Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default COD - Cash on Delivery Payment Module - Customised - Make it Work with Free Shipping

    ***EDIT*** It's not the COD module (this does work) it's the accountholder module

    We have a customised version of the "accountholder" payment module installed on our site at www.silkblooms.co.uk. We use a butchered version of this module to allow our customers to checkout on a payment plan.

    The only issue we have with this at the moment is making it work when the product is set with these parameters:

    Product is Virtual: - Yes, Skip Shipping Address
    Always Free Shipping: - Yes, Always Free Shipping

    Is there a way to make a payment module work when these product settings are used?
    Last edited by limelites; 9 Jan 2013 at 03:07 PM.

  2. #2
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: COD - Cash on Delivery Payment Module - Customised - Make it Work with Free Shipp

    Quote Originally Posted by limelites View Post
    ***EDIT*** It's not the COD module (this does work) it's the accountholder module

    We have a customised version of the "accountholder" payment module installed on our site at www.silkblooms.co.uk. We use a butchered version of this module to allow our customers to checkout on a payment plan.

    The only issue we have with this at the moment is making it work when the product is set with these parameters:

    Product is Virtual: - Yes, Skip Shipping Address
    Always Free Shipping: - Yes, Always Free Shipping

    Is there a way to make a payment module work when these product settings are used?

    Actually, COD and ACCOUNTHOLDER are the same module. I think accountholder is a butchered version of COD. however, COD comes up as an option at the checkout confirmation page but accountholder doesn't. Does anyone know why?

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

    Default Re: COD - Cash on Delivery Payment Module - Customised - Make it Work with Free Shipp

    I am not familar with this accountholder ... could you post the file in the:
    /includes/modules/payment

    that you are using?
    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!

  4. #4
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: COD - Cash on Delivery Payment Module - Customised - Make it Work with Free Shipp

    Hi Ajeh,

    This was the mod in it's original state:

    http://www.zen-cart.com/downloads.php?do=file&id=346


    However, we've been playing with it somewhat:

    includes/modules/payment/accountholder.php
    PHP Code:
    <?php

      
    class accountholder {
        var 
    $code$title$description$enabled;

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

          
    $this->code 'accountholder';
          
    $this->title MODULE_PAYMENT_ACCOUNTHOLDER_TEXT_TITLE;
          if (
    IS_ADMIN_FLAG === true && (MODULE_PAYMENT_ACCOUNTHOLDER_PAYTO == 'Just pay the rest when you can' || MODULE_PAYMENT_ACCOUNTHOLDER_PAYTO == '')) $this->title .= '<span class="alert"> </span>';
          
    $this->description MODULE_PAYMENT_ACCOUNTHOLDER_TEXT_DESCRIPTION;
          
    $this->sort_order MODULE_PAYMENT_ACCOUNTHOLDER_SORT_ORDER;
          
    $this->enabled = ((MODULE_PAYMENT_ACCOUNTHOLDER_STATUS == 'True') ? true false);
          if (!
    IS_ADMIN_FLAG) {
      global 
    $cart;
      if (
    $_SESSION['cart']->show_weight() == 0) {
        
    $this->enabled false;
      }
    }
          
          
    // bof: disable based on Order Amount
    // use $order->info['subtotal'] or $order->info['subtotal']
    if (!IS_ADMIN_FLAG && $order->info['subtotal'] < 100.00) {
    $this->enabled false;
    }
    //echo 'I SEE ' . 'Subtotal: ' . $order->info['subtotal'] . ' Total: ' . $order->info['total'] . '<br>';
    // eof: disable based on Order Amount 

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

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

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

          if ( (
    $this->enabled == true) && ((int)MODULE_PAYMENT_ACCOUNTHOLDER_ZONE 0) ) {
            
    $check_flag false;
            
    $check $db->Execute("select zone_id from " TABLE_ZONES_TO_GEO_ZONES " where geo_zone_id = '" MODULE_PAYMENT_ACCOUNTHOLDER_ZONE "' and zone_country_id = '" $order->billing['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->billing['zone_id']) {
                
    $check_flag true;
                break;
              }
              
    $check->MoveNext();
            }

            if (
    $check_flag == false) {
              
    $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 array(
    'title' => MODULE_PAYMENT_ACCOUNTHOLDER_TEXT_DESCRIPTION);
        }

        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_ACCOUNTHOLDER_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 Account Holder Module', 'MODULE_PAYMENT_ACCOUNTHOLDER_STATUS', 'True', 'Do you want to activate the Account Holder payment option?', '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, date_added) values ('Make Payable to:', 'MODULE_PAYMENT_ACCOUNTHOLDER_PAYTO', 'Just pay the rest when you can', 'Who should payments be made payable to?', '6', '1', 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_ACCOUNTHOLDER_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, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_ACCOUNTHOLDER_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, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_ACCOUNTHOLDER_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_ACCOUNTHOLDER_STATUS''MODULE_PAYMENT_ACCOUNTHOLDER_ZONE''MODULE_PAYMENT_ACCOUNTHOLDER_ORDER_STATUS_ID''MODULE_PAYMENT_ACCOUNTHOLDER_SORT_ORDER''MODULE_PAYMENT_ACCOUNTHOLDER_PAYTO');
        }
      }
    ?>
    /includes/languages/english/modules/payment/accountholder.php
    PHP Code:
    <?php
      define
    ('MODULE_PAYMENT_ACCOUNTHOLDER_TEXT_TITLE''<img src="https://www.silkblooms.co.uk/includes/templates/freetemplate2/images/arrow.gif" class="GCWeeButton"> Pay by Instalments');
      
    define('MODULE_PAYMENT_ACCOUNTHOLDER_TEXT_DESCRIPTION''Please use this link to pay your deposit: http://www.silkblooms.co.uk/pay/<br />' MODULE_PAYMENT_ACCOUNTHOLDER_PAYTO '<br /><br />Thank you for shopping at:<br />' nl2br(STORE_NAME_ADDRESS) . '<br /><br />' '');
      
    define('MODULE_PAYMENT_ACCOUNTHOLDER_TEXT_EMAIL_FOOTER'"Please use this link to pay your deposit: http://www.silkblooms.co.uk/pay/" "\n\n" MODULE_PAYMENT_ACCOUNTHOLDER_PAYTO "\n\nThank you for shopping with:\n" STORE_NAME_ADDRESS "\n\n" '');
    ?>
    /includes/languages/english/CUSTOM/checkout_payment.php
    PHP Code:
    <?php

    define
    ('NAVBAR_TITLE_1''Checkout - Step 1');
    define('NAVBAR_TITLE_2''Payment Method - Step 2');

    define('HEADING_TITLE''Step 2 of 3 - Payment Information');

    define('TABLE_HEADING_BILLING_ADDRESS''Billing Address');
    define('TEXT_SELECTED_BILLING_DESTINATION''Your billing address is shown to the left. The billing address should match the address on your credit card statement. You can change the billing address by clicking the <em>Change Address</em> button.');
    define('TITLE_BILLING_ADDRESS''Billing Address:');

    define('TABLE_HEADING_PAYMENT_METHOD''Payment Method');

          
    /*The following line can be adjusted to include/alter appropriate text description for the Account Holders Only payment option
          DO NOT comment out the line... just alter the text description if necessary */
           
    define('TEXT_SELECT_PAYMENT_METHOD''Please select a payment method for this order.<br /><br />Authorised Account Holders may use the <strong>Account Holders Only</strong> payment option.<br /><br />If you are <strong>not</strong> an Authorised Account Holder, your order may not be processed, so please choose other payment options.');

    define('TITLE_PLEASE_SELECT''Please Select');
    define('TEXT_ENTER_PAYMENT_INFORMATION''');
    define('TABLE_HEADING_COMMENTS''Special Instructions or Order Comments');

    define('TITLE_NO_PAYMENT_OPTIONS_AVAILABLE''Not Available At This Time');
    define('TEXT_NO_PAYMENT_OPTIONS_AVAILABLE','<span class="alert">Sorry, we are not accepting payments from your region at this time.</span><br />Please contact us for alternate arrangements.');

    define('TITLE_CONTINUE_CHECKOUT_PROCEDURE''<strong>Continue to Step 3</strong>');
    define('TEXT_CONTINUE_CHECKOUT_PROCEDURE''- to confirm your order.');

    define('TABLE_HEADING_CONDITIONS''<span class="termsconditions">Terms and Conditions</span>');
    define('TEXT_CONDITIONS_DESCRIPTION''<span class="termsdescription">Please acknowledge the terms and conditions bound to this order by ticking the following box. The terms and conditions can be read <a href="' zen_href_link(FILENAME_CONDITIONS'''SSL') . '"><span class="pseudolink">here</span></a>.');
    define('TEXT_CONDITIONS_CONFIRM''<span class="termsiagree">I have read and agreed to the terms and conditions bound to this order.</span>');

    define('TEXT_CHECKOUT_AMOUNT_DUE''Total Amount Due: ');
    define('TEXT_YOUR_TOTAL','Your Total');
    ?>

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

    Default Re: COD - Cash on Delivery Payment Module - Customised - Make it Work with Free Shipp

    The way this is written ...

    If Weight = 0, it will not show ...

    If Amount is < 100, it will not show ...

    So if you have a Virtual Product ... that will not show ...

    And if you have an Always Free Shipping Product ... that will not show ...

    You have the conditions being set by:
    Code:
          if (!IS_ADMIN_FLAG) {
      global $cart;
      if ($_SESSION['cart']->show_weight() == 0) {
        $this->enabled = false;
      }
    }
    
          // bof: disable based on Order Amount
    // use $order->info['subtotal'] or $order->info['subtotal']
    if (!IS_ADMIN_FLAG && $order->info['subtotal'] < 100.00) {
    $this->enabled = false;
    }
    Is this perhaps what is giving you grief?
    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!

  6. #6
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: COD - Cash on Delivery Payment Module - Customised - Make it Work with Free Shipp

    Hi Ajeh,

    I remember that now! Yes, this is a sort of paradox as I need both of those statements in there.

    <100 needs to be there so the option isn't available on orders below this monetary value.

    There may be an alternative to "if weight = 0" though. If I recall rightly, we added this in so that it wouldn't appear as an option when product ID 1652 is in their cart. I may be wrong on that. We have the weight of product ID 1652 set to 0 so that this payment option doesn't work for this. (1652 is the method they use to pay an instalment towards their main order you see). All other products have a weight above zero.

    Would there be a way to change "if weight = 0" to "if product ID 1652 is in your cart"?

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

    Default Re: COD - Cash on Delivery Payment Module - Customised - Make it Work with Free Shipp

    Perhaps using:

    $_SESSION['cart']->get_quantity(1652) > 0
    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!

  8. #8
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: COD - Cash on Delivery Payment Module - Customised - Make it Work with Free Shipp

    This is brilliant Ajeh! This one's been annoying me since we started this site! Slowly but surely you're helping me get rid of all the glitches that are niggling away at me :) You have an amazing head for all this!!

    Now, on to the next thing.......

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

    Default Re: COD - Cash on Delivery Payment Module - Customised - Make it Work with Free Shipp

    Thanks for the update that this is now working ... remember the Zen Cart Team when you are rich and famous!
    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!

  10. #10
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: COD - Cash on Delivery Payment Module - Customised - Make it Work with Free Shipp

    Quote Originally Posted by Ajeh View Post
    Thanks for the update that this is now working ... remember the Zen Cart Team when you are rich and famous!
    I will, definitely! Meantime, I've just bought you all a few coffees!

    http://www.zen-cart.com/donate (d)

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Help with COD - Cash on delivery
    By Alquimio in forum General Questions
    Replies: 2
    Last Post: 11 Nov 2009, 03:56 PM
  2. Cash on delivery (COD) fee configuration
    By Timmy in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 24 Apr 2008, 07:35 PM
  3. shipping per weight with cash on delivery extra charge
    By Llama de Anor in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 4 Mar 2008, 07:06 AM
  4. COD Fee not applied on Free Shipping Options module
    By Svanis in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 20 Jun 2007, 09:43 AM
  5. Free shipping but not free Cash On Delivery fee
    By Typhoon in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 26 Mar 2007, 07:37 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