The variable $product_check is used, but never declared/calculated... Shouldn't be hard to get it sorted, but basically. Need to return the tax class(es) for the product in question before using the cost comparison. That way the 10% tax would get factored into the difference between the two prices which each are showing to be taxed (requires calculaton to get there), but when resolving the difference between the two the tax is not yet applied.
I thought I remembered seeing that the ZC version of the function has a large SQL statement to factor for all tax types, the session information, etc... And that (the SQL execute result) needs to be set to the variable $product_check[/QUOTE]
[/quote]
To me, it looks like his function, pt_get_discount_amount, was taken from the middle of Zencarts zen_get_products_display_price. And that has the following before the code:
Code:
$product_check = $db->Execute("select products_tax_class_id, products_price, products_priced_by_attribute, product_is_free, product_is_call, products_type from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'" . " limit 1");
// no prices on Document General
if ($product_check->fields['products_type'] == 3) {
return '';
}
So if this function only needs the tax class id, it could be shortened to:
Code:
$product_check = $db->Execute("select products_tax_class_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'" . " limit 1");
I'm still looking for the SQL version you mentioned above but it really depends on whether I am guessing correctly as to what this function should do. So maybe the best advice would be is to chose a new template?
Bookmarks