Re: Speicals and Sales Tax Not Included
Quote:
Originally Posted by
MortalWombat
Yes, I know... I have no idea why the author altered the way prices are computed, and of course was not aware of the change until I began the template installation.
Well, the more I thought about this one, the more it could be likely. He may have built in other modules, who knows.
Quote:
All prices in the store, including the two lower ones shown in the attached screenshot ($32.50 and $19.50), are tax INclusive -- that is, EXCEPT for the price showing the amount saved ($11.82), which is EXclusive of tax.
[/quote]
So:
Price w tax: 32.50
Sale price w tax: 19.50
Did you put the sale price in by entering a % or an actual $ amount
What is the tax rate on that item?
What is the original price on the item?
It may be a different piece of code we need to look at.
Re: Speicals and Sales Tax Not Included
Just checking, did you try switching back to the classic template, do you get the same results or the correct results?
Re: Speicals and Sales Tax Not Included
Quote:
Originally Posted by
lruskauff
Well, the more I thought about this one, the more it could be likely. He may have built in other modules, who knows.
True.
Quote:
Originally Posted by
lruskauff
So:
Price w tax: 32.50 Correct
Sale price w tax: 19.50 Correct
Did you put the sale price in by entering a % or an actual $ amount A percentage amount (40% on this item) is entered on sale items. An actual amount is used for specials. This is actually an upgrade of a ZC installation I've been running for ~10 years, so it's all running as it should on the current live site.
What is the tax rate on that item? Tax rate is 10%
What is the original price on the item? Original price on the item in the screenshot is $32.50. Discount entered on sales maker is 40%, bringing the item down to $19.50.
It may be a different piece of code we need to look at.
Quote:
Originally Posted by
lruskauff
Just checking, did you try switching back to the classic template, do you get the same results or the correct results?
Switching back to the classic template computes the sales and specials prices correctly, so it is definitely the template alterations doing it.
Re: Speicals and Sales Tax Not Included
$32.50 price with tax. What is the price without the tax?
Re: Speicals and Sales Tax Not Included
Quote:
Originally Posted by
lruskauff
$32.50 price with tax. What is the price without the tax?
$32.50 without tax is $29.55.
Re: Speicals and Sales Tax Not Included
Probably because as far as sales go, the default admin entry doesn't deal/work with the show prices with taxes aspect... See the correction/adjustment posted here: https://www.zen-cart.com/showthread....02#post1284702
I was working on a way to show the two prices separately like what is done on the product entry page, but...
As for the remaining "issue", yes, price difference is shown with tax being added to the prices as if the price(s) were not "entered properly"... By properly meaning that in such a way as to show on the screen with the tax already considered... As a result the difference between the two prices should be as requested...
I have been able with a blank store have a product that displays with $50 for the normal price, applied a sale to give $40, have a 10% tax, and to show the store and admin side taxes and in the end get the desired result..
may need to modify the code so that it doesn't add tax to the differences..
Haven't tried to see what it takes to correct the way that the discount is calculated and why it is done differently than the ZC standard method. Anyways, the above code is some sort of special discount calculation code instead of using the values generated by the core function(s).
Re: Speicals and Sales Tax Not Included
45.4545 - $50 product with 10% sales tax applied, price entered as including tax,
36.3645 - $40 entered as a special price. Difference between these two values when tax is included in the prices is $10. Turn tax off, then things get weird..
Re: Speicals and Sales Tax Not Included
Here is the code you supplied:
PHP Code:
// Price Functions Improvement
function pt_get_discount_amount($products_id) {
global $db, $currencies;
$show_sale_discount = '';
$display_normal_price = zen_get_products_base_price($products_id);
$display_special_price = zen_get_products_special_price($products_id, true);
$display_sale_price = zen_get_products_special_price($products_id, false);
if (SHOW_SALE_DISCOUNT_STATUS == '1' and ($display_special_price != 0 or $display_sale_price != 0)) {
if ($display_sale_price) { IF THIS IS A SALE AND NOT A SPECIAL
if (SHOW_SALE_DISCOUNT == 1) { IF SHOW AS A PERCENT IS SET
if ($display_normal_price != 0) {
$show_discount_amount = number_format(100 - (($display_sale_price / $display_normal_price) * 100),SHOW_SALE_DISCOUNT_DECIMALS);
} else {
$show_discount_amount = '';
}
$show_sale_discount = $show_discount_amount . PRODUCT_PRICE_DISCOUNT_PERCENTAGE;
} else { IF SHOW AS AN AMOUNT IS SET
$show_sale_discount = $currencies->display_price(($display_normal_price - $display_sale_price), zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . PRODUCT_PRICE_DISCOUNT_AMOUNT;
}
} else { (IF THIS IS A SPECIAL AND NOT A SALE)
if (SHOW_SALE_DISCOUNT == 1) { IF SHOW AS A % IS SET
$show_sale_discount = number_format(100 - (($display_special_price / $display_normal_price) * 100),SHOW_SALE_DISCOUNT_DECIMALS) . PRODUCT_PRICE_DISCOUNT_PERCENTAGE;
} else { IF SHOW AS AN AMOUNT IS SET
$show_sale_discount = $currencies->display_price(($display_normal_price - $display_special_price), zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . PRODUCT_PRICE_DISCOUNT_AMOUNT;
}
}
}
return $show_sale_discount;
Hello again
I put the logic of your code in blue. With your example, the parts after "if SHOW AS AN AMOUNT IS SET" are the parts that compute the sales discount and returns it as a string with other crap (like the % sign or decimals). Except, it looks the same as the code in the normal functions_prices.php. (did you compare it against the code in functions_prices.php with an unmodified zencart? I'm very tired so maybe I'm not seeing it, BUT the only difference I see is that they have a class assigned which prob formats the string. So I'm stumped.
I would look at the code where this is returned and see if any more modifications are done to it before it is displayed.
Question: Did you test it with % to see if it gives the correct %? I would do that next.
Also, are you running version 1.54 of Zencart?
I'm sure someone will be back to help before I wake up and I know I will be anxious to see what the heck is wrong. But if not, I'll help you look some more. Sorry I'm no expert.
Linda
Re: Speicals and Sales Tax Not Included
OP claimed to be running 1.5.4 as seen on the page/tab title for this thread (can see it through my browser, but not necessarly on this page.
So like lruskauff, I was getting tired. But I see now wht was missing, ut haven't yet figured out how to generate it.
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 whch 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
Re: Speicals and Sales Tax Not Included
Quote:
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?