Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2007
    Posts
    8
    Plugin Contributions
    0

    Default Changing the default payment option

    (ZC 1.3.7.1)

    This has come up a couple of times, e.g. http://www.zen-cart.com/forum/showpost.php?p=305832

    I also had the desire to auto-select whatever happened to be the first payment option in the list, but I did it in one line.

    again, edit /includes/templates/template_default/templates/tpl_checkout_payment_default.php

    Around line 138 change

    Code:
    <? php echo zen_draw_radio_field('payment', $selection[$i]['id'], ($selection[$i]['id'] == $_SESSION['payment'] ? true : false), 'id="pmt-'.$selection[$i]['id'].'"'); ?>
    so that it says this instead:

    Code:
    <?php echo zen_draw_radio_field('payment', $selection[$i]['id'], (!$i ? true : false), 'id="pmt-'.$selection[$i]['id'].'"'); ?>
    It takes advantage of the $i in the for() loop just above so logically "NOT $i" will always be boolean true for the first item in the list, and only the first item.

    Have I missed something subtle? I tried it in conjunction with payment modules only being available for a certain zone / currency and it still seems to work fine :)
    Last edited by gdhgdh; 3 Jan 2008 at 11:01 PM. Reason: typo

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Changing the default payment option

    Which payment modules do you have enabled?
    Which one are you wanting it to default to?

    It's not wise to blindly select one method vs another without letting the customer know you've possibly changed their previous selection ...
    ie: navigating back and forth between checkout pages and/or changing addresses can cause available payment options to change ... and thus if you're automatically choosing a method for the customer, you could be causing trouble for them.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Dec 2007
    Posts
    8
    Plugin Contributions
    0

    Default Re: Changing the default payment option

    I have 'check' 'nochex_apc' and 'paypal' ..

    For my case, I want whatever module is displayed first to be auto-selected, and that's exactly what the one-line patch achieves in my testing - I just wondered if I'd missed something or made an incorrect assumption.

  4. #4
    Join Date
    Nov 2006
    Posts
    42
    Plugin Contributions
    0

    Default Re: Changing the default payment option

    Cheers for that code - seems to work ok for me. (1.3.7.1)

  5. #5
    Join Date
    Jan 2006
    Posts
    55
    Plugin Contributions
    0

    Default Re: Changing the default payment option

    Cheers - worked great for me too (again 1.3.7.1)
    Wanted to get this sorted for ages - thanks

 

 

Similar Threads

  1. Changing the words of a payment option to say Visa/AMEX
    By wildchick in forum Addon Payment Modules
    Replies: 2
    Last Post: 25 Jul 2011, 04:40 AM
  2. Changing Default Shipping Option to FedEx instead of flat?
    By stlnyc in forum Built-in Shipping and Payment Modules
    Replies: 13
    Last Post: 28 Dec 2010, 09:18 AM
  3. credit card payment option selected as default
    By mediathing in forum Managing Customers and Orders
    Replies: 3
    Last Post: 24 Feb 2009, 10:50 PM
  4. Hiding the 'default' option for required attributes
    By xtinexoop in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 16 Dec 2007, 11:09 PM
  5. How to controll the default option ?
    By mrbert in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 7 Apr 2007, 09:52 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