Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1. #1
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Need to know how to set a default shipping option

    I get that Zen Cart by default doesn't select a payment method or shipping option by default.. I don't agree with the logic behind this, but that is a whole 'nuther discussion..

    In a store with only ONE payment method and only ONE shipping method, these singular options SHOULD be selected by default without requiring an intervening user action to select them.

    Does anyone know HOW to accomplish this?? Has anyone done this and would care to share their solution with the class??
    Last edited by DivaVocals; 6 Feb 2015 at 11:14 AM. Reason: mis-spell in title
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  2. #2
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Need to know how to set a default payment option & default shipping option

    Quote Originally Posted by DivaVocals View Post
    I get that Zen Cart by default doesn't select a payment method or shipping option by default.. I don't agree with the logic behind this, but that is a whole 'nuther discussion..
    Actually it does (or should) select a default shipping method. It uses the cheapest method that isn't a local pickup.

    Quote Originally Posted by DivaVocals View Post
    In a store with only ONE payment method and only ONE shipping method, these singular options SHOULD be selected by default without requiring an intervening user action to select them.
    Agreed.

    Quote Originally Posted by DivaVocals View Post
    Does anyone know HOW to accomplish this?? Has anyone done this and would care to share their solution with the class??
    Shouldn't be difficult. Find the code where the payment method(s) are generated for display, and add 'checked' next to the value. EG:

    <input type="radio" name=myradio value="whatever" checked>whatever

    Cheers
    RodG

  3. #3
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: Need to know how to set a default payment option & default shipping option

    Quote Originally Posted by RodG View Post
    Actually it does (or should) select a default shipping method. It uses the cheapest method that isn't a local pickup.


    I thought so too, but in a store where shipping UNDER $1000 is a flat rate and anything OVER $1000 is free shipping only ONE option will ever be shown to a customer, and therefore SHOULD be selected by default, but this is NOT happening. The customer is REQUIRED to have to select the radio button..

    Quote Originally Posted by RodG View Post
    Shouldn't be difficult. Find the code where the payment method(s) are generated for display, and add 'checked' next to the value. EG:

    <input type="radio" name=myradio value="whatever" checked>whatever
    Yeah.. Except I've looked at the code on the checkout shipping page,and I am at a loss on how where to do this..
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  4. #4
    Join Date
    Aug 2009
    Location
    North Idaho, USA
    Posts
    2,008
    Plugin Contributions
    1

    Default Re: Need to know how to set a default payment option & default shipping option

    Maybe it's a bug,

    includes/classes/payment.php ~ line 83

    Code:
     $include_modules = array_values($include_modules);
          // if there is only one payment method, select it as default because in
          // checkout_confirmation.php the $payment variable is being assigned the
          // $_POST['payment'] value which will be empty (no radio button selection possible)
          if ( (zen_count_payment_modules() == 1) && (!isset($_SESSION['payment']) || (isset($_SESSION['payment']) && !is_object($_SESSION['payment']))) ) {
    I have seen this happen after selecting PayPal Express Checkout, redirected to PP for login, return to ZC, then step 2 of checkout has no option to select payment method since PP has been selected prior to beginning the checkout process.

    For me, shipping method preselected appears to only occur IF USPS is an option. If filters remove USPS options, then no option of the remaining shipping methods is preselected
    Rick
    RixStix (dot) com
    aka: ChainWeavers (dot) com

  5. #5
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Need to know how to set a default payment option & default shipping option

    Quote Originally Posted by DivaVocals View Post
    In a store with only ONE payment method and only ONE shipping method, these singular options SHOULD be selected by default without requiring an intervening user action to select them.
    Actually, for payment it does. I just checked again to be sure.

    So, which specific payment module are you having this problem with?
    .

    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.

  6. #6
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: Need to know how to set a default payment option & default shipping option

    Quote Originally Posted by DrByte View Post
    Actually, for payment it does. I just checked again to be sure.

    So, which specific payment module are you having this problem with?
    Zone payments.. It's the ONLY one available when the cart total is under $1000.. and it's definitely NOT selected by default..

    BUT I was looking at the includes/templates/YOUR_TEMPLATE/templates/tpl_checkout_shipping_default.php file and (starting at around line 76) found this block of code:

    Code:
    <?php
            } else {
              for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
    // set the radio button to be checked if it is the method chosen
                $checked = FALSE;
                if (isset($_SESSION['shipping']) && isset($_SESSION['shipping']['id'])) {
                  $checked = ($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $_SESSION['shipping']['id']);
                }
                if ( ($checked == true) || ($n == 1 && $n2 == 1) ) {
                  //echo '      <div id="defaultSelected" class="moduleRowSelected">' . "\n";
                //} else {
                  //echo '      <div class="moduleRow">' . "\n";
                }
    ?>
    If I change the $checked variable to = TRUE, THEN the Zone shipping is checked by default.. But honestly because I am not FULLY clear on each piece of this code, I don't know whether this impacts something else in a negative way..
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  7. #7
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Need to know how to set a default payment option & default shipping option

    Quote Originally Posted by DivaVocals View Post
    If I change the $checked variable to = TRUE, THEN the Zone shipping is checked by default.. But honestly because I am not FULLY clear on each piece of this code, I don't know whether this impacts something else in a negative way..
    Ya, that'd be bad since now it's gonna mark *all* modules as "checked" and that'll give unexpected results when you've got more than one module.
    There's code on the page to handle when there's only 1 payment module available ... in which case it doesn't give a radio button at all, and "pre-checks" the only-available module via a hidden field.

    Edit:
    Sorry, I keep answering in the context of PAYMENT modules because that's the title of this thread (or at least the visible part before opening the thread), and yet you keep posting about shipping modules.
    Last edited by DrByte; 6 Feb 2015 at 10:07 PM. Reason: payment vs shipping
    .

    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.

  8. #8
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: Need to know how to set a default payment option & default shipping option

    Quote Originally Posted by DrByte View Post
    Ya, that'd be bad since now it's gonna mark *all* modules as "checked" and that'll give unexpected results when you've got more than one module.
    There's code on the page to handle when there's only 1 payment module available ... in which case it doesn't give a radio button at all, and "pre-checks" the only-available module via a hidden field.

    Edit:
    Sorry, I keep answering in the context of PAYMENT modules because that's the title of this thread (or at least the visible part before opening the thread), and yet you keep posting about shipping modules.
    Yeah I shoulda led with the SHIPPING.. It was late last night and I was sleep deprived and aggravated.. Upon further reflection, I have realized that this could NEVER apply to payments.. Anyway I can't fix the original post now.. right now my IMMEDIATE concern is the fact that the only shipping module available isn't selected by default, and I cannot figure out WHY..
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  9. #9
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Need to know how to set a default shipping option

    I totally understand the frustration thing!

    I've updated the thread title.
    .

    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.

  10. #10
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Need to know how to set a default shipping option

    Shipping modules are a little different from payment modules, in that there are 2 parts to them: the module itself, plus the "selected quote".

    Even modules which don't "retrieve live quotes from external sources" still have a list of quotes, even if that list is only a single entry.

    I was talking with Ajeh about this issue, and she said that maybe v1.5.0 and v1.5.1 worked a bit differently than v1.5.4. I haven't had time to look into any relevant code changes to see what behavior changes might have been introduced and why:
    Quote Originally Posted by ajeh
    In v1.5 and v1.5.1 if only Flat and Free Options is installed and Free Options is set for Total >= 1000.00 the default shipping is selected ...In v1.5.4 and v1.6 with only Flat and Free Options intalled and Free Options set for Total >=1000.00 the default shipping is NOT set ...
    Also in v1.5.4 and v1.6 if ONLY Flat is installed the default shipping is NOT set, even though, again, Flat is the only shipping option showing ...
    Note: in v1.5.4 and v1.6 if Store Pickup is installed then the default is set ...
    .

    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.

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. How to choose a different default shipping option?
    By amyleew in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 26 Nov 2011, 01:43 AM
  2. Need to set default shipping method to FedExGround
    By rgshearer in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 14 Apr 2011, 04:15 PM
  3. How can I set a default shipping weight?
    By stevefriedman71 in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 30 Apr 2008, 04:52 PM
  4. How to set option value with a set image as default of an attribute?
    By PaulRiedel in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 16 Aug 2007, 04:21 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