Pages:

Displaying tax in customer e-mail order

Heywood

Avatar: Heywood

2011-04-14 23:41

Hi everybody!
I want to write out tax as separate line in customer order what they get to e-mail.

I did calculation:
$aOrder['sOrderSummary2'] = ($aOrder['sOrderSummary'] - ($aOrder['sOrderSummary'] / 1.2));
$aOrder['fOrderSummary3'] = round($aOrder['sOrderSummary2'], 2);

I see right numbers in the webpage after i sent my order, but how i get this number to customer e-mail?

» Quick.Cart v3.x

http://raudselt.puustjapunaseks.ee/

Makaron

Avatar: Makaron

2011-04-15 16:17

Try to edit file templates/orders_print.tpl block CUSTOMER_ORDER_EMAIL_BODY and add this new variable $aData[fOrderSummary3]

I helped? Like it: www.facebook.com/makwebpl

Heywood

Avatar: Heywood

2011-04-16 01:48

not working...

http://raudselt.puustjapunaseks.ee/

boboo

Avatar: boboo

2011-04-16 06:17

You have to add this calculation as well into the function sendEmailWithOrderDetails in /core/orders.php
beacause the data for the e-mail will be created new, from saved!!! entry in database. and i suppose, you don't save the orderSummary3 into DB.
put them after the call: '$aData=$this->throwOrder($iOrder);'
and remember: the variables now will be called:
$this->aOrders[$iOrder]['xxxxx']
and NOT
$aOrder['xxxxx']

http://it-service.kimla.de QC- & QCMS-plugins

Heywood

Avatar: Heywood

2011-04-16 21:52

Still no hey-hoo's.
changed orderSummary3 to Tax and yes, i don't want to save it into DB

in file action_client/p.php after line
$sOrderProducts = $oOrder->listProducts( 'orders_print.tpl', $iOrder, 'ORDER_PRINT_' );
added
$aOrder['Tax'] = round(($aOrder['sOrderSummary'] - ($aOrder['sOrderSummary'] / 1.2)), 2);


in file core/orders.php after line
$aData['sOrderSummary'] = $this->aOrders[$iOrder]['sOrderSummary'];
added
$aData['Tax'] = $this->aOrders[$iOrder]['Tax'];


in file orders_print.tpl in section <!-- BEGIN ORDER_PRINT --> i can see $aOrder[Tax] value, but in sectoin <!-- BEGIN ORDER_PRINT_HEAD --> and <!-- BEGIN CUSTOMER_ORDER_EMAIL_BODY --> i can't see no $aOrder[Tax], or $aData[Tax] values.

Where is the dog buried?

http://raudselt.puustjapunaseks.ee/

Heywood

Avatar: Heywood

2011-04-25 10:52

Still no luck...
I tryed to add php code to order_print.tpl to do calculation there with $aData[sOrderSummary], cos i see $aData[sOrderSummary] in e-mail, but this also not working.


<?php
    $Tax
round(($aData[sOrderSummary]  - ($aData[sOrderSummary]  / 1.2)), 2);
    echo 
$Tax;
 
?>

http://raudselt.puustjapunaseks.ee/

beholder

Avatar: beholder

2011-04-25 12:40

you can't round $aData[sOrderSummary] because the format of the sSummary (s=string) could be something like:
1,000.30
It would make no sense to the system to 'multiply' that string.

Also, I am not sure if you should use $aData array because $aOrder['fSummary'] or $this->aOrders[$iOrder]['fSummary'] as bobo suggested could hold the content you need.

Heywood

Avatar: Heywood

2011-04-25 21:38

yes i can round and will get value as i need
$tax = round(($aOrder['sOrderSummary'] - ($aOrder['sOrderSummary'] / 1.2)), 2);
$aOrder['fOrderSummary3'] = round(($aOrder['sOrderSummary'] - ($aOrder['sOrderSummary'] / 1.2)), 2); (lines from action_client/p.php)
but this number will NOT go to e-mail
http://raudselt.puustjapunaseks.ee/tax.gif

http://raudselt.puustjapunaseks.ee/

boboo

Avatar: boboo

2011-04-26 05:45

why, what for???
i just added 1 (one!) line in /core/orders.php in function sendEmailWithOrderDetails and in function sendEmailToCustomerWithOrderDetails over the line:
$oTpl->setVariables( 'aData', $aData );
the added line is:
$aData['fTax']=normalizePrice(round($aData['sOrderSummary']-($aData['sOrderSummary']/1.2),2));
and one line in /templates/orders_print.tpl under the line:
$lang[Summary_cost]: $aData[sOrderSummary] $config[currency_symbol]
i added:
VAT: $aData[fTax] $config[currency_symbol]
that's all and it works.
just tested.

http://it-service.kimla.de QC- & QCMS-plugins

boboo

Avatar: boboo

2011-04-26 05:48

the line: VAT: $aData[fTax] $config[currency_symbol]
you have to add in BLOCK:
<!-- BEGIN CUSTOMER_ORDER_EMAIL_BODY -->
and if you want to get the e-mail with tax (as admin), so put the line into BLOCK:
<!-- BEGIN ORDER_EMAIL_BODY -->
as well.

http://it-service.kimla.de QC- & QCMS-plugins

Heywood

Avatar: Heywood

2011-04-26 09:30

Ok, it works, almost.

Now the customer will see the correct VAT line, but admin gets only 0.00

Yes, i double cheked all lines... removed my lines..

http://raudselt.puustjapunaseks.ee/

boboo

Avatar: boboo

2011-04-26 11:52

