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

rackit 07-18-2005 09:31 AM

I don't have time to go through all the pages, but if someone can e-mail me the code, I'll put it in the first post.

Jayk 07-18-2005 10:43 AM

Quote:

Originally Posted by rackit
I don't have time to go through all the pages, but if someone can e-mail me the code, I'll put it in the first post.


It's on its way to you.

Thanks,
Jason

sbtiti 07-27-2005 01:15 PM

What is the code needed to change if wanting to get this installed on 4.0.9?

Jayk 07-28-2005 03:35 PM

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

sbtiti 08-04-2005 10:45 AM

On this modification, how do we make it so that the default shipping method used is ground?

Also, we get this error on the page before entering a zipcode:

UPS Realtime shipping rate calculation service returned the following error:
The requested service is unavailable between the selected locations. (errorcode: 111210)
Sorry, there are no available shipping methods for your location.:

It sounds like this error is caused because it hasn't yet received the zipcode yet. Is it possible to make it so it doesn't show this error?

Thank you.

sbtiti 08-09-2005 03:06 PM

bump

sbtiti 08-22-2005 03:04 PM

How to we prevent this error

Quote:

UPS Realtime shipping rate calculation service returned the following error:
The requested service is unavailable between the selected locations. (errorcode: 111210)
Sorry, there are no available shipping methods for your location.:


from appearing before a zipcode is inputed by the user the first time?

TJ Stephens 08-23-2005 04:47 PM

sbtiti,

Go to your general settings and make sure "When a customer isn't logged in, it is presumed that he is from the default country.:" is unchecked. That should keep you from gettin the error.

T.J.

TJ Stephens 08-24-2005 08:39 AM

For this module to work properly with other defined shipping methods I had to make one small change. This is the fix to the problem I was having in my May 31, 2005 post where the "Select a Carrier" drop down box was disappearing after I selected "Other Carriers":

Go to skin1/customer/main/cart_totals.tpl

Find:

Code:

{* $Id: cart_totals.tpl,v 1.67.2.10 2005/03/14 13:03:32 mclap Exp $ *}
<DIV align="right">
{if $config.Shipping.disable_shipping ne "Y"}
{if $login ne "" or $config.General.apply_default_country eq "Y" or $cart.shipping_cost gt 0}


Change To:

Code:

{* $Id: cart_totals.tpl,v 1.67.2.10 2005/03/14 13:03:32 mclap Exp $ *}
<DIV align="right">
{if $config.Shipping.disable_shipping ne "Y"}
{if $login ne "" or $config.General.apply_default_country eq "Y" or $cart.shipping_cost gt 0 or $estimate eq "NO"}


sbtiti 08-24-2005 09:45 AM

Thank you. That fixed the problems we were having, but I found another problem. In the "Select a carrier" there are only the options for UPS and "Other carriers". But in the adminCP we have fedex options enabled under shipping methods. Why and/or how do I get it so that the FedEx option appears as well?

Is there a field I need to fill in somewhere in the adminCP?

Any help would be appreciated. Thank you!

sbtiti 09-13-2005 07:28 AM

