Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Feb 2008
    Location
    Rancho Cucamonga, CA, USA
    Posts
    5
    Plugin Contributions
    0

    Default Show CC payment method if cart is within admin controlled min/max settings

    THANKS FOR THE HELP FROM THE ONLINE GUYS AT #zencart at freenode.net

    This mod will allow you to show credit card payment method depending on the shopping cart total. For this example, the following settings are used:

    • Online CC gateway has $2500 limit
    • Authroize.net-AIM module installed, configured, and enabled (with mods)
    • Manual CC processing module installed, configured, and enabled (with mods)
    • Check/COD module installed, configured, and enabled
    • Some of your single-item products+shipping+tax/vat may exceed $2500 limit


    At checkout time cart total $2350.75. Following options will be presented:
    • Credit Card
    • Check/COD


    At checkout time cart total $3505.60. Following options will be presented:
    • Credit Card
    • Check/COD


    In scenario 1 where cart is under limit, the CC payment will be processed online by Authorize.net gateway and an email from Authorize.net will be sent to the admin email.

    In scenario 2 where cart is over the limit, the CC payment will be forwarded to the admin email for manual processing the credit card.

    In both cases, only 1 credit card payment method is presented to the customer.

    ===== [ZENCART_BASE]/includes/modules/payment/cc.php

    This part retrieves the limits from the configuration options
    PHP Code:
    function cc() {
        
    // first part skipped - add the next 2 lines towards the end
        
    $this->cc_min MODULE_PAYMENT_CC_MIN// ** Add this
        
    $this->cc_max MODULE_PAYMENT_CC_MAX// ** Add this

        
    if (is_object($order)) $this->update_status(); // ** Leave this alone

    This part checks if we want to show this CC payment option
    PHP Code:
    function selection() {
        global 
    $order;

        
    /**
         * The following 2 lines check if cart total is within the limits
         * If outside of limits, then disable module for processing for this transaction only
         */
        
    $this->enabled = (($this->enabled && $this->cc_min && $order->info["total"] < $this->cc_min) ? false $this->enabled );
        
    $this->enabled = (($this->enabled && $this->cc_max && $order->info["total"] >= $this->cc_max) ? false $this->enabled );

        
    // Wrap the rest of the function in an enabled check
        
    if ( $this->enabled) {
            for (
    $i=1$i<13$i++) {
              
    // rest of function stays the same
            
    }
        }     
    // ** Add closing bracket here for if .... statement
      

    This part adds limit options in admin->modules->payment->manual cc module configuration

    PHP Code:
      function install() {
        
    // add at the end of the function
        
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Minimum Charge Amount', 'MODULE_PAYMENT_CC_MIN', '0', 'Would you like to set a MINIMUM charge amount for this payment option? Leave at 0 for no mimimum. Whole dollar amounts only.', '6', '0', now())");
        
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Maximum Charge Amount', 'MODULE_PAYMENT_CC_MAX', '0', 'Would you like to set a MAXIMUM charge amount for this payment option? Leave at 0 for no maximum. Whole dollar amounts only.', '6', '0', now())");
      } 
    The following adds the MIN/MAX keys to they will be enabled

    PHP Code:
    function keys() {
    // ** Add MODULE_PAYMENT_CC_MIN
    // ** Add MODULE_PAYMENT_CC_MAX

    return array('MODULE_PAYMENT_CC_STATUS''MODULE_PAYMENT_CC_EMAIL''MODULE_PAYMENT_CC_ZONE''MODULE_PAYMENT_CC_ORDER_STATUS_ID''MODULE_PAYMENT_CC_SORT_ORDER''MODULE_PAYMENT_CC_COLLECT_CVV''MODULE_PAYMENT_CC_MIN''MODULE_PAYMENT_CC_MAX' );


    ===== [ZENCART_BASE]/includes/modules/payment/authorizenet_aim.php

    Do the same changes to authorizenet_aim.php except:

    instead of changing function cc(), make changes to function authorizenet_aim()

    Other function changes are the same.

    With possible minor alterations, the same code could be used for other CC processing modules.

  2. #2
    Join Date
    Feb 2008
    Location
    Rancho Cucamonga, CA, USA
    Posts
    5
    Plugin Contributions
    0

    Default Re: Show CC payment method if cart is within admin controlled min/max settings

    Missed the editing window - but.

    • Authorize.net AIM limits MINIMUM=0 MAXIMUM=2500
    • Manual CC limits MINIMUM=2500 MAXIMUM=0

  3. #3
    Join Date
    Feb 2008
    Location
    Rancho Cucamonga, CA, USA
    Posts
    5
    Plugin Contributions
    0

    Default To activate

    Once the above mods are in place, just login to admin, then
    - Remove the module if already installed
    - Install the module

    The option limits will now be in the configuration for the module

 

 

Similar Threads

  1. Step 2 of 3 - Payment Information doesn´t show payment method, bug?
    By dadex in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 10 Jun 2009, 03:42 PM
  2. Only show payment method when UPS shipping method chosen?
    By helen610 in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 28 Aug 2008, 03:04 AM
  3. Where are the admin settings for what to show when cart is empty?
    By dhcernese in forum Customization from the Admin
    Replies: 4
    Last Post: 16 Sep 2007, 02:31 PM
  4. *Mixed ON inbetween Min & Max values in Add to Cart???
    By JohnLillz in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 7 Nov 2006, 07:18 AM

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