Loading...

Displaying a list of shipping methods as a selectbox on the checkout page

We no longer maintain the Knowledge Base since version 4.3.x. All the latest user and developer documentation for 4.3.x and newer versions is now available at docs.cs-cart.com.

  • This article is available only for CS-Cart versions:
  • 2.0.x
  1. Create the following directories path in the root directory of your CS-Cart installation:
    skins/[CUSTOMER_ACTIVE_SKIN]/customer/addons/my_changes/hooks/checkout, where [CUSTOMER_ACTIVE_SKIN] is an active skin of your storefront.
  2. Create the shipping_rates.override.tpl file in the skins/[CUSTOMER_ACTIVE_SKIN]/customer/addons/my_changes/hooks/checkout directory with the following content:
    {if $shipping_rates}
    
            <div class="{if $display == "select"}form-field shipping-rates{elseif $display == "show"}step-complete-wrapper{/if}" id="shipping_rates_list">
            {if $display == "radio"}
                <label for="ssr">{$lang.shipping_method}:</label>
        
                <select id="ssr" name="shipping_ids[]">
                {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} {if $s_rate.delivery_time}({$s_rate.delivery_time}){/if}  - {if $s_rate.rates|@array_sum}{include file="common_templates/price.tpl" value=$s_rate.rates|@array_sum}{else}{$lang.free_shipping}{/if}</option>
                {/foreach}
                </select>
    
            {elseif $display == "select"}
    
                <label for="ssr">{$lang.shipping_method}:</label>
        
                <select id="ssr" name="shipping_ids[]">
                {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} {if $s_rate.delivery_time}({$s_rate.delivery_time}){/if}  - {if $s_rate.rates|@array_sum}{include file="common_templates/price.tpl" value=$s_rate.rates|@array_sum}{else}{$lang.free_shipping}{/if}</option>
                {/foreach}
                </select>
    
            {elseif $display == "show"}
    
                {foreach from=$shipping_rates key="shipping_id" item="s_rate"}
                    {if $cart.shipping.$shipping_id}
                        {capture name="selected_shipping"}
                            {$s_rate.name} {if $s_rate.delivery_time}({$s_rate.delivery_time}){/if}  - {if $s_rate.rates|@array_sum}{include file="common_templates/price.tpl" value=$s_rate.rates|@array_sum}{else}{$lang.free_shipping}{/if}
                        {/capture}
                    {/if}
                {/foreach}
                {$smarty.capture.selected_shipping}
            {/if}
    
            <!--shipping_rates_list--></div>
        {/if}
  3. Save the file.
    NOTE: The My changes addon is available since the CS-Cart 2.0.6 version. This instruction will not work with earlier versions. Please also make sure that the My changes addon is installed and enabled on the Addons page in your administration panel.
NOTE: When you uninstall the addon all it's template files are deleted from the skins directory. So if you plan to do this please create template files in the var/skins_repository/base directory as well so that these templates will be created again after you install the addon.
Home / Knowledge base / Look and feel (design) / Displaying a list of shipping methods as a selectbox on the checkout page