lilceda Posted December 18, 2008 Share Posted December 18, 2008 Hello i need to modify a .tpl file. in this file, there is a selection menu which is a drop down list as showed on the attached image. i need to put radio button. here is the small code: {* $Id: shipping_rates.tpl 4409 2007-12-07 16:47:48Z zeke $ *} {if $settings.Shippings.disable_shipping != 'Y' && $cart.shipping_required == 'Y'} <div class="clear-both"> {if $settings.General.one_page_checkout != 'Y' && ($target == 'checkout' && $mode == 'checkout')} {include file="common_templates/subheader.tpl" title=$lang.select_shipping_method content=$smarty.capture.mainbox anchor="shipping_rates"} {/if} <script type="text/javascript" language="javascript 1.2"> //<![CDATA[ var sf = new cscart_form('shippings_form', {$use_ajax|default:'false'}{if $use_ajax}, ['checkout_totals','checkout_steps']{/if}); //]]> </script> <form action="{$index_script}" method="post" name="shippings_form"> <input type="hidden" name="{$target_name}" value="checkout" /> <input type="hidden" name="{$mode_name}" value="update_shipping" /> <input type="hidden" name="redirect_mode" value="checkout" /> <p></p> {if $settings.Addons.suppliers == 'Y' && $settings.Addons.suppliers_opts.multiple_selectboxes == 'Y' && $cart.use_suppliers == 'Y'} {include file="addons/suppliers/cart_pages/shipping_rates.tpl" onchange="sf.submit();"} {else} {if $shipping_rates} <div class="form-field"> <label for="ssr"><b>{$lang.shipping_method}:</b></label> <select id="ssr" name="shipping_ids[]" onchange="sf.submit();"> {foreach from=$shipping_rates key=shipping_id item=s_rate} <option value="{$shipping_id}" {if $cart.shipping.$shipping_id}selected="selected"{/if}>{$s_rate.name} ({$s_rate.delivery_time}) - {include file="common_templates/price.tpl" value=$s_rate.rates|@array_sum}</option> {/foreach} </select> </div> {/if} {/if} </form> </div> {/if} And i think the part to modify is: <div class="form-field"> <label for="ssr"><b>{$lang.shipping_method}:</b></label> <select id="ssr" name="shipping_ids[]" onchange="sf.submit();"> {foreach from=$shipping_rates key=shipping_id item=s_rate} <option value="{$shipping_id}" {if $cart.shipping.$shipping_id}selected="selected"{/if}>{$s_rate.name} ({$s_rate.delivery_time}) - {include file="common_templates/price.tpl" value=$s_rate.rates|@array_sum}</option> {/foreach} </select> </div> Please see the attached images for more details. [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/137570-a-small-tpl-modification/ Share on other sites More sharing options...
rhodesa Posted December 18, 2008 Share Posted December 18, 2008 try: <div class="form-field"> <label for="ssr"><b>{$lang.shipping_method}:</b></label> {* <select id="ssr" name="shipping_ids[]" onchange="sf.submit();"> *} {foreach from=$shipping_rates key=shipping_id item=s_rate} <input type="checkbox" name="shipping_ids[]" value="{$shipping_id}" {if $cart.shipping.$shipping_id}checked=true{/if} />{$s_rate.name} ({$s_rate.delivery_time}) - {include file="common_templates/price.tpl" value=$s_rate.rates|@array_sum}<br /> {/foreach} {* </select> *} </div> you will loose any functionality using the ID=ssr and the onchange="sf.submit();"...you can always add onclick="sf.submit();" to each input though if you want to keep that Link to comment https://forums.phpfreaks.com/topic/137570-a-small-tpl-modification/#findComment-719031 Share on other sites More sharing options...
lilceda Posted December 18, 2008 Author Share Posted December 18, 2008 Hi thanks a lot, it helped me, the only thing you forgot is the onchange <table cellpadding="0" cellspacing="3" border="0" align="left"> {foreach from=$shipping_rates key=shipping_id item=s_rate} <tr style="height: 20px;"> <td> <input type="radio" value="{$shipping_id}" id="ssr" name="shipping_ids[]" onchange="sf.submit();" {if $cart.shipping.$shipping_id}checked="checked"{/if}> {$s_rate.name} ({$s_rate.delivery_time}) - {include file="common_templates/price.tpl" value=$s_rate.rates|@array_sum} </td> </input> </tr> {/foreach} </table> Thank you very much Link to comment https://forums.phpfreaks.com/topic/137570-a-small-tpl-modification/#findComment-719042 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.