Announcement

Collapse
No announcement yet.

Radio Buttons for Shipping Methods with a Default method checked

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Radio Buttons for Shipping Methods with a Default method checked

    I changed the shipping methods from select box to radio buttons and here is the code I am currently using

    Code:
                                       <mvt:foreach array="shippingmethods" iterator="method">
                                           <mvt:if expr="NOT ISNULL l.settings:method:price">
                                              <input type="radio" name="ShippingMethod" value="&mvte:method:module;:&mvte:method:code;"<mvt:if expr="g.ShippingMethod EQ l.settings:method:module $ ':' $ l.settings:method:code"> checked="checked"</mvt:if>><span class="s&mvte:method:code;">&mvt:method:name; (&mvt:method:formatted_price;)</span>
                                            <mvt:else>
                                               <input type="radio" name="ShippingMethod" value="&mvte:method:module;:&mvte:method:code;"<mvt:if expr="g.ShippingMethod EQ l.settings:method:module $ ':' $ l.settings:method:code"> checked="checked"</mvt:if>><span class="s&mvte:method:code;">&mvt:method:name;</span>
                                             </mvt:if>
                                         </mvt:foreach>
    but for some reason I am not able to set the first shipping method as default. Is there way to set a particular shipping method as default in the Miva Admin

    Thanks
    Keyboard Not Found..... Press F1 to continue

    #2
    Re: Radio Buttons for Shipping Methods with a Default method checked

    Not within the admin.
    You have to test the condition in the template and when the condition is found set THAT radio button to CHECKED.

    Or, you could leave them all unchecked, and then only allow the "continue" button to be clicked IF a shipping method radio button is selected (preferred cause folks will often just leave the default then complain later that they didn't want THAT method).

    -Bruce
    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment


      #3
      Re: Radio Buttons for Shipping Methods with a Default method checked

      Thanks for the reply,

      Yes Currently I don't have any default method checked in as I want to the customer to choose an option but I am trying to a shipping promo at flat rate 5.00 for all order on ground shipping and hence wanted the ground shipping option to the selected as default.

      Thanks
      Keyboard Not Found..... Press F1 to continue

      Comment


        #4
        Re: Radio Buttons for Shipping Methods with a Default method checked

        Try a variation of this:

        Code:
        <mvt:foreach array="shippingmethods" iterator="method">
                        <mvt:if expr="ISNULL g.shippingmethods AND pos1 EQ 1">
                        <span><input type="radio" checked id="&mvte:method:code;" name="ShippingMethod" value="&mvte:method:module;:&mvte:method:code;"></span><label for="&mvte:method:code;">&mvt:method:name; (&mvt:method:formatted_price;)</label><br />
                        <mvt:else>
                        <mvt:if expr="NOT ISNULL l.settings:method:price">
                        <span><input type="radio" id="&mvte:method:code;" name="ShippingMethod" value="&mvte:method:module;:&mvte:method:code;"></span><label for="&mvte:method:code;">&mvt:method:name; (&mvt:method:formatted_price;)</label><br /> 
                        <mvt:else>
        
                        <span><input type="radio" id="&mvte:method:code;" name="ShippingMethod" value="&mvte:method:module;:&mvte:method:code;"></span><label for="&mvte:method:code;">&mvt:method:name;</label><br />
                        </mvt:if>
                        </mvt:if>
                        </mvt:foreach>

        Comment


          #5
          I have the exact opposite question... what if I want to have no default method selected and I want to "force" the user to select a shipping method?

          Comment


            #6
            Try this:

            Code:
            <mvt:foreach array="shippingmethods" iterator="method">
            <mvt:if expr="NOT ISNULL l.settings:method:price">
            <span><input type="radio" id="&mvte:method:code;" name="ShippingMethod" value="&mvte:method:module;:&mvte:method:code;"></span><label for="&mvte:method:code;">&mvt:method:name; (&mvt:method:formatted_price;)</label><br />
            <mvt:else>
            
            <span><input type="radio" id="&mvte:method:code;" name="ShippingMethod" value="&mvte:method:module;:&mvte:method:code;"></span><label for="&mvte:method:code;">&mvt:method:name;</label><br />
            </mvt:if>
            </mvt:foreach>
            THe idea is to remove the first iteration that checked the box by default. Hope it works !!

            Comment


              #7
              Thanks for the update. I ended up finding the issue in one of the client's custom scripts files. The jquery toggle options were not set properly.

              Comment

              Working...
              X