Shipping Estimation Format

I just caught onto this and it was bugging me that when the shipping estimate was calculated, the results showed up above the location inputs which was kind of confusing. I just simply swapped the code around so that the results would show up below the location inputs.



This is the complete file and I have highlighted what I moved in [COLOR=“Blue”]blue[/COLOR]. The only other difference in this file is that I have the estimator set to show instead of hidden.



/skins/your_skin/customer/views/checkout/components/shipping_estimation.tpl:

{* $Id: shipping_estimation.tpl 8072 2009-10-09 09:53:58Z zeke $ *}<br />
<br />
{if $location == "sidebox"}<br />
	{assign var="prefix" value="sidebox_"}<br />
{/if}<br />
{if $additional_id}<br />
	{assign var="class_suffix" value="-`$additional_id`"}<br />
	{assign var="id_suffix" value="_`$additional_id`"}<br />
{/if}<br />
<br />
{if $location != "sidebox"}<br />
<a name="estimate"></a><br />
	<div class="buttons-container clear-both">{include file="buttons/button.tpl" but_role="text" but_text=$lang.estimate_shipping_cost but_id="sw_est_box`$id_suffix`" but_meta="cm-combination`$class_suffix`"}</div><br />
{/if}<br />
{if $location != "sidebox"}<br />
<div id="est_box{$id_suffix}"{if (!"AJAX_REQUEST"|defined && !$shipping_rates && $location != "sidebox")} {/if} align="right"><br />
	<div class="estimation-popup-box float-right" align="left"><br />
	{/if}<br />
		{if !$smarty.capture.states_built}<br />
		{include file="views/profiles/components/profiles_scripts.tpl" states=$smarty.const.CART_LANGUAGE|fn_get_all_states:false:true}<br />
		{capture name="states_built"}Y{/capture}<br />
		{/if}<br />
		<script type="text/javascript"><br />
		//<![CDATA[<br />
		var field_groups = {$ldelim}{$rdelim};<br />
		default_state['estimation{$class_suffix}'] = '{$cart.user_data.s_state|escape:javascript}';<br />
		//]]><br />
		</script><br />
<br />
		<form class="cm-ajax" name="{$prefix}estimation_form{$id_suffix}" action="{$index_script}" method="post"><br />
		{if $location == "sidebox"}<input type="hidden" name="location" value="sidebox" />{/if}<br />
		{if $additional_id}<input type="hidden" name="additional_id" value="{$additional_id}" />{/if}<br />
		<input type="hidden" name="result_ids" value="shipping_estimation{if $location == "sidebox"}_sidebox{/if}{$id_suffix}" /><br />
		<div class="form-field"><br />
			<label for="{$prefix}elm_country{$id_suffix}" class="cm-country cm-location-estimation{$class_suffix}">{$lang.country}:</label><br />
			<select id="{$prefix}elm_country{$id_suffix}" class="cm-location-estimation{$class_suffix}" name="customer_location[country]"><br />
				<option value="">- {$lang.select_country} -</option><br />
				{assign var="countries" value=1|fn_get_simple_countries}<br />
				{foreach from=$countries item=country key=ccode}<br />
				<option value="{$ccode}" {if ($cart.user_data.s_country == $ccode) || (!$cart.user_data.s_country && $ccode == $settings.General.default_country)}selected="selected"{/if}>{if $block.properties.positions == "left" || $block.properties.positions == "right"}{$country|truncate:18}{else}{$country}{/if}</option><br />
				{/foreach}<br />
			</select><br />
		</div><br />
<br />
		<div class="form-field"><br />
			<label for="{$prefix}elm_state{$id_suffix}" class="cm-state cm-location-estimation{$class_suffix}">{$lang.state}:</label><br />
			<input type="text" class="input-text hidden" id="{$prefix}elm_state{$id_suffix}_d" name="customer_location[state]" size="{if $location != "sidebox"}32{else}20{/if}" maxlength="64" value="{$cart.user_data.s_state}" disabled="disabled" /><br />
			<select id="{$prefix}elm_state{$id_suffix}" name="customer_location[state]"><br />
				<option label="" value="">- {$lang.select_state} -</option><br />
			</select><br />
		</div><br />
<br />
		<div class="form-field"><br />
			<label for="{$prefix}elm_zipcode{$id_suffix}" {if $location == "sidebox"}class="nowrap"{/if}>{$lang.zip_postal_code}:</label><br />
			<input type="text" class="input-text" id="{$prefix}elm_zipcode{$id_suffix}" name="customer_location[zipcode]" size="{if $location != "sidebox"}25{else}20{/if}" value="{$cart.user_data.s_zipcode}" /><br />
		</div><br />
