[Skip to main content](#vessel-content)

#   Editing the email coupon value

##

- **[Twincarb](/forum/user/45624-twincarb "View Twincarb's Profile")**
- [![Twincarb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/45624-twincarb "View Twincarb's Profile") Topic Author
- [ Offline](/forum/user/45624-twincarb)

Less More

- Posts: 41
- Thank you received: 2
-
-

9 years 1 month ago [\#279719](#279719) by [Twincarb](/forum/user/45624-twincarb "View Twincarb's Profile")  *[Editing the email coupon value](/forum/35-orders-management/892215-editing-the-email-coupon-value#279719 "-- HikaShop version -- : 3.2.0 -- Joomla version -- : 3.8.0 -- PHP version -- : 7.1.9 -- Browser(s) name and version -- : All -- Error-message(debug-mod must be tuned on) -- : Nil  I have an issue with editing the email content in relation to the value of the coupon. The coupon value is 5%. In the global configuration apply discounts is set to before taxes. Detailed Tax display is selected. Show taxed prices is set to both. Tax is set to 20%  I have a requirement that the subtotal is shown excluding VAT, this has been easy to achieve by adjusting the various views, the last one being the email template.  I know I am using the correct template because I have been able to adjust it to show the subtotal without tax, below are the lines of code which I expected to adjust to display in the email the coupon calculated &quot;before tax&quot;  I have tried adjusting the first line in the if statement but can't get the data to display the coupon value before tax. Below are some screen shots from the back end to show the issue. The first 2 images are displaying the correct amounts for all the areas.  As can be seen in the email area the coupon value is incorrect.  I look forward to your response, as I am very happy with the software overall. :)  Regards,  Dave")* was created by *[Twincarb](/forum/user/45624-twincarb "View Twincarb's Profile")*

-- HikaShop version -- : 3.2.0
-- Joomla version -- : 3.8.0
-- PHP version -- : 7.1.9
-- Browser(s) name and version -- : All
-- Error-message(debug-mod must be tuned on) -- : Nil

I have an issue with editing the email content in relation to the value of the coupon.
The coupon value is 5%.
In the global configuration apply discounts is set to before taxes.
Detailed Tax display is selected.
Show taxed prices is set to both.
Tax is set to 20%

I have a requirement that the subtotal is shown excluding VAT, this has been easy to achieve by adjusting the various views, the last one being the email template.

I know I am using the correct template because I have been able to adjust it to show the subtotal without tax, below are the lines of code which I expected to adjust to display in the email the coupon calculated "before tax"
Code:

if(bccomp($data-&gt;cart-&gt;order_discount_price,0,5)) { if($config-&gt;get('price_with_tax')) { $t = $currencyHelper-&gt;format($data-&gt;cart-&gt;order_discount_price * -1, $data-&gt;cart-&gt;order_currency_id); }else{ $t = $currencyHelper-&gt;format(($data-&gt;cart-&gt;order_discount_price - @$data-&gt;order_discount_tax) * -1, $data-&gt;order-&gt;order_currency_id); } $cartFooters[] = array( 'NAME' =&gt; JText::_('HIKASHOP_COUPON'), 'VALUE' =&gt; $t ); }

I have tried adjusting the first line in the if statement but can't get the data to display the coupon value before tax. Below are some screen shots from the back end to show the issue.
The first 2 images are displaying the correct amounts for all the areas.
[ ![a1-1.jpg](/forum/attachment/40695) ](/forum/attachment/40695 "a1-1.jpg")

[ ![a1-3.jpg](/forum/attachment/40697) ](/forum/attachment/40697 "a1-3.jpg")

As can be seen in the email area the coupon value is incorrect.
[ ![a1-2.jpg](/forum/attachment/40696) ](/forum/attachment/40696 "a1-2.jpg")

I look forward to your response, as I am very happy with the software overall. ![:)](/media/kunena/emoticons/3.png ":)")

Regards,

Dave

- [ ![a1-1.jpg](/forum/attachment/40695) ](/forum/attachment/40695 "a1-1.jpg") [ ](/forum/attachment/40695?download=1 "a1-1.jpg")
- [ ![a1-2.jpg](/forum/attachment/40696) ](/forum/attachment/40696 "a1-2.jpg") [ ](/forum/attachment/40696?download=1 "a1-2.jpg")
- [ ![a1-3.jpg](/forum/attachment/40697) ](/forum/attachment/40697 "a1-3.jpg") [ ](/forum/attachment/40697?download=1 "a1-3.jpg")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5MjIxNS1lZGl0aW5nLXRoZS1lbWFpbC1jb3Vwb24tdmFsdWU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86583
- Thank you received: 14324
-
-

9 years 1 month ago [\#279766](#279766) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Editing the email coupon value](/forum/35-orders-management/892215-editing-the-email-coupon-value#279766 "-- HikaShop version -- : 3.2.0 -- Joomla version -- : 3.8.0 -- PHP version -- : 7.1.9 -- Browser(s) name and version -- : All -- Error-message(debug-mod must be tuned on) -- : Nil  I have an issue with editing the email content in relation to the value of the coupon. The coupon value is 5%. In the global configuration apply discounts is set to before taxes. Detailed Tax display is selected. Show taxed prices is set to both. Tax is set to 20%  I have a requirement that the subtotal is shown excluding VAT, this has been easy to achieve by adjusting the various views, the last one being the email template.  I know I am using the correct template because I have been able to adjust it to show the subtotal without tax, below are the lines of code which I expected to adjust to display in the email the coupon calculated &quot;before tax&quot;  I have tried adjusting the first line in the if statement but can't get the data to display the coupon value before tax. Below are some screen shots from the back end to show the issue. The first 2 images are displaying the correct amounts for all the areas.  As can be seen in the email area the coupon value is incorrect.  I look forward to your response, as I am very happy with the software overall. :)  Regards,  Dave")*

Hi,

It's that line you want to change :
if($config-&gt;get('price_with_tax')) {
to either:
if(true) {
or to:
if(false) {

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5MjIxNS1lZGl0aW5nLXRoZS1lbWFpbC1jb3Vwb24tdmFsdWU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Twincarb](/forum/user/45624-twincarb "View Twincarb's Profile")**
- [![Twincarb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/45624-twincarb "View Twincarb's Profile") Topic Author
- [ Offline](/forum/user/45624-twincarb)

Less More

- Posts: 41
- Thank you received: 2
-
-

9 years 1 month ago [\#279773](#279773) by [Twincarb](/forum/user/45624-twincarb "View Twincarb's Profile")  Replied by *[Twincarb](/forum/user/45624-twincarb "View Twincarb's Profile")* on topic *[Editing the email coupon value](/forum/35-orders-management/892215-editing-the-email-coupon-value#279773 "-- HikaShop version -- : 3.2.0 -- Joomla version -- : 3.8.0 -- PHP version -- : 7.1.9 -- Browser(s) name and version -- : All -- Error-message(debug-mod must be tuned on) -- : Nil  I have an issue with editing the email content in relation to the value of the coupon. The coupon value is 5%. In the global configuration apply discounts is set to before taxes. Detailed Tax display is selected. Show taxed prices is set to both. Tax is set to 20%  I have a requirement that the subtotal is shown excluding VAT, this has been easy to achieve by adjusting the various views, the last one being the email template.  I know I am using the correct template because I have been able to adjust it to show the subtotal without tax, below are the lines of code which I expected to adjust to display in the email the coupon calculated &quot;before tax&quot;  I have tried adjusting the first line in the if statement but can't get the data to display the coupon value before tax. Below are some screen shots from the back end to show the issue. The first 2 images are displaying the correct amounts for all the areas.  As can be seen in the email area the coupon value is incorrect.  I look forward to your response, as I am very happy with the software overall. :)  Regards,  Dave")*

Hi Nicolas,

Thanks for confirming my logic was correct, because I have show both with and without taxes enabled, I need to adjust the (true) line, because the result I want is what would normally be (false) I copied the false line into the true line.

The issue is the coupon value isn't changing in the email....

Dave

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5MjIxNS1lZGl0aW5nLXRoZS1lbWFpbC1jb3Vwb24tdmFsdWU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Twincarb](/forum/user/45624-twincarb "View Twincarb's Profile")**
- [![Twincarb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/45624-twincarb "View Twincarb's Profile") Topic Author
- [ Offline](/forum/user/45624-twincarb)

Less More

- Posts: 41
- Thank you received: 2
-
-

9 years 1 month ago [\#279822](#279822) by [Twincarb](/forum/user/45624-twincarb "View Twincarb's Profile")  Replied by *[Twincarb](/forum/user/45624-twincarb "View Twincarb's Profile")* on topic *[Editing the email coupon value](/forum/35-orders-management/892215-editing-the-email-coupon-value#279822 "-- HikaShop version -- : 3.2.0 -- Joomla version -- : 3.8.0 -- PHP version -- : 7.1.9 -- Browser(s) name and version -- : All -- Error-message(debug-mod must be tuned on) -- : Nil  I have an issue with editing the email content in relation to the value of the coupon. The coupon value is 5%. In the global configuration apply discounts is set to before taxes. Detailed Tax display is selected. Show taxed prices is set to both. Tax is set to 20%  I have a requirement that the subtotal is shown excluding VAT, this has been easy to achieve by adjusting the various views, the last one being the email template.  I know I am using the correct template because I have been able to adjust it to show the subtotal without tax, below are the lines of code which I expected to adjust to display in the email the coupon calculated &quot;before tax&quot;  I have tried adjusting the first line in the if statement but can't get the data to display the coupon value before tax. Below are some screen shots from the back end to show the issue. The first 2 images are displaying the correct amounts for all the areas.  As can be seen in the email area the coupon value is incorrect.  I look forward to your response, as I am very happy with the software overall. :)  Regards,  Dave")*

I have worked on this all day and have come to the conclusion that adding to line 254 "$data-&gt;order_discount_tax" isn't having an effect on the email at all. Unfortunately I am having to keep the shop offline until the correct email is being sent.

Below is what I have in the preload of the email template...
Code:

if($config-&gt;get('price_with_tax')) { $t = $currencyHelper-&gt;format($data-&gt;cart-&gt;order_discount_price - @$data-&gt;order_discount_tax) * -1, $data-&gt;cart-&gt;order_currency_id); }else{ $t = $currencyHelper-&gt;format(($data-&gt;cart-&gt;order_discount_price - @$data-&gt;order_discount_tax) * -1, $data-&gt;order-&gt;order_currency_id); } $cartFooters[] = array( 'NAME' =&gt; JText::_('HIKASHOP_COUPON'), 'VALUE' =&gt; $t );

I am hoping you're able to assist.

Regards,

Dave

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5MjIxNS1lZGl0aW5nLXRoZS1lbWFpbC1jb3Vwb24tdmFsdWU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Twincarb](/forum/user/45624-twincarb "View Twincarb's Profile")**
- [![Twincarb's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/45624-twincarb "View Twincarb's Profile") Topic Author
- [ Offline](/forum/user/45624-twincarb)

Less More

- Posts: 41
- Thank you received: 2
-
-

9 years 1 month ago [\#279825](#279825) by [Twincarb](/forum/user/45624-twincarb "View Twincarb's Profile")  Replied by *[Twincarb](/forum/user/45624-twincarb "View Twincarb's Profile")* on topic *[Editing the email coupon value](/forum/35-orders-management/892215-editing-the-email-coupon-value#279825 "-- HikaShop version -- : 3.2.0 -- Joomla version -- : 3.8.0 -- PHP version -- : 7.1.9 -- Browser(s) name and version -- : All -- Error-message(debug-mod must be tuned on) -- : Nil  I have an issue with editing the email content in relation to the value of the coupon. The coupon value is 5%. In the global configuration apply discounts is set to before taxes. Detailed Tax display is selected. Show taxed prices is set to both. Tax is set to 20%  I have a requirement that the subtotal is shown excluding VAT, this has been easy to achieve by adjusting the various views, the last one being the email template.  I know I am using the correct template because I have been able to adjust it to show the subtotal without tax, below are the lines of code which I expected to adjust to display in the email the coupon calculated &quot;before tax&quot;  I have tried adjusting the first line in the if statement but can't get the data to display the coupon value before tax. Below are some screen shots from the back end to show the issue. The first 2 images are displaying the correct amounts for all the areas.  As can be seen in the email area the coupon value is incorrect.  I look forward to your response, as I am very happy with the software overall. :)  Regards,  Dave")*

OK... I have found where the bug is in the coding!

Line 256 should read: Code:

$t = $currencyHelper-&gt;format(($data-&gt;cart-&gt;order_discount_price - @$data-&gt;order_discount_tax) * -1, $data-&gt;order-&gt;order_currency_id);

This means when I change line 254 to below I get the correct result that I am looking for in the email which is the "order discount" - "discount tax" Code:

$t = $currencyHelper-&gt;format(($data-&gt;cart-&gt;order_discount_price - @$data-&gt;cart-&gt;order_discount_tax) * -1, $data-&gt;order-&gt;order_currency_id);

Having smoked too much, and drunk too much coffee I am going to leave my computer and update to Joomla 3.8.1 which has been released ![:)](/media/kunena/emoticons/3.png ":)")

Kind Regards

Dave

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5MjIxNS1lZGl0aW5nLXRoZS1lbWFpbC1jb3Vwb24tdmFsdWU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86583
- Thank you received: 14324
-
-

9 years 1 month ago [\#279775](#279775) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Editing the email coupon value](/forum/35-orders-management/892215-editing-the-email-coupon-value#279775 "-- HikaShop version -- : 3.2.0 -- Joomla version -- : 3.8.0 -- PHP version -- : 7.1.9 -- Browser(s) name and version -- : All -- Error-message(debug-mod must be tuned on) -- : Nil  I have an issue with editing the email content in relation to the value of the coupon. The coupon value is 5%. In the global configuration apply discounts is set to before taxes. Detailed Tax display is selected. Show taxed prices is set to both. Tax is set to 20%  I have a requirement that the subtotal is shown excluding VAT, this has been easy to achieve by adjusting the various views, the last one being the email template.  I know I am using the correct template because I have been able to adjust it to show the subtotal without tax, below are the lines of code which I expected to adjust to display in the email the coupon calculated &quot;before tax&quot;  I have tried adjusting the first line in the if statement but can't get the data to display the coupon value before tax. Below are some screen shots from the back end to show the issue. The first 2 images are displaying the correct amounts for all the areas.  As can be seen in the email area the coupon value is incorrect.  I look forward to your response, as I am very happy with the software overall. :)  Regards,  Dave")*

Hi,

Ah, I see the issue. There is a typo in the else. The line should be:
$t = $currencyHelper-&gt;format(($data-&gt;cart-&gt;order_discount_price - @$data-&gt;cart-&gt;order_discount_tax) * -1, $data-&gt;cart-&gt;order_currency_id);

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5MjIxNS1lZGl0aW5nLXRoZS1lbWFpbC1jb3Vwb24tdmFsdWU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.068 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