How do we get this mod to work with fedex? I followed the instructions in the "Step by Step setup of FedEx" thread ( http://forum.x-cart.com/viewtopic.php?t=21128&highlight= ) and now we get this error:

UPS Realtime shipping rate calculation service returned the following error:
The requested service is unavailable between the selected locations. (errorcode: 111210)
Sorry, there are no available shipping methods for your location.:

before a zipcode is inserted.

Any ideas?

anime101 10-09-2005 07:03 PM

Newbie here!

I used the MOD on page 5. Every thing works perfectly. However, when one types in their shipping zip code, it gives you the actual cost of shipping not the shipping with markup.

For example: USPS Priority for a 1lb item cost $3.85. The customer sees on the pre-login shipping calculator $3.85 instead of the $4.85 which includes markup.

Anyone have a solution or knows what files to manipulate so that it will show shipping with markup?

Help appreciated. Thanks!

Vacman 10-10-2005 06:09 AM

Quote:

Originally Posted by anime101
Newbie here!

I used the MOD on page 5. Every thing works perfectly. However, when one types in their shipping zip code, it gives you the actual cost of shipping not the shipping with markup.

For example: USPS Priority for a 1lb item cost $3.85. The customer sees on the pre-login shipping calculator $3.85 instead of the $4.85 which includes markup.

Anyone have a solution or knows what files to manipulate so that it will show shipping with markup?

Help appreciated. Thanks!


By any chance are you using Intershipper? If so, they have a markup section where you can do this. If not, I too would be interested in seeing this...

jgold723 10-12-2005 10:17 AM

Tried this but got an error
 
Hi Rackit --

I tried your code on my version (4.0.5) but I got an error ("missing T-STRING on line 57")

That line is: $zipcode_estimate = "";

I also noticed that the block of code you replace doesn't match mine exactly. I have this for the block:


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");

Any suggestions as to what I should be looking for?

Thanks,

John

pavant 10-27-2005 11:27 PM

Dear RackIt,
I really liked your change so I tried to implement it. But when I press the calculate button nothing happens. It looks like there is a link missing. Can you tell me what it should be?

Many Thanks in advance.

NOTE: Never mind. I asked the question before I realized there were 10 pages of posts. :oops: The post by Carrie works great! Thanks anyway. :D

pomfret 11-15-2005 03:28 AM

Has anyone modified this mod to include tax calculation? Either based on states or zipcode?

Whle the latter would be more work, it would keep the interface for this mod nice and clean (instead of requiring a states drop down plus the zip input field). Also, I was wondering if we'll encounted problems with zip+4, or does X-Cart already handle the +4 part?

I'd like to thank the OP and contributors in this thread for their hard work in producing a nice little S&H calculator. Kudos.

Thanks,

Brian

TJ Stephens 11-15-2005 07:49 PM

Pomfret, you can find instructions on how to calculate tax based on zipcode on page 6 of this thread. I'm not sure about the zip+4 issue but I don't think the +4 will make a difference when it comes to shipping or tax calculations.

pomfret 11-16-2005 03:14 AM

Quote:

Originally Posted by TJ Stephens
Pomfret, you can find instructions on how to calculate tax based on zipcode on page 6 of this thread.


Wow, I can't believe I missed that. Thanks for the note!

Brian

Mr Bob 12-04-2005 08:38 PM

Has anyone been able to add this to the right side box that displays the # of items in your cart? I would like something that has an input box that lets you enter your zip code, and display the shipping rates. It seems like this mod only works while you are actually on the shopping cart page, correct?

yuehan 12-13-2005 01:26 PM

Quote:

Originally Posted by Mr Bob
Has anyone been able to add this to the right side box that displays the # of items in your cart? I would like something that has an input box that lets you enter your zip code, and display the shipping rates. It seems like this mod only works while you are actually on the shopping cart page, correct?


I pasted in this mod, but couldn't get it to work right away. BCS Engineering came to my rescue and got it working. The box on the right that you are referring to, I believe is known as the "mini-cart." On mine, with the mod working now, the mini-cart does show the total including shipping, but only if you have already gone to the shopping cart and entered your ZIP code. My mini-cart does not show the breakdown of product vs shipping, just a grand total. And you do have to go to the actual cart page to enter the ZIP code.

Mr Bob 12-14-2005 08:03 PM

It doesn't help much if the user can't easily find out what the shipping is for the items in their cart. One day... someone will create/sell the mod.

yuehan 12-15-2005 03:43 PM

It is VERY easy! And it's working now!

I highly recommend this mod.

dprice.sf 12-18-2005 03:31 PM

I've got this mod to work in 4.0.16 for fedex rates - but once a customer adds a zip code and calculates the shipping the option to change that entry doesn't appear.

It should be displaying "Click here to change your zip code"

Anyone have any ideas?

Heres what my code looks like

Code:

{if $not_logged_message eq "1"}

{if $estimate ne "NO"}

Enter your zip code to calculate shipping charges.

<input type=TEXT name='zip_estimate' size=5 maxlength=5>
<input type=image alt="Calculate Shipping" src="{$ImagesDir}/calculate.gif" border=0 align=middle name=btnCalculate>
{else}


Click here to change your zip code
{/if}
{/if}


dprice.sf 12-19-2005 03:16 PM

I figured out what the problem was with my previous post. Works now thats to BCS Engineerings Mod.

Nwo I'm trying to remove the default shipping message

"Sorry, there are no available shipping methods for your location.:
anonymous"

Does anyone have any idea on how hide this message - I assume its tied to the login querry in cart.php

And that if someone enters a zip which fedex doesn't ship to - they'll get a similar message

So I can't just delete the function

Any thought/ideas would be great

simco 01-17-2006 04:56 PM

Does this mod work for version 4.0.17?

rubberneck 01-29-2006 08:30 PM

Tax
 
Ok, I think I'm missing something. I've got this working perfectly, except for the tax. I have my cart set to charge MA sales tax for orders in MA. This works fine on checkout, but with the pre-login shipping calculator, it includes the tax no matter which zip code is input. This is confusing to the user as it shouldn't be showing tax in the total if they're not using a MA zip code.

Any ideas.

I'm in version 4.0.17 by the way.

Thanks,
jeff

B00MER 02-07-2006 09:08 AM

Shipping Estimator for US and Canada
 
I've modified the original code to take Canada into consideration and allow both US and CA zipcodes to be utilized.

Edit Cart.php locate:
Code:

$intershipper_recalc = "Y";

BEFORE this add:
Code:

# prelogin calculator start
# modified by cart-lab.com to allow US and CA zipcodes
x_session_register("zipcode_estimate");
$trusted_post_variables = array("zip_estimate");
require $xcart_dir."/include/states.php";
if($HTTP_GET_VARS['zip_estimate'] == "clear"){
      $zipcode_estimate = "";
      func_header_location("cart.php");
      }
   
if(!empty($zip_estimate)){
      $zipcode_estimate = $zip_estimate;
     
      #$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");
      $count = strlen($zipcode_estimate);

      if($count < 4){  //checking for 5 digits
          $zipcode_estimate = "";}
           
      func_header_location("cart.php");
      }
if($zipcode_estimate != ""){
        $count = strlen($zipcode_estimate);
                if($count == 5) {
      $config["General"]["apply_default_country"] = "Y";
      $config["General"]["default_zipcode"] = $zipcode_estimate;
      $userinfo["s_zipcode"] = $zipcode_estimate;
      $smarty->assign("estimate","NO");
    } else {
                  $config["General"]["apply_default_country"] = "Y";
                  $config["General"]["default_country"] = "CA";
                  $config["General"]["default_zipcode"] = $zipcode_estimate;
                  $userinfo["s_country"] = "CA";
                  $userinfo["s_zipcode"] = $zipcode_estimate;
                  $smarty->assign("estimate","NO");                               
    }
   
      }

# prelogin calculator end


Now onto the .tpl, edit skin1/customer/main/cart_totals.tpl and locate:
Code:

<input type=hidden name=paymentid value="{$smarty.get.paymentid|escape:"html"}">

BEFORE this line add:

Code:

{* Shipping Estimate *}

{*{if $not_logged_message eq "1"}{$lng.txt_order_total_msg}{/if}*}

{if $login eq ""}

{if $estimate ne "NO"}

Enter your zip code to estimate shipping charges:

<input type=TEXT name='zip_estimate' size=6 maxlength=6>
{*{include file="main/states.tpl" states=$states name="s_state" default=$userinfo.s_state default_country=$userinfo.s_country}*}
<input type=image alt="Calculate Shipping" src="{$ImagesDir}/go.gif" border=0 align=absmiddle name=btnCalculate>

  {else}

Click here to change your zip code: {$userinfo.s_zipcode}

  {/if}
{/if}

{* END Shipping Estimate *}


:!: Note the original commented code that will need to be replaced as well:
Code:

{*{if $not_logged_message eq "1"}{$lng.txt_order_total_msg}{/if}*}

Anyhow, I figured I would contribute this extension to an already much needed mod X-Cart should have by default if you ask me :)