did you add the line:
$aData['fTax']=normalizePrice(round($aData['sOrderSummary']-($aData['sOrderSummary']/1.2),2));
in both functions???
(sendEmailWith... and sendEmailToCustomerWith...)

http://it-service.kimla.de QC- & QCMS-plugins

Heywood

Avatar: Heywood

2011-04-26 12:09

Yes, i added

http://raudselt.puustjapunaseks.ee/

Heywood

Avatar: Heywood

2011-04-27 10:21

done.

added sendEmail( $aSend, null, $GLOBALS['config']['orders_email'] ); to function sendEmailToCustomerWithOrderDetails and bloked same line in sendEmailWithOrderDetails

Thank you all.

http://raudselt.puustjapunaseks.ee/

Guido

Avatar: Guido

2011-09-27 23:41

Sorry for re-opening this old thread, but I have a question about the code from boboo:

$aData['fTax']=normalizePrice(round($aData['sOrderSummary']-($aData['sOrderSummary']/1.2),2));

I'm just a beginner, what is the percentage tax in this example?
How can I change the percentage to 6%?

Guido

boboo

Avatar: boboo

2011-09-30 05:39

Guido,
let's say, the netto price is 100 &#8364;.
To add 6% VAT (6,- &#8364;) we have to do:
6% = 1/100 * 6 = 6/100 = 0.06
100 eur = 1 'netto'
1 'brutto' = 1 * 'netto' + VAT
VAT = 0.06 * 'netto'
1 'brutto' = (1* 'netto') + (0.06 * 'netto')
1 'brutto' = (1 + 0.06) * 'netto' = 1.06 * 'netto'

It means: 1.2 = 20% VAT
1.06 = 6% VAT.

:-)

strzelectwo.kimla.de

boboo

Avatar: boboo

2011-09-30 05:41

this string: '&#8364' means the Euro-Symbol.

strzelectwo.kimla.de

Guido

Avatar: Guido

2011-09-30 13:43

boboo, MANY THANKS. It's working!

With topic 'Adding VAT / TAX to products' and this topic I now have vat/tax displayed in orderform AND in email to customer/admin

Guido

Avatar: Guido

2013-08-04 21:51

Hi,

In older versions I used boboo's code to display vat in email to admin/customer (see his post from 2011-04-26 05:45:29).
Who can tell me how to integrate it into new quickcart version?

Guido

I added this in old version:
File core/orders:
$aData['fTax']=normalizePrice(round($aData['sOrderSummary']-($aData['sOrderSummary']/1.2),2));
File templates/orders_print.tpl
VAT: $aData[fTax] $config[currency_symbol]

Guido

Avatar: Guido

2013-08-05 00:15

Found it myself, it's all located in file core/orders now (quickcart v6):

Look for 'Send email to admin with order details'

added this line:

$aData['fTax']=normalizePrice(round($aData['sOrderSummary']-($aData['sOrderSummary']/1.2),2));



And changed this line:

$aSend['sMailContent'] = preg_replace'/\|n\|/'"\n"$lang['Order_customer_email_head']."\n------------------------\n".$lang['Order_customer_personal']."\n------------------------\n".$aData['sFirstName'].' '.$aData['sLastName'].( isset( $aData['sCompanyName'] ) ? "\n".$aData['sCompanyName'] : null )."\n".$aData['sStreet']."\n".$aData['sZipCode'].' '.$aData['sCity']."\n".$aData['sPhone']."\n".$aData['sEmail'].( isset( $aData['sComment'] ) ? "\n\n".$lang['Comment'].': '.$aData['sComment'] : null )."\n------------------------\n".$lang['Order_customer_products']."\n------------------------".$sProducts."\n------------------------\n".( isset( $aData['iShipping'] ) ? $lang['Order_customer_shipping']."\n------------------------\n".$aData['mShipping'].' ('.$aData['mPayment'].') = '.$this->aOrders[$iOrder]['sPaymentShippingPrice'].' '.$config['currency_symbol']."\n\n" null ).$lang['Summary_cost'].': '.$this->aOrders[$iOrder]['sOrderSummary'].' '.$config['currency_symbol']."\n------------------------\n".$lang['Order_customer_email_foot'] );



Into:

$aSend['sMailContent'] = preg_replace'/\|n\|/'"\n"$lang['Order_customer_email_head']."\n------------------------\n".$lang['Order_customer_personal']."\n------------------------\n".$aData['sFirstName'].' '.$aData['sLastName'].( isset( $aData['sCompanyName'] ) ? "\n".$aData['sCompanyName'] : null )."\n".$aData['sStreet']."\n".$aData['sZipCode'].' '.$aData['sCity']."\n".$aData['sPhone']."\n".$aData['sEmail'].( isset( $aData['sComment'] ) ? "\n\n".$lang['Comment'].': '.$aData['sComment'] : null )."\n------------------------\n".$lang['Order_customer_products']."\n------------------------".$sProducts."\n------------------------\n".( isset( $aData['iShipping'] ) ? $lang['Order_customer_shipping']."\n------------------------\n".$aData['mShipping'].' ('.$aData['mPayment'].') = '.$this->aOrders[$iOrder]['sPaymentShippingPrice'].' '.$config['currency_symbol']."\n\n" null ).$lang['Summary_cost'].': '.$this->aOrders[$iOrder]['sOrderSummary'].' '.$config['currency_symbol']."\n------------------------\n".$lang['vat'].': '.$aData['fTax'].' '.$config['currency_symbol']."\n------------------------\n".$lang['Order_customer_email_foot'] );




Now vat is send in mail to admin and customer :-).

Guido

Pages:
Back to top
about us | contact