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)

B00MER 08-25-2004 10:25 AM

btw, try this and it should fix the issue for 3.5.8+: open up top.inc.php

find:

Code:

if (!in_array($__key, array("HTTP_GET_VARS","HTTP_POST_VARS","HTTP_SERVER_VARS","HTTP_ENV_VARS","HTTP_COOKIE_VARS","HTTP_POST_FILES","__key","__val")))
to:
Code:

if (!in_array($__key, array("HTTP_GET_VARS","HTTP_POST_VARS","HTTP_SERVER_VARS","HTTP_ENV_VARS","HTTP_COOKIE_VARS","HTTP_POST_FILES","__key","__val","_GET","_POST","_SERVER")))

I just noticed this mod uses _GET globals which was capped in 3.5.8+ for security reasons. Although it breaks quite a few mods. hth. ;)

joestern 08-25-2004 04:15 PM

Thanks very much for the input. This did something, but it did not seem to do the trick. Before the change, we would input a zip code and the screen would refresh, but the shipping would not calculate. Instead, the "Enter your Zip code" input box would remain. Also, after we enter a zip code, the shipping drop down box disappears, and the follow shows up "To calculate shipping costs, please proceed to step one of checkout. anonymous."

Now, after Boomer's suggested change, X-cart seems to get the zip-code entry (because it gives the "To change your zip code click here" option), but it does not calculate shipping. Also, once you have entered a zip code, the "To change your zip code" option is dead--it does not actually work.

Our troubleshooting shows:
X-Cart IS getting the zip code (it is changing zipcode_estimate)
X-Cart IS setting "default country" to "Y"

Any thoughts?
Thanks!

adubas 08-28-2004 06:54 AM

Will this work with v4.0.3 ?

inksticks 09-01-2004 05:21 AM

pre-login shipping calculator
 
I would really appreciate it if someone could post a pre-login shipping calculator mod for version 4.0.3. I would also like to request that their would be a country drop down menu in addition to the zip/postal code box so that international customers could also figure their shipping costs. Thank you for the assistance.

jburdi 09-04-2004 12:17 AM

i dunno if anyone else is having this problem, but for some reason when I use this to calculate shipping, it adds NY state sales tax, no matter what zip I put in. the spot that says "Tax" still says n/a, but tax is figured into the order total. i dont want take to be figured out at all unless they are logged in.

i am using 3.5.6, any information would be helpful, thanks.

nbsp 09-15-2004 10:23 PM

I feel this is a very important mod and would like to thank the contributors.

Can anyone confirm that this work with x-cart 4.0.3 and FedEx?

(I assume I am using Net::SSLeay since the Admin Summary states that one as active.)

inksticks 09-22-2004 02:52 AM

pre-login shipping calculator
 
I would really appreciate knowing if someone is having success developing a pre-login shipping calculator for version 4.0.4. I want it to work internationally which would require 2 fields: zip code and country. Zip code could not be limited to 5 digits or only numbers or it would not work for Canada. Please let me know what the possibilities are of getting this. Thanks!

B00MER 09-22-2004 05:46 AM

Zipcode would really only work with a live shipper like UPS or Fedex. I'm testing this mod on a 3.5.11 setup and using just a zipcode with zone shipping charges won't do anything because x-cart has to know the country and state in order to apply you to the proper zone.

I agree the zipcode mask should be greater than 5 for other country zip codes. But I think allowing the user to choose their country/state should give them the most accurate shipping quote.

I'll let you know what I find.

BCSE 09-23-2004 10:36 AM

I just installed this on a 4.0.4 version today. Here's the code I used:

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:

x_session_register("zipcode_estimate");

if($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");

      if($count != 5){  //checking for 5 digits
          $zipcode_estimate = "";}
      if($mode=="checkout")
              func_header_location("cart.php?mode=checkout");
      else       
        func_header_location("cart.php");
}
if($zipcode_estimate != "")
{
      $config["General"]["apply_default_country"] = "Y";
      $config["General"]["default_zipcode"] = $zipcode_estimate;
      $smarty->assign("estimate","NO");
}


Then in skin1/customer/main/cart_totals.tpl Before:
Code:

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

Add:
Code:

{* BCSE Begin *}
{if $login}
{else}
        {if $estimate ne "NO"}
           
Enter your zip code to calculate shipping charges.

                <input type=TEXT name='zip_estimate' size=5 maxlength=5>
                {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 *}


Hope this helps! Thanks for the original code rackit!

Carrie

inksticks 09-23-2004 02:21 PM

Thank you
 
Thank you for the post for 4.0.4 It works great! Any chance of modifying the code a little so that we could get a country field in there and so that international customers could use it. The zip code field would also have to be expanded to accept more that just 5 characters and would need to accept letters as well as numbers since some countries zip codes, like Canada for example, use alfa/numeric codes. I would really appreciate such a modification.


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

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