<br />
		<div class="buttons-container"><br />
			{include file="buttons/button.tpl" but_text=$lang.estimate but_name="dispatch[checkout.shipping_estimation]" but_role="text"}<br />
		</div><br />
		<br />
		[COLOR="Blue"]<div id="shipping_estimation{if $location == "sidebox"}_sidebox{/if}{$id_suffix}"><br />
		{if $mode == "shipping_estimation" || $smarty.request.show_shippings == "Y"}<br />
<br />
			{if !$cart.shipping_failed}<br />
			<form class="cm-ajax" name="{$prefix}select_shipping_form{$id_suffix}" action="{$index_script}" method="post"><br />
			<input type="hidden" name="redirect_mode" value="cart" /><br />
			<input type="hidden" name="result_ids" value="checkout_totals" /><br />
<br />
			{hook name="checkout:shipping_estimation"}<br />
				{foreach from=$shipping_rates key=shipping_id item=s_rate name="fee"}<br />
					{assign var="rate" value="0"}<br />
					{foreach from=$s_rate.rates key=key_id item=r}{math equation="x + y" x=$rate y=$r assign="rate"}{/foreach}<br />
					<p><br />
						<input id="{$prefix}est_{$shipping_id}{$id_suffix}" type="radio" class="radio" name="shipping_ids[0]" value="{$shipping_id}" {if (!$cart.shipping && $smarty.foreach.fee.first) || $cart.shipping.$shipping_id}checked="checked"{/if} /> <label for="{$prefix}est_{$shipping_id}{$id_suffix}" class="valign">{$s_rate.name}{if $s_rate.delivery_time} ({$s_rate.delivery_time}){/if} - {include file="common_templates/price.tpl" value=$rate}</label><br />
					</p><br />
				{/foreach}<br />
			{/hook}<br />
<br />
			<div class="buttons-container"><br />
				{include file="buttons/button.tpl" but_text=$lang.select but_role="text" but_name="dispatch[checkout.update_shipping]"}<br />
			</div><br />
<br />
			</form><br />
			{else}<br />
			<p class="error-text center"><br />
				{$lang.text_no_shipping_methods}<br />
			</p><br />
			{/if}<br />
<br />
			<hr /><br />
		{/if}<br />
		<!--shipping_estimation{if $location == "sidebox"}_sidebox{/if}{$id_suffix}--></div>[/COLOR]<br />
<br />
		</form><br />
{if $location != "sidebox"}<br />
	</div><br />
</div><br />
{/if}

Excellent, thanks for this, makes more sense this way.



Just out of interest, what is the specific code to have the estimator showing instead of hidden?



Regards,

Aleks

Removed [COLOR=“Blue”]class=“hidden”[/COLOR] from this line:


Thanks :slight_smile:



Regards,

Aleks

[quote name=‘Tool Outfitters’]Removed [COLOR=“Blue”]class=“hidden”[/COLOR] from this line:


[/QUOTE]



Thanks for this

Great post…



After estimating the shipping, we choose a shipping method and click select… shipping charges disappears therefore we have to estimate again in order to view shipping charges… is there any way that charges don’t hide?



Thanks

It’s probably due to ajax. Disable it and see if it still occurs.

I tried it still disappears Tool Outfitters … any other suggestions???

What version are you using and what changes did you make? I do not have any issues on 2.0.15.

Changed this in my 2.0.15 cart and works be-u-tifully! Thanks Tool!

[quote name='impactreact' timestamp='1285059255' post='89932']

Great post…



After estimating the shipping, we choose a shipping method and click select… shipping charges disappears therefore we have to estimate again in order to view shipping charges… is there any way that charges don't hide?



Thanks

[/quote]



I agree with this, I don't like when it hides either. I'm using the latest version. Anyone know how to change this so it doesn't hide everytime?

Anyone do this is 2.2.4? Code appears to be different

I agree the shipping estimater is confusing for customers in 2.1.4.

I actually modified mine so that it didnt need the "Select Button to be pressed as cutromers these days expect thiungs to update automatically.

Works well now in that the Shipping method the customer selects by the radio button updates the cart as soon as selected, but the estimator still collapses and the Stae is not remmbered. … maybe my cut-n-paste coder skills still need honing.



Now the other thin that customers complain of is that they dont realise they need to press the “Update” button when changing the Quantity of an item they added to the cart.

Is there some way to force an Update of the cart contents when the customer hits the “Check out” Button ?



Cheers