Jump to content

Selection of shipping method as radio buttons


Rich

Recommended Posts

I have more than one shipping method and would like to have the available methods shown as radio buttons (with the default method selected). This would show the customer all the choices without requiring them to pull down the dropdown to make their selection.

I'm sure this topic has been discussed before but can't seem to find any example of the code changes required???

Has anyone done this and willing to share their solution?

 

Link to comment
Share on other sites

 

Its do-able, as an example you could swap out the default html for the shipping section and use something like:  (Layout/Files will vary depending on what skin you use)

** Example based on coding from Claudia M - https://forums.cubecart.com/topic/55954-radio-buttons-in-checkout/?tab=comments#comment-242431

<td colspan="4">
	{if !isset($free_coupon_shipping)}
		<label><b>{$LANG.basket.shipping_select}:</b></label>

		<ul class="no-bullet left">
			{foreach from=$SHIPPING key=group item=methods}
         			<li><small><strong>{$group}</strong></small></li>
				{foreach from=$methods item=method}
					<li>
						<input name="shipping" type="radio" value="{$method.value}" id="{$method.value}" {$method.selected|replace:'selected':'checked'}><label for="{$method.value}">{$method.display}</label>
					</li>
				{/foreach}
			{/foreach}	
		</ul>
	{/if}
</td>

 

Link to comment
Share on other sites

1 hour ago, fabriceunko said:

Interesting, but I do not see where to put your code .. you should know that I am very new in this manipulation, I use the foundation skin

 

For foundation based on the default skin you'd :

Open foundation > templates > content.checkout.medium-up.php lines 47-64 find:

            <td colspan="4">
               {if !isset($free_coupon_shipping)}
               {$LANG.basket.shipping_select}:
               <select name="shipping">
                  <option value="">{$LANG.form.please_select}</option>
                  {foreach from=$SHIPPING key=group item=methods}
                  {if $HIDE_OPTION_GROUPS ne '1'}
                  <optgroup label="{$group}">{/if}
                     {foreach from=$methods item=method}
                     <option value="{$method.value}" {$method.selected}>{$method.display}</option>
                     {/foreach}
                     {if $HIDE_OPTION_GROUPS ne '1'}
                  </optgroup>
                  {/if}
                  {/foreach}
               </select>
               {/if}
            </td>

 

now replace it with :

<td colspan="4">
	{if !isset($free_coupon_shipping)}
		<label><b>{$LANG.basket.shipping_select}:</b></label>

		<ul class="no-bullet left">
			{foreach from=$SHIPPING key=group item=methods}
         			{if $HIDE_OPTION_GROUPS ne '1'}<li><small><strong>{$group}</strong></small></li>{/if}
				{foreach from=$methods item=method}
					<li>
						<input name="shipping" type="radio" value="{$method.value}" id="{$method.value}" {$method.selected|replace:'selected':'checked'}><label for="{$method.value}">{$method.display}</label>
					</li>
				{/foreach}
			{/foreach}	
		</ul>
	{/if}
</td>

 

Open foundation > templates > content.checkout.small.php lines 86-100 find:

            {if !isset($free_coupon_shipping)}
            <select name="shipping" class="nomarg">
               <option value="">{$LANG.form.please_select}</option>
               {foreach from=$SHIPPING key=group item=methods}
               {if $HIDE_OPTION_GROUPS ne '1'}
               <optgroup label="{$group}">{/if}
                  {foreach from=$methods item=method}
                  <option value="{$method.value}" {$method.selected}>{$method.display}</option>
                  {/foreach}
                  {if $HIDE_OPTION_GROUPS ne '1'}
               </optgroup>
               {/if}
               {/foreach}
            </select>
            {/if}

 

Now replace it with:

	{if !isset($free_coupon_shipping)}
		<ul class="no-bullet left">
			{foreach from=$SHIPPING key=group item=methods}
         			{if $HIDE_OPTION_GROUPS ne '1'}<li><small><strong>{$group}</strong></small></li>{/if}
				{foreach from=$methods item=method}
					<li>
						<input name="shipping" type="radio" value="{$method.value}" id="{$method.value}" {$method.selected|replace:'selected':'checked'}><label for="{$method.value}">{$method.display}</label>
					</li>
				{/foreach}
			{/foreach}	
		</ul>
	{/if}

 

Save and clear site cache to see results.

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...