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)
-   -   elimination of sales tax for wholesale customers (https://forum.x-cart.com/showthread.php?t=16809)

coupdgras 09-23-2005 06:51 AM

elimination of sales tax for wholesale customers
 
Here is a mod for ver 3.5.x ( it will probably work with 4.x as well). This will eliminate default sales tas for wholesale customers.

Please open include/func.php of your x-cart, fund definition of function func_calculate_taxes and replace

if ($customer_info["s_state"])
$apply_taxes_to_shipping = array_pop(func_query_first("SELECT $sql_tbl[state_tax].tax_shipping FROM $sql_tbl[states], $sql_tbl[state_tax] WHERE $sql_tbl[states].code=$sql_tbl[state_tax].code $provider_condition AND $sql_tbl[state_tax].code='".$customer_info["s_state"]."' AND $sql_tbl[state_tax].country_code='".$customer_info["s_country"]."'"));


with

if ($customer_info["s_state"] && $customer_info['membership'] != 'Wholesale Level 1')
$apply_taxes_to_shipping = array_pop(func_query_first("SELECT $sql_tbl[state_tax].tax_shipping FROM $sql_tbl[states], $sql_tbl[state_tax] WHERE $sql_tbl[states].code=$sql_tbl[state_tax].code $provider_condition AND $sql_tbl[state_tax].code='".$customer_info["s_state"]."' AND $sql_tbl[state_tax].country_code='".$customer_info["s_country"]."'"));


then replace

if ($customer_info["s_state"])
$state_tax = func_query_first("select $sql_tbl[state_tax].* from $sql_tbl[states], $sql_tbl[state_tax] where $sql_tbl[states].code=$sql_tbl[state_tax].code $provider_condition and $sql_tbl[state_tax].code='".$customer_info["s_state"]."' AND $sql_tbl[state_tax].country_code='".$customer_info["s_country"]."'");

with

if ($customer_info["s_state"] && $customer_info['membership'] != 'Wholesale Level 1')
$state_tax = func_query_first("select $sql_tbl[state_tax].* from $sql_tbl[states], $sql_tbl[state_tax] where $sql_tbl[states].code=$sql_tbl[state_tax].code $provider_condition and $sql_tbl[state_tax].code='".$customer_info["s_state"]."' AND $sql_tbl[state_tax].country_code='".$customer_info["s_country"]."'");


In other words, you just need to add additional condition about membership level of a customer to
the function.

balinor 09-23-2005 07:30 AM

Just FYI so as not to confuse 4.x users, you can assign tax rates to specific membership levels in 4.x, so this mod wouldn't be necessary.


All times are GMT -8. The time now is 05:44 AM.

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