Stealth1 Posted June 7, 2010 Posted June 7, 2010 Does anyone have a fix for the fact that taxes aren't applied to product attributes?
Guest Posted June 7, 2010 Posted June 7, 2010 Chris, In a standard OSC store, taxes are applied to the sub-total of all products added to the shopping cart. If your taxes are not being applied, you should look at any contributions (particularly order total contributions) for the reasons why. Chris
Stealth1 Posted June 8, 2010 Author Posted June 8, 2010 Chris, In a standard OSC store, taxes are applied to the sub-total of all products added to the shopping cart. If your taxes are not being applied, you should look at any contributions (particularly order total contributions) for the reasons why. Chris The last time I inquired about his I was told the stock OSC setup was to not add tax to attributes and only to the base price. I have the Canada Taxes order total module installed, could this be the issue? Below is the only file that this changes. <?php /* $Id: ot_tax.php, v1.3 BETA Canada Taxes Order Total Module (including Quebec) by Vincent Demers [email protected] released on 2008/04/13 hpdl Exp $ Update by Jacob (Jack) Gryn to check sort order if shipping comes after taxes, don't tax shipping Update by Vincent Demers to handle tax class on 2009/03/10 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ function get_subtotal($order) { $sutotal=0; for($i=0; $i < sizeof($order->products); $i++) { //Add only products with taxable class if ($order->products[$i]['tax'] != 0) { $subtotal+=($order->products[$i]['qty']*$order->products[$i]['price']); } } return $subtotal; } class ot_tax { var $title, $output; function ot_tax() { $this->code = 'ot_tax'; $this->title = MODULE_ORDER_TOTAL_TAX_TITLE; $this->description = MODULE_ORDER_TOTAL_TAX_DESCRIPTION; $this->enabled = ((MODULE_ORDER_TOTAL_TAX_STATUS == 'true') ? true : false); $this->sort_order = MODULE_ORDER_TOTAL_TAX_SORT_ORDER; $this->output = array(); } function process() { global $order, $currencies; //WARNING: This module does not consider tax_class!!! We assume everything is taxable. //We run SQL to get total number of taxes configured for our shipping zone //If we have many taxes rates configured, we will compare tax priorities. //If taxes have different priorities, ot_tax will apply 2nd priority tax_rate over 1rst (ex: for Quebec we have PST over GST), we assume GST has the lowest priority. //If taxes have the same priorities, ot_tax still show taxes on two line but dosen't apply compounded taxes (ie: Ontario) //If we get only one tax result, we assume we are handling only GST or HST (same scenario) $tax_priority_query = tep_db_query("select tax_priority from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id = '" . $order->delivery['country']['id'] . "') and (za.zone_id = '" . $order->delivery['zone_id'] . "') order by tr.tax_priority"); $tax_query_raw="select tax_rates_id, tax_priority, tax_rate, tax_description from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id = '" . $order->delivery['country']['id'] . "') and (za.zone_id = '" . $order->delivery['zone_id'] . "') order by tr.tax_priority"; if (tep_db_num_rows($tax_priority_query)) { if (tep_db_num_rows($tax_priority_query) == 2) { //Show taxes on two lines $i=0; while ($tax = tep_db_fetch_array($tax_priority_query)) { //compare tax_priotiries if ($i == 0) { $tax_priority = $tax['tax_priority']; } else { if ($tax_priority != $tax['tax_priority']) { $compound_tax=true; } else { $compound_tax=false; } } $i++; } //END Compare tax priorities $tax_query = tep_db_query($tax_query_raw); if ($compound_tax) { //ie Quebec $j=0; while ($tax = tep_db_fetch_array($tax_query)) { if ($j == 0) { $gst_description = $tax['tax_description']; $gst_rate = $tax['tax_rate'] / 100; } elseif ($j >= 1) { $pst_description = $tax['tax_description']; $pst_rate = $tax['tax_rate'] / 100; } $j++; } //$subtotal = $order->info['subtotal']; $subtotal=get_subtotal($order); if(MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER < MODULE_ORDER_TOTAL_TAX_SORT_ORDER) $subtotal += $order->info['shipping_cost']; $gst_total = tep_round($subtotal * $gst_rate, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']); $pst_total = ($subtotal+$gst_total) * $pst_rate; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { if ($value > 0) { $this->output[] = array('title' => $gst_description.':', 'text' => $currencies->format( $gst_total, true, $order->info['currency'], $order->info['currency_value']), 'value' => $gst_total); $this->output[] = array('title' => $pst_description.':', 'text' => $currencies->format( $pst_total, true, $order->info['currency'], $order->info['currency_value']), 'value' => $pst_total); } } } else { //ie: Ontario $j=0; while ($tax = tep_db_fetch_array($tax_query)) { if ($j == 0) { $gst_description = $tax['tax_description']; $gst_rate = $tax['tax_rate'] / 100; } elseif ($j >= 1) { $pst_description = $tax['tax_description']; $pst_rate = $tax['tax_rate'] / 100; } $j++; } //$subtotal = $order->info['subtotal']; $subtotal=get_subtotal($order); if(MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER < MODULE_ORDER_TOTAL_TAX_SORT_ORDER) $subtotal += $order->info['shipping_cost']; $gst_total = tep_round($subtotal * $gst_rate, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']); $pst_total = $subtotal * $pst_rate; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { if ($value > 0) { $this->output[] = array('title' => $gst_description.':', 'text' => $currencies->format( $gst_total, true, $order->info['currency'], $order->info['currency_value']), 'value' => $gst_total); $this->output[] = array('title' => $pst_description.':', 'text' => $currencies->format( $pst_total, true, $order->info['currency'], $order->info['currency_value']), 'value' => $pst_total); } } } } elseif (tep_db_num_rows($tax_priority_query) == 1) { //Only GST or HST applies $tax_query = tep_db_query($tax_query_raw); while ($tax = tep_db_fetch_array($tax_query)) { //$subtotal = $order->info['subtotal']; $subtotal=get_subtotal($order); if(MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER < MODULE_ORDER_TOTAL_TAX_SORT_ORDER) $subtotal += $order->info['shipping_cost']; $hst_total = $subtotal * ($tax['tax_rate'] / 100); reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { if ($value > 0) { $this->output[] = array('title' => $tax['tax_description'].':', 'text' => $currencies->format( $hst_total, true, $order->info['currency'], $order->info['currency_value']), 'value' => $hst_total); } } } } } //We calculate $order->info with updated tax values. For this to work ot_tax has to be last ot module called, just before ot_total $order->info['tax'] = tep_round($gst_total,$currencies->currencies[DEFAULT_CURRENCY]['decimal_places']) + tep_round($pst_total,$currencies->currencies[DEFAULT_CURRENCY]['decimal_places']) + tep_round($hst_total,$currencies->currencies[DEFAULT_CURRENCY]['decimal_places']); $order->info['total'] = $order->info['subtotal'] + $order->info['tax'] + $order->info['shipping_cost']; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_TAX_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function keys() { return array('MODULE_ORDER_TOTAL_TAX_STATUS', 'MODULE_ORDER_TOTAL_TAX_SORT_ORDER'); } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Tax', 'MODULE_ORDER_TOTAL_TAX_STATUS', 'true', 'Do you want to display the order tax value?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_TAX_SORT_ORDER', '3', 'Sort order of display.', '6', '2', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } } ?>
Stealth1 Posted December 12, 2010 Author Posted December 12, 2010 Still trying to get this figured out, I can't understand how so many people use this store but I can't find a fix for this.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.