AWDC 02-08-2006 12:29 PM

Some people have asked about this and no one has responded. Does anyone know of way to let the customer calculate the shipping cost for an item BEFORE adding it to the cart? Like maybe adding this to the product description page? This seems much more logical than making the customer add the product to the cart and THEN seeing how much the shipping is.

B00MER 02-08-2006 01:19 PM

Best method I could think of is to utilize this same code but rather make a seperate form on product pages that submits to a custom PHP page where you can easily add it to the customers cart, get the calculation, display it to the user and remove the item from the customers cart.

Basically adding and removing the product to the customers cart would be transparent as to get all the needed $cart variables to perform the estimation. Problem with this is if a customer already has something in their cart, the calculation would be for both items instead of one.

speedworx 02-28-2006 03:05 PM

Advanced Order Management
 
Has anyone figured out how to get this to wok in AOM? If you attempt to modify an order, it throws an error:
Invalid argument supplied for foreach() in /xxx/shipping/mod_UPS.php on line 275

I'm assuming that the problem is due to the fact that the products aren't "in the cart" anymore, but rather in an orders table. The section of code that causes the error is:

Code:

EOT;
//<? //only in here to make code look nicer in php editor..doesn't affect anything
global $cart;
$upsmxwt = "150";
if ($UPS_weight >= $upsmxwt)
{
foreach($cart['products'] as $prodKey => $prodArray)
{
  for( $quantity=0; $quantity<$prodArray['amount'];$quantity++)
  {
      $UPS_weight = $prodArray['weight'];
      $query .=<<<EOT
        <Package>
            <PackagingType>
              <Code>$packaging_type</Code>
            </PackagingType>
            <PackageWeight>
              <UnitOfMeasurement>
                  <Code>$UPS_wunit</Code>
              </UnitOfMeasurement>
              <Weight>$UPS_weight</Weight>
            </PackageWeight>
$dimensions_query
$pkgparams
        </Package>
EOT;



All times are GMT -8. The time now is 09:40 PM.

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