This is the current code I am using, pulled together from the 9 pages of this post. I have used it on 4.0.12 through 4.0.14 and I assume it should work on 4.0.9.
In cart.php After:
Code:
x_session_register("cart");
x_session_register("intershipper_rates");
x_session_register("intershipper_recalc");
x_session_unregister("secure_oid");
x_session_register("extended_userinfo");
x_session_register("anonymous_checkout");
x_session_register("payment_cc_fields");
x_session_register("current_carrier");
Insert:
Code:
# BCSE
x_session_register("zipcode_estimate");
x_session_register("default_country_estimate");
if($zip_estimate == "clear")
{
$zipcode_estimate = "";
func_header_location("cart.php");
}
if(!empty($zip_estimate))
{
$zipcode_estimate = $zip_estimate;
$default_country_estimate= $country_estimate;
if($country_estimate == "US")
{
$count = substr_count($zipcode_estimate,"0") + substr_count($zipcode_estimate,"1") + substr_count($zipcode_estimate,"2") + substr_count($zipcode_estimate,"3") + substr_count($zipcode_estimate,"4") + substr_count($zipcode_estimate,"5") + substr_count($zipcode_estimate,"6") + substr_count($zipcode_estimate,"7") + substr_count($zipcode_estimate,"8") + substr_count($zipcode_estimate,"9");
if($count != 5) //checking for 5 digits
$zipcode_estimate = "";
}
if($country_estimate == "CA" && strlen($zipcode_estimate)!=6)
$zipcode_estimate= "";
if($mode=="checkout")
func_header_location("cart.php?mode=checkout");
else
func_header_location("cart.php");
}
if($zipcode_estimate != "")
{
$config["General"]["default_country"] = $default_country_estimate;
$config["General"]["apply_default_country"] = "Y";
$config["General"]["default_zipcode"] = $zipcode_estimate;
$smarty->assign("estimate","NO");
}
# BCSE
Then in skin1/customer/main/cart_totals.tpl Before:
Code:
{if $not_logged_message eq "1"}{$lng.txt_order_total_msg}{/if}
Insert:
Code:
{* BCSE Begin *}
{if $login}
{else}
{if $estimate ne "NO"}
Enter your country and zip/postal code to calculate shipping charges.
Country: <select name='country_estimate'>
<option value="US">United States
<option value="CA">Canada
</select>
Zip/Postal Code: <input type=TEXT name='zip_estimate' size=6 maxlength=6>
{include file="buttons/button.tpl" button_title="Calculate Shipping" href="javascript: document.cartform.submit()" js_to_href="Y"}
{else}
Click here to change your zip code
{/if}
{/if}
{* BCSE End *}
Go to main/customer/cart_totals.tpl
Instead of
Code:
{if $cart.taxes and $config.Taxes.display_taxed_order_totals ne "Y"}
{foreach key=tax_name item=tax from=$cart.taxes}
<TR>
<TD nowrap><FONT class="FormButton">{$tax.tax_display_name}{if $tax.rate_type eq "%"} {$tax.rate_value}%{/if}:</FONT></TD>
<TD>[img]{$ImagesDir}/null.gif[/img]
</TD>
<TD nowrap align="right"><FONT class="ProductPriceSmall">{if $login ne "" or $config.General.apply_default_country eq "Y"}{include file="currency.tpl" value=$tax.tax_cost}</FONT></TD>
<TD nowrap align="right">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$tax.tax_cost}{else}n/a{assign var="not_logged_message" value="1"}</FONT></TD><TD>{/if}</TD>
</TR>
{/foreach}
{/if}
put
Code:
{if $cart.taxes and $config.Taxes.display_taxed_order_totals ne "Y"}
{foreach key=tax_name item=tax from=$cart.taxes}
<TR>
<TD nowrap><FONT class="FormButton">{$tax.tax_display_name}{if $tax.rate_type eq "%"} {$tax.rate_value}%{/if}:</FONT></TD>
<TD>[img]{$ImagesDir}/null.gif[/img]
</TD>
<TD nowrap align="right"><FONT class="ProductPriceSmall">{if $login ne "" or $estimate eq "NO" or $config.General.apply_default_country eq "Y"}{include file="currency.tpl" value=$tax.tax_cost}</FONT></TD>
<TD nowrap align="right">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$tax.tax_cost}{else}n/a{assign var="not_logged_message" value="1"}</FONT></TD><TD>{/if}</TD>
</TR>
{/foreach}
{/if}
That should get the tax to show up instead of n/a.
The only other thing that seems to be needed is as addition of US states for the Sell Online Canada Post Shipping Module to work properly.
Cheers,
Jason