X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Pre-Login Shipping Calculator (https://forum.x-cart.com/showthread.php?t=6927)

jedak 06-08-2005 04:24 AM

Quote:

Originally Posted by TJ Stephens
I think I am having the same problem as you. Try going to "taxing system" under management and uncheck "Display cart/order totals including tax:". See if this makes it display the taxes. I'm using 4.0.13 too and if this box is checked then it displays takes for me with the pre-login shipping calculator. If I uncheck it (which I want to do for formating reasons) then the total still includes the taxes but the tax line displays "n/a" instead of the actual tax amount. Is this the same thing you are having trouble with? If so, I will let you know if I figure out how to fix this and please do the same if you find a fix.

TJ


Yes that is the same problem. If 'display cart/order totals including tax' but in the way I 'think' Jeanne has it. This way actually shows tax calculation on each value in the cart.
e.g. with the box checked
Subtotal: $10.31
Discount: $0.95
Discounted subtotal: $9.28
Shipping: $5.38

TOTAL: $14.65
Including: Sales Tax: $1.16


e.g. without the box checked
Subtotal: $9.49
Discount: $0.95
Discounted subtotal: $8.54
Shipping: $4.95
Sales Tax 8.625%: n/a

TOTAL: $14.65

e.g. when customer is logged in (the way I want it)
Subtotal: $9.49
Discount: $0.95
Discounted subtotal: $8.54
Shipping: $4.95
Sales Tax 8.625%: $1.16

TOTAL: $14.65

Certainly will post if I come up with the solution.

Jeanne am I correct in assuming what I did about your taxes calculation?

jeanne 06-08-2005 02:45 PM

If the tax zone is looking for cities then the only way that you will get taxes to show with the zip code estimate is to either build a routine in cart.php that will translate the zip to a city or set up your tax zone by zip code.

if($zipcode_estimate >= 10001 && $zipcode_estimate <= 10002){
$config["General"]["default_city"] = "A City";
}elseif($zipcode_estimate >= 10003 && $zipcode_estimate <= 10004){
$config["General"]["default_city"] = "Another City";
}

(I don't know what the correct zip codes would be.)

I think that it would be easier to set up your tax zone up by zip code though so if you needed to change any zip codes you would not have to dig through the code.

jeanne 06-08-2005 02:52 PM

Sorry I didn't see that part about having that box unchecked before.
That is the way that I have it on my site (The "Display cart/order totals including tax" is unchecked). It looks like this when someone enters a zip code (not logged in) that is from California.

Subtotal: $32.95
Shipping: $2.00
California State Tax 7.25%: $2.39

TOTAL: $37.34

jeanne 06-08-2005 03:20 PM

OK Duh, I obviously don't keep close enough track on what I change in my files. 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

TJ Stephens 06-08-2005 04:51 PM

THANK YOU JEANNE! That fixed it. You are a star!

jedak 06-09-2005 04:49 AM

=D> ALL HAIL JEANNE =D> Thank you . Also special thanks to Rackit and all others who. But right now Jeanne you are the :-#

Jayk 06-18-2005 08:08 PM

Got it working on 4.0.13. The problem I was having was with the taxes, but Jeanne's cart_totals.tpl tweak fixed my issue.

Thanks,
Jason

salsabeel 06-19-2005 03:56 AM

I use xcart 4.0.13
and modify cart.php and cart_totals.tpl as follow

1- 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","UPS");
x_session_register("is_sns_action");


Addition:
Code:

x_session_register("shipping_country_name");


if($shipping_country== "clear"){
      $shipping_country_name = "";
      func_header_location("cart.php");
      }
if($shipping_country != "") {
      $shipping_country_name = $shipping_country;
$config["General"]["apply_default_country"] = "Y";
$config["General"]["default_country"]=$shipping_country_name;


      $smarty->assign("estimate","NO");
      }


2-cart_totals.tpl
Addition:


Code:

{if $estimate ne "NO"}
   
Enter your country to calculate shipping charges.

 <SELECT
                              size=1 name=shipping_country style="font-size: 10px; WIDTH: 120px"  > <OPTION
                                value=AF>Afghanistan</OPTION> <OPTION
                                value=AL>Albania</OPTION> <OPTION
                                value=DZ>Algeria</OPTION> <OPTION
                                value=AS>American Samoa</OPTION> <OPTION
                                value=AD>Andorra</OPTION> <OPTION
                                value=AO>Angola</OPTION> <OPTION
                                value=AI>Anguilla</OPTION> <OPTION
                                value=AQ>Antarctica</OPTION> <OPTION
                                value=AG>Antigua and Barbuda</OPTION> <OPTION
                                value=AR>Argentina</OPTION> <OPTION
                                value=AM>Armenia</OPTION> <OPTION
                                value=AW>Aruba</OPTION> <OPTION
                                value=AU>Australia</OPTION> <OPTION
                                value=AT>Austria</OPTION> <OPTION
                                value=AZ>Azerbaijan</OPTION> <OPTION
                                value=BS>Bahamas</OPTION> <OPTION
                                value=BH>Bahrain</OPTION> <OPTION
                                value=BD>Bangladesh</OPTION> <OPTION
                                value=BB>Barbados</OPTION> <OPTION
                                value=BY>Belarus</OPTION> <OPTION
                                value=BE>Belgium</OPTION> <OPTION
                                value=BZ>Belize</OPTION> <OPTION
                                value=BJ>Benin</OPTION> <OPTION
                                value=BM>Bermuda</OPTION> <OPTION
                                value=BT>Bhutan</OPTION> <OPTION
                                value=BO>Bolivia</OPTION> <OPTION
                                value=BA>Bosnia and Herzegowina</OPTION> <OPTION
                                value=BW>Botswana</OPTION> <OPTION
                                value=BV>Bouvet Island</OPTION> <OPTION
                                value=BR>Brazil</OPTION> <OPTION
                                value=IO>British Indian Ocean Territory</OPTION>
                                <OPTION value=VG>British Virgin Islands</OPTION>
                                <OPTION value=BN>Brunei Darussalam</OPTION>
                                <OPTION value=BG>Bulgaria</OPTION> <OPTION
                                value=BF>Burkina Faso</OPTION> <OPTION
                                value=BI>Burundi</OPTION> <OPTION
                                value=KH>Cambodia</OPTION> <OPTION
                                value=CM>Cameroon</OPTION> <OPTION
                                value=CA>Canada</OPTION> <OPTION value=CV>Cape
                                Verde</OPTION> <OPTION value=KY>Cayman
                                Islands</OPTION> <OPTION value=CF>Central
                                African Republic</OPTION> <OPTION
                                value=TD>Chad</OPTION> <OPTION
                                value=CL>Chile</OPTION> <OPTION
                                value=CN>China</OPTION> <OPTION
                                value=CX>Christmas Island</OPTION> <OPTION
                                value=CC>Cocos (Keeling) Islands</OPTION>
                                <OPTION value=CO>Colombia</OPTION> <OPTION
                                value=KM>Comoros</OPTION> <OPTION
                                value=CG>Congo</OPTION> <OPTION value=CK>Cook
                                Islands</OPTION> <OPTION value=CR>Costa
                                Rica</OPTION> <OPTION value=CI>Cote
                                D'ivoire</OPTION> <OPTION
                                value=HR>Croatia</OPTION> <OPTION
                                value=CU>Cuba</OPTION> <OPTION
                                value=CY>Cyprus</OPTION> <OPTION value=CZ>Czech
                                Republic</OPTION> <OPTION
                                value=DK>Denmark</OPTION> <OPTION
                                value=DJ>Djibouti</OPTION> <OPTION
                                value=DM>Dominica</OPTION> <OPTION
                                value=DO>Dominican Republic</OPTION> <OPTION
                                value=TP>East Timor</OPTION> <OPTION
                                value=EC>Ecuador</OPTION> <OPTION value=EG
                                selected>Egypt</OPTION> <OPTION value=SV>El
                                Salvador</OPTION> <OPTION value=GQ>Equatorial
                                Guinea</OPTION> <OPTION
                                value=ER>Eritrea</OPTION> <OPTION
                                value=EE>Estonia</OPTION> <OPTION
                                value=ET>Ethiopia</OPTION> <OPTION
                                value=FK>Falkland Islands (Malvinas)</OPTION>
                                <OPTION value=FO>Faroe Islands</OPTION> <OPTION
                                value=FJ>Fiji</OPTION> <OPTION
                                value=FI>Finland</OPTION> <OPTION
                                value=FR>France</OPTION> <OPTION
                                value=FX>France, Metropolitan</OPTION> <OPTION
                                value=GF>French Guiana</OPTION> <OPTION
                                value=PF>French Polynesia</OPTION> <OPTION
                                value=TF>French Southern Territories</OPTION>
                                <OPTION value=GA>Gabon</OPTION> <OPTION
                                value=GM>Gambia</OPTION> <OPTION
                                value=GE>Georgia</OPTION> <OPTION
                                value=DE>Germany</OPTION> <OPTION
                                value=GH>Ghana</OPTION> <OPTION
                                value=GI>Gibraltar</OPTION> <OPTION
                                value=GR>Greece</OPTION> <OPTION
                                value=GL>Greenland</OPTION> <OPTION
                                value=GD>Grenada</OPTION> <OPTION
                                value=GP>Guadeloupe</OPTION> <OPTION
                                value=GU>Guam</OPTION> <OPTION
                                value=GT>Guatemala</OPTION> <OPTION
                                value=GN>Guinea</OPTION> <OPTION
                                value=GW>Guinea-Bissau</OPTION> <OPTION
                                value=GY>Guyana</OPTION> <OPTION
                                value=HT>Haiti</OPTION> <OPTION value=HM>Heard
                                and McDonald Islands</OPTION> <OPTION
                                value=HN>Honduras</OPTION> <OPTION value=HK>Hong
                                Kong</OPTION> <OPTION value=HU>Hungary</OPTION>
                                <OPTION value=IS>Iceland</OPTION> <OPTION
                                value=IN>India</OPTION> <OPTION
                                value=ID>Indonesia</OPTION> <OPTION
                                value=IQ>Iraq</OPTION> <OPTION
                                value=IE>Ireland</OPTION> <OPTION
                                value=IR>Islamic Republic of Iran</OPTION>
                                <OPTION value=IL>Israel</OPTION> <OPTION
                                value=IT>Italy</OPTION> <OPTION
                                value=JM>Jamaica</OPTION> <OPTION
                                value=JP>Japan</OPTION> <OPTION
                                value=JO>Jordan</OPTION> <OPTION
                                value=KZ>Kazakhstan</OPTION> <OPTION
                                value=KE>Kenya</OPTION> <OPTION
                                value=KI>Kiribati</OPTION> <OPTION
                                value=KP>Korea</OPTION> <OPTION value=KR>Korea,
                                Republic of</OPTION> <OPTION
                                value=KW>Kuwait</OPTION> <OPTION
                                value=KG>Kyrgyzstan</OPTION> <OPTION
                                value=LA>Laos</OPTION> <OPTION
                                value=LV>Latvia</OPTION> <OPTION
                                value=LB>Lebanon</OPTION> <OPTION
                                value=LS>Lesotho</OPTION> <OPTION
                                value=LR>Liberia</OPTION> <OPTION
                                value=LY>Libyan Arab Jamahiriya</OPTION> <OPTION
                                value=LI>Liechtenstein</OPTION> <OPTION
                                value=LT>Lithuania</OPTION> <OPTION
                                value=LU>Luxembourg</OPTION> <OPTION
                                value=MO>Macau</OPTION> <OPTION
                                value=MK>Macedonia</OPTION> <OPTION
                                value=MG>Madagascar</OPTION> <OPTION
                                value=MW>Malawi</OPTION> <OPTION
                                value=MY>Malaysia</OPTION> <OPTION
                                value=MV>Maldives</OPTION> <OPTION
                                value=ML>Mali</OPTION> <OPTION
                                value=MT>Malta</OPTION> <OPTION
                                value=MH>Marshall Islands</OPTION> <OPTION
                                value=MQ>Martinique</OPTION> <OPTION
                                value=MR>Mauritania</OPTION> <OPTION
                                value=MU>Mauritius</OPTION> <OPTION
                                value=YT>Mayotte</OPTION> <OPTION
                                value=MX>Mexico</OPTION> <OPTION
                                value=FM>Micronesia</OPTION> <OPTION
                                value=MD>Moldova, Republic of</OPTION> <OPTION
                                value=MC>Monaco</OPTION> <OPTION
                                value=MN>Mongolia</OPTION> <OPTION
                                value=MS>Montserrat</OPTION> <OPTION
                                value=MA>Morocco</OPTION> <OPTION
                                value=MZ>Mozambique</OPTION> <OPTION
                                value=MM>Myanmar</OPTION> <OPTION
                                value=NA>Namibia</OPTION> <OPTION
                                value=NR>Nauru</OPTION> <OPTION
                                value=NP>Nepal</OPTION> <OPTION
                                value=NL>Netherlands</OPTION> <OPTION
                                value=AN>Netherlands Antilles</OPTION> <OPTION
                                value=NC>New Caledonia</OPTION> <OPTION
                                value=NZ>New Zealand</OPTION> <OPTION
                                value=NI>Nicaragua</OPTION> <OPTION
                                value=NE>Niger</OPTION> <OPTION
                                value=NG>Nigeria</OPTION> <OPTION
                                value=NU>Niue</OPTION> <OPTION value=NF>Norfolk
                                Island</OPTION> <OPTION value=MP>Northern
                                Mariana Islands</OPTION> <OPTION
                                value=NO>Norway</OPTION> <OPTION
                                value=OM>Oman</OPTION> <OPTION
                                value=PK>Pakistan</OPTION> <OPTION
                                value=PW>Palau</OPTION> <OPTION
                                value=PA>Panama</OPTION> <OPTION value=PG>Papua
                                New Guinea</OPTION> <OPTION
                                value=PY>Paraguay</OPTION> <OPTION
                                value=PE>Peru</OPTION> <OPTION
                                value=PH>Philippines</OPTION> <OPTION
                                value=PN>Pitcairn</OPTION> <OPTION
                                value=PL>Poland</OPTION> <OPTION
                                value=PT>Portugal</OPTION> <OPTION
                                value=PR>Puerto Rico</OPTION> <OPTION
                                value=QA>Qatar</OPTION> <OPTION
                                value=RE>Reunion</OPTION> <OPTION
                                value=RO>Romania</OPTION> <OPTION
                                value=RU>Russian Federation</OPTION> <OPTION
                                value=RW>Rwanda</OPTION> <OPTION value=LC>Saint
                                Lucia</OPTION> <OPTION value=WS>Samoa</OPTION>
                                <OPTION value=SM>San Marino</OPTION> <OPTION
                                value=ST>Sao Tome and Principe</OPTION> <OPTION
                                value=SA>Saudi Arabia</OPTION> <OPTION
                                value=SN>Senegal</OPTION> <OPTION
                                value=SC>Seychelles</OPTION> <OPTION
                                value=SL>Sierra Leone</OPTION> <OPTION
                                value=SG>Singapore</OPTION> <OPTION
                                value=SK>Slovakia</OPTION> <OPTION
                                value=SI>Slovenia</OPTION> <OPTION
                                value=SB>Solomon Islands</OPTION> <OPTION
                                value=SO>Somalia</OPTION> <OPTION value=ZA>South
                                Africa</OPTION> <OPTION value=ES>Spain</OPTION>
                                <OPTION value=LK>Sri Lanka</OPTION> <OPTION
                                value=SH>St. Helena</OPTION> <OPTION
                                value=KN>St. Kitts and Nevis</OPTION> <OPTION
                                value=PM>St. Pierre and Miquelon</OPTION>
                                <OPTION value=VC>St. Vincent and the
                                Grenadines</OPTION> <OPTION
                                value=SD>Sudan</OPTION> <OPTION
                                value=SR>Suriname</OPTION> <OPTION
                                value=SJ>Svalbard and Jan Mayen Islands</OPTION>
                                <OPTION value=SZ>Swaziland</OPTION> <OPTION
                                value=SE>Sweden</OPTION> <OPTION
                                value=CH>Switzerland</OPTION> <OPTION
                                value=SY>Syrian Arab Republic</OPTION> <OPTION
                                value=TW>Taiwan</OPTION> <OPTION
                                value=TJ>Tajikistan</OPTION> <OPTION
                                value=TZ>Tanzania, United Republic of</OPTION>
                                <OPTION value=TH>Thailand</OPTION> <OPTION
                                value=TG>Togo</OPTION> <OPTION
                                value=TK>Tokelau</OPTION> <OPTION
                                value=TO>Tonga</OPTION> <OPTION
                                value=TT>Trinidad and Tobago</OPTION> <OPTION
                                value=TN>Tunisia</OPTION> <OPTION
                                value=TR>Turkey</OPTION> <OPTION
                                value=TM>Turkmenistan</OPTION> <OPTION
                                value=TC>Turks and Caicos Islands</OPTION>
                                <OPTION value=TV>Tuvalu</OPTION> <OPTION
                                value=UG>Uganda</OPTION> <OPTION
                                value=UA>Ukraine</OPTION> <OPTION
                                value=AE>United Arab Emirates</OPTION> <OPTION
                                value=GB>United Kingdom (Great Britain)</OPTION>
                                <OPTION value=US>United States</OPTION> <OPTION
                                value=VI>United States Virgin Islands</OPTION>
                                <OPTION value=UY>Uruguay</OPTION> <OPTION
                                value=UZ>Uzbekistan</OPTION> <OPTION
                                value=VU>Vanuatu</OPTION> <OPTION
                                value=VA>Vatican City State</OPTION> <OPTION
                                value=VE>Venezuela</OPTION> <OPTION
                                value=VN>Viet Nam</OPTION> <OPTION
                                value=WF>Wallis And Futuna Islands</OPTION>
                                <OPTION value=EH>Western Sahara</OPTION> <OPTION
                                value=YE>Yemen</OPTION> <OPTION
                                value=YU>Yugoslavia</OPTION> <OPTION
                                value=ZR>Zaire</OPTION> <OPTION
                                value=ZM>Zambia</OPTION> <OPTION
                                value=ZW>Zimbabwe</OPTION></SELECT>
  {include file="buttons/button.tpl" button_title="Calculate Shipping" href="javascript: document.cartform.submit()"  js_to_href="Y"}

     
      {else}

Click here to change your country

    {/if}



I setup zones manually and all shipping price depending on country only

If I choose the country form Drop-Down list
I have no change (the shipping price stile 0$)

for check on cart.php I use this url
Code:

http://www.sanaabel.com/estore/cart.php?shipping_country=US

I found it works good with no error (correct value of shipping price)

I down't know what I do?
I think I need to modify in cart_totals.tpl .

Jayk 07-09-2005 10:27 AM

Has anyone come up with a solution to this one:

Quote:

Okay, I got it so the Canadian Shipping rate is calculated. But now when I put in a US postal Code it says:

Quote:

Canada Post Realtime shipping rate calculation service returned the following error:
Destination Postal Code/State Name/ Country is illegal.
Sorry, there are no available shipping methods for your location.:
anonymous


This happens when using the Canada Post Sell Online Shipping Module and entering a US zip code. I am wondering if Canada Post requires a State as well?

Thanks,
Jason

Mary Jo Robins 07-18-2005 09:28 AM

update mod
 
Here we are over a year old on this mod. Over 9 pages to read thru and try to figure out what was good is not good now and need to change that to this to make it work now. Can someone post the most current code for 4.0.14. This way we can start from there to keep this mod alive.

Thank you


All times are GMT -8. The time now is 12:49 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.