Jump to content

Selection of shipping method as radio buttons


Rich

Recommended Posts

Posted

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?

 

Posted

 

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>

 

Posted
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.

  • 1 year later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...