fubu Posted July 27, 2003 Posted July 27, 2003 Hi, I have a bit of a dilemma. I've turned on display tax (10%) under admin, so the catalogue displays the price of each product including tax. However, when the customer checkout I want the tax to be subtracted from the subtotal. Currently if a $10 product is purchased it'll display subtotal=10, tax=1 and total=10. How can I change this so it displays subtotal=9, tax=1 and total=10? This will need to be modified in the invoice as well. Thanks in advance!
Rumble Posted July 27, 2003 Posted July 27, 2003 Hi, I think your mathematics is a little off Sub total = 9 Tax = 1 Total = 10 the percentage of tax applied is not 10% because 10% of 9 is 0.90 thus total would really be Sub total = 9 Tax (10%) = 0.9 Total = 9.90 Your solution would be to input the ex-tax total in the price then apply the tax as it is now So if you want the total price including tax to be 10 with 10% tax Sub total = 9.09 Tax (10%) = 0.91 Total = 10.00 Thus your product price would be 9.09 Reddy to Rumble Thank you osCommerce and all who Contribute to her!
fubu Posted July 28, 2003 Author Posted July 28, 2003 You don't understand. I want the tax to be included in the catalog but I want it to be excluded in the actual order when they check out. For a $10 product a 10% tax is $1. So in the catalog I want it to display $10 (including tax), and when they checkout it'll display subtotal $9, tax $1 and total $10.
Rumble Posted July 28, 2003 Posted July 28, 2003 I totally get you but your calculations are still wrong, trust me im an accountant :D If 10% tax has been applied to a product and its final price including tax ends up being $10. Then the tax amount on that total is NOT $1 $9.00 + 10% tax Total = $9.00 + (($9.00/100)*10) Total = $9.00 + ($0.09*10) Total = $9.00 + $0.90 Total = $9.90 (NOT $10!!!!!!!!!!!!!!!!!!!) $10.00 (10% tax included) Sub Total = $10.00/1.10 Sub Total = $9.09 SO! When you create a product and want its TOTAL to be $10 with a 10% tax applied, in the price input box enter $9.09!!!!!!!!! I know this isnt an answer to your query but I just wanted to highlight the error in your math!! :wink: Reddy to Rumble Thank you osCommerce and all who Contribute to her!
fubu Posted July 28, 2003 Author Posted July 28, 2003 Maths aside does anyone have any helpful solution to this problem?
Rumble Posted July 28, 2003 Posted July 28, 2003 Why do you want to show a tax included figure in the product listing/info page etc and not end up charging them tax? Reddy to Rumble Thank you osCommerce and all who Contribute to her!
Rumble Posted July 28, 2003 Posted July 28, 2003 Actually, paste your catalog/includes/modules/order_totals/subtotal.php file here! Reddy to Rumble Thank you osCommerce and all who Contribute to her!
Rumble Posted July 28, 2003 Posted July 28, 2003 i meant catalog/inlcudes/modules/order_total/ot_subtotal.php Reddy to Rumble Thank you osCommerce and all who Contribute to her!
fubu Posted July 28, 2003 Author Posted July 28, 2003 Here you go. I want the subtotal for each product to have the 10% tax taken out from the total, so it makes more sense when people look at their invoice. <?php /* $Id: ot_subtotal.php,v 1.7 2003/02/13 00:12:04 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ class ot_subtotal { var $title, $output; function ot_subtotal() { $this->code = 'ot_subtotal'; $this->title = MODULE_ORDER_TOTAL_SUBTOTAL_TITLE; $this->description = MODULE_ORDER_TOTAL_SUBTOTAL_DESCRIPTION; $this->enabled = ((MODULE_ORDER_TOTAL_SUBTOTAL_STATUS == 'true') ? true : false); $this->sort_order = MODULE_ORDER_TOTAL_SUBTOTAL_SORT_ORDER; $this->output = array(); } function process() { global $order, $currencies; $this->output[] = array('title' => $this->title . ':', 'text' => $currencies->format($order->info['subtotal'], true, $order->info['currency'], $order->info['currency_value']), 'value' => $order->info['subtotal']); } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_SUBTOTAL_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function keys() { return array('MODULE_ORDER_TOTAL_SUBTOTAL_STATUS', 'MODULE_ORDER_TOTAL_SUBTOTAL_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 Sub-Total', 'MODULE_ORDER_TOTAL_SUBTOTAL_STATUS', 'true', 'Do you want to display the order sub-total cost?', '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_SUBTOTAL_SORT_ORDER', '1', 'Sort order of display.', '6', '2', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } } ?>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.