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)
-   -   Ship From address not the same as Company location address (https://forum.x-cart.com/showthread.php?t=43400)

cflsystems 11-02-2008 09:27 AM

Ship From address not the same as Company location address
 
* Please move if not in the right forum *

This was tested on 4.1.10 Gold only and UPS Real Time USA only. By default X-Cart uses company location address as Ship From address. If these 2 adresses are different for you (in other words your company is in CA and the warehouse you ship from in KS) using the default X-Cart behaviour will result in inaccurate rates. This code makes it possible to have Ship From address different from company location address. Use at your own risk. No warranties of any kind. Make sure you backup first before making any changes. The code works for me. Here it is

Apply the following SQL patch (i did it with phpMyAdmin)
Code:

INSERT INTO `xcart_config` (`name`, `comment`, `value`, `category`, `orderby`, `type`, `defvalue`, `variants`, `validation`) VALUES
('ship_from_address', 'Street address', 'STREET GOES HERE', 'Company', 265, 'text', '', '', ''),
('ship_from_city', 'City', 'CITY GOES HERE', 'Company', 270, 'text', '', '', ''),
('ship_from_state', 'State', 'STATE ABBR GOES HERE', 'Company', 275, 'text', 'CA', '', ''),
('ship_from_zipcode', 'Zip/postal code', 'ZIP GOES HERE', 'Company', 280, 'text', '', '', ''),
('ship_from_country', 'Country', 'COUNTRY ABBR GOES HERE', 'Company', 285, 'text', 'US', '', ''),
('nov2', 'Ship from address', '', 'Company', 260, 'separator', '', '', '');

Replace the red with your own details. Also you will be able to change then from inside X-Cart Admin Area - Company details, any time you need to.


Next open /shipping/mod_UPS.php and find
Code:

#
# The origin address - from Company options
# (suppose that ShipperAddress and ShipFrom is equal)
#
$src_country_code = $config["Company"]["location_country"];
$src_city = func_ups_xml_quote($config["Company"]["location_city"]);
$src_state_code = func_ups_xml_quote($config["Company"]["location_state"]);
$src_zipcode = $config["Company"]["location_zipcode"];

after add
Code:

#
# The Ship From address - from Company options
# (suppose that ShipperAddress and ShipFrom are different)
#
$src_ship_from_country_code = $config["Company"]["ship_from_country"];
$src_ship_from_city = func_ups_xml_quote($config["Company"]["ship_from_city"]);
$src_ship_from_state_code = func_ups_xml_quote($config["Company"]["ship_from_state"]);
$src_ship_from_zipcode = $config["Company"]["ship_from_zipcode"];


In the same file find
Code:

<ShipFrom>
<Address>
<City>$src_city</City>
<StateProvinceCode>$src_state_code</StateProvinceCode>
<PostalCode>$src_zipcode</PostalCode>
<CountryCode>$src_country_code</CountryCode>
</Address>
</ShipFrom>

and replace with
Code:

<ShipFrom>
<Address>
<City>$src_ship_from_city</City>
<StateProvinceCode>$src_ship_from_state_code</StateProvinceCode>
<PostalCode>$src_ship_from_zipcode</PostalCode>
<CountryCode>$src_ship_from_country_code</CountryCode>
</Address>
</ShipFrom>


That's it. I will assume that for USPS and FedEx there will be similar changes but I do not use them so I didn't bother to check.

JWait 11-04-2008 05:10 AM

Re: Ship From address not the same as Company location address
 
How does this affect your tax structure? I mean, suppose I am in California, and your product ships from Kansas. Do I get charged Cal Sales Tax? What if I lived in Kansas, same question.

cflsystems 11-04-2008 05:56 AM

Re: Ship From address not the same as Company location address
 
This change has nothing to do with taxes. It only applies for real time shipping rates - ship from / ship to addresses send to UPS to calc the shipping charge.

Serra 12-05-2008 10:17 AM

Re: Ship From address not the same as Company location address
 
Quote:

Originally Posted by JWait
How does this affect your tax structure? I mean, suppose I am in California, and your product ships from Kansas. Do I get charged Cal Sales Tax? What if I lived in Kansas, same question.


That depends on state law. Normally, if you have a location in a specific state, then you have to charge tax in that state. If you have a location in CA and KS, then you charge state tax for shipments in both states.


All times are GMT -8. The time now is 07:46 PM.

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