Home Communication board WiKi Get Quote

Application of all of the taxes to every product in X-Cart

X-Cart has a pretty complicated tax system. A store owner is able to create a tax list and apply it to each product separately. Also there is an ability to apply some specific tax to all currently existing products. It might work if you've got a static list of products, however if you constantly add new ones, some day you might just forget to apply the required tax to new products (that is done on a product modification page).

So, let's try to simplify the process and minimize risk of the mistake. If you need to apply all of the taxes automatically to all products including new ones, you might make this minor modification for a file include/func/func.taxes.php, find this line

	# Select taxes data
	$_taxes = func_query_hash("SELECT $sql_tbl[taxes].*, $sql_tbl[product_taxes].productid FROM $sql_tbl[taxes], $sql_tbl[product_taxes] WHERE $sql_tbl[taxes].taxid=$sql_tbl[product_taxes].taxid AND $sql_tbl[product_taxes].productid IN ('".implode("','", array_keys($_product))."') AND $sql_tbl[taxes].active='Y' ORDER BY $sql_tbl[taxes].priority", "productid");

And replace it with this one:

	$txs = func_query("SELECT $sql_tbl[taxes].* FROM $sql_tbl[taxes] WHERE $sql_tbl[taxes].active='Y' ORDER BY $sql_tbl[taxes].priority");
    foreach($_product as $pid=>$tmp)
        $_taxes[$pid] = $txs;

As the result, all of the taxes will be enabled for every product and you don't need to care about taxes for new products anymore.

PS: If you don't need taxes at all for some products - you are still able to use a “tax exempt” check box on the product modification page.

 
Home About us Privacy statement Terms & Conditions Refund policy © 2007–2024 ArsCommunity