I have spent the last month trying to debug an issue with Loaded that was driving me crazy.
I wanted to post it here in case someone else has the same issue or potentially, someone here who knows more than I do, might see why it happened and can advise what I have misconfigured.
Referring specifically to the product lines in email order notification:
$email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
EMAIL_SEPARATOR . "\n" .
$this->products_ordered .
EMAIL_SEPARATOR . "\n";
When creating orders using "Bank Transfer" these amounts were being displayed "Tax Inclusive" - Which was as expected
When creating orders using "PayPal" these amounts were being displayed "Tax Exclusive" - Which was not as expected.
It appears that in the file includes/functions/general.php there is the function tep_add_tax() which determines whether to return a value Tax Inc or Tax Exc.
This line:
if ( (DISPLAY_PRICE_WITH_TAX == 'true') && ($tax > 0) && $_SESSION['sppc_customer_group_show_tax'] == '1') {
returns true on "Bank Transfer" order but false on PayPal orders.
I simply copied this function, renamed the copy to tep_force_add_tax() and removed the if {} else {} part and just forced the addition of tax which fixed my problem!
I'm 99.9% sure that the issue lies with this variable:
$_SESSION['sppc_customer_group_show_tax']
I have no idea what it is, how it is set and why PayPal doesn't set it when a Bank Transfer does?
I welcome any dicussion?
sppc_customer_group_show_tax seems likely to be the source of the problem.
The Customer group tax settings are found in admin -> Customers -> Customer Groups on the customers_groups.php page.
The field that controls tax inclusive vs exclusive is labeled customers_group_show_tax.
I'd guess that the Paypal module may be attempting to get this from the customers_group table using the sppc_customer_group_show_tax associative array id, when it should use customers_group_show_tax instead.