Radio Buttons for Shipping Methods with a Default method checked
Collapse
X
-
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.
-
Try this:
THe idea is to remove the first iteration that checked the box by default. Hope it works !!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>
Leave a comment:
-
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?
Leave a comment:
-
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>
Leave a comment:
-
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
Leave a comment:
-
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
Leave a comment:
-
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
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 AdminCode:<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>
ThanksTags: None
Leave a comment: