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)

minorgod 02-04-2008 07:09 PM

Making it work with DHL/Airborne + Taxes
 
I just downloaded the official "FastLane" version of this mod from BCSE and installed it in Xcart 4.1.8 Gold. It seems to work well for U.S. addresses, but I'm still having a couple of issues...
  1. It doesn't seem to be working with international rates and DHL/Airborne, even though it looks like it should work with DHL/Airborne.
  2. Has anyone got a clue how to make this work so that it also calculates taxes prior to login? It looks like the right tweaks to the func_get_customer_zones_avail() or func_get_customer_zone_ship() inside /include/func/func.cart.php might do the trick, but I can't seem to get my head around it at the moment.

balinor 02-04-2008 07:25 PM

Re: Pre-Login Shipping Calculator
 
There was some discussion in this thread about taxes and non-US postal codes. Another glitch is still the fact that it does not seem to want to pull real-time rates for FedEx when you are using their new integrated method. Rates show fine when logged in, but the shipping calculator won't pull them.

minorgod 02-05-2008 08:58 AM

Re: Pre-Login Shipping Calculator
 
I've managed to get the Free X-cart Shipping Estimator for Fastlane Checkout mod to calculate taxes on US orders for a specific state. Simply open /include/shipping_calculator.php

FIND:
Code:

$config["General"]["default_zipcode"] = $zipcode_estimate; 
AFTER ADD:
Code:

  $config["General"]["default_state"] = "NY"; 

Presumably, at least for the time being, US stores only need to calculate tax on orders shipped to the state where the business is physically located, so if your store is in NY, the you simply need to set the default_state variable to "NY" and any zipcodes that are in your NY zone will get taxed, but zipcodes that are outside NY will not calculate taxes. Apparently, the zipcode is not enough to get x-cart to calculate taxes...it actually needs the state too. This will probably cause no end of frustration to international store owners.

Also, you might want to add this to your /skin1/mods/Fast_Lane_Checkout/cart_subtotal.tpl file:
Code:

{* normally this would only display if we have $config.Taxes.display_taxed_order_totals checked, but this totally screws up tax calculations on discounted products because it causes taxes to be applied before discounts rather than after discounts, so I'm just showing taxes here even if that setting is turned off *}
{* if $cart.taxes and $config.Taxes.display_taxed_order_totals eq "Y" *}
{if $cart.taxes}
    {foreach key=tax_name item=tax from=$cart.taxes}
    <tr class="TableSubHead">
        <td nowrap="nowrap" align="right">{$tax.tax_display_name}:</td>
        <td><img src="{$ImagesDir}/null.gif" width="5" height="1" alt="" /><br /></td>
        <td nowrap="nowrap" align="right">{include file="currency.tpl" value=$tax.tax_cost}</td>
        <td nowrap="nowrap" align="right">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$tax.tax_cost}</td>
    </tr>
    {/foreach}
{/if}


I'm still working on a solution to getting this working with international shipping. If anyone out there has a working solution to DHL/Airborne that will let my users choose just their country and zipcode and get a realtime rate, I will pay a reasonable fee for the code. Meanwhile, I'll be living in my debugger and will update this thread if I find a solution.


UPDATE: I was able to get international shipping estimates working with USPS and UPS. DHL is another story since you must supply a valid address to get a rate back from DHL. For anyone that is trying to get this working with DHL, here's some comments I just got from their XMLAPI support that might help:
Quote:

The elements <State> and <PostalCode> are required for Canada and Puerto Rico.
They are optional for other Countries.
If you do not know the PostalCode, you can use a default because RateIT
uses the Country to return a rate.

The State and Country elements must be two characters in length.


I have also discovered that if you enable UPS realtime rates with this mod, it totally messes up the returned rates for USPS and other shippers -- they show up as blank. To fix this problem, I did the following, though I'm not sure if there's any implications on performance or functionality of the UPS realtime rates, but it seems to work for me so far.....

OPEN: /xcart/shipping/shipping.php
FIND:
Code:

        if ($config["Shipping"]["realtime_shipping"] == "Y" && $current_carrier == "UPS") {
            $ups_condition .= " AND $sql_tbl[shipping].code='UPS' AND $sql_tbl[shipping].service_code!=''";
        }


and change to
Code:


        if ($config["Shipping"]["realtime_shipping"] == "Y" && $current_carrier == "UPS") {
            //$ups_condition .= " AND $sql_tbl[shipping].code='UPS' AND $sql_tbl[shipping].service_code!=''";
        }


If you don't comment that out, a bit of invalid SQL is added to queries for non-UPS shipping rates that keeps it from finding non-UPS rates when ithe /shipping/shipping.php file builds the actual $shipping array further down where it says:
Code:

$query =  "SELECT *, '$intershipper_rate[rate]' AS rate, '$intershipper_rate[warning]' AS warning, $ship_time_column FROM $sql_tbl[shipping] WHERE subcode='$intershipper_rate[methodid]' AND active='Y' $weight_condition ORDER BY orderby";
               
                $result = func_query_first($query);


If anyone understands the implications of my tweaks on the UPS mod, please post info here.

ValhallaComics 02-11-2008 12:29 PM

Re: Pre-Login Shipping Calculator
 
Hello,

I'm using 4.1.8 Gold (UNIX), and I have installed this mod, here:
http://forum.x-cart.com/showpost.php?p=174133&postcount=197

I was wondering, however, if I could get this to work as a pop-up box that will list the available shipping options/prices to the customer, instead of only having this available on the checkout/view cart page. Do any of you have a solution for this?

Here's a link to my site, where the calculator is in the category listing:

http://www.valhallacomics.com/home.php

imimin 02-26-2008 11:41 AM

Re: Pre-Login Shipping Calculator
 
Does someone know how I can take the code:

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="../skin1/images/calculate.gif" border=0  align=middle name=btnCalculate > 

  {else}

Click here to change your zip code

  {/if}
{/if}


and make the entry box come up in a pop-up box intead?

minorgod 02-26-2008 02:17 PM

Re: Pre-Login Shipping Calculator
 
Quote:

Originally Posted by imimin
Does someone know how I can take the code:

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="../skin1/images/calculate.gif" border=0  align=middle name=btnCalculate > 

  {else}

Click here to change your zip code

  {/if}
{/if}


and make the entry box come up in a pop-up box intead?


Check out the shipping calculator on http://www.bonobospants.com/store/ . I used the Highslide JS library to do it. You can probably view the source and the Highslide JS documentation and figure it out. If not, feel free to contact me and I will give you a quote to do it for you.

shippersplus 03-13-2008 09:19 AM

Re: Pre-Login Shipping Calculator
 
i can not seem to get this mod to work on 4.1.9 anyone able to?
the mod has no errors, but i do not see the click for zip code

samz724 03-13-2008 12:09 PM

Re: Pre-Login Shipping Calculator
 
This mod is excellent. Exactly what I needed, thanks! :mrgreen:

deltron3030 03-22-2008 11:20 AM

Re: Pre-Login Shipping Calculator
 
This mod works fine for me in 4.1.9, Balinor you can get fedex rates my adding this twice below

just under $ship_mods[] = "DHL";

add
if ($fedex_mod == 'FEDEX_direct')
$ship_mods[] = $fedex_mod;



in the myshipper.php file

deltron3030 03-22-2008 11:22 AM

Re: Pre-Login Shipping Calculator
 
Something funny i noticed is that for logged in customers they do not get the shipping estimate if they decide to update their cart with more products. Although anonymous customers do not have this problem.

Weird


All times are GMT -8. The time now is 05:18 PM.

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