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

#   Add custom order information to notification email

##

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

Less More

- Posts: 45
- Thank you received: 0
-
-

11 years 2 weeks ago [\#220415](#220415) by [Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")  *[Add custom order information to notification email](/forum/27-checkout/880431-add-custom-order-information-to-notification-email#220415 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.1  Hi,  In the cart I added code to show the discount percentage that they got and their advantage. That is this code:  How can I get this information in the notification email as well? I tried different things, but they end up with errors in the email or blank pages...  Thanks in advance.")* was created by *[Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")*

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.1

Hi,

In the cart I added code to show the discount percentage that they got and their advantage. That is this code:
Code:

&lt;?php $total_amount = $this-&gt;currencyHelper-&gt;format($this-&gt;total-&gt;prices[0]-&gt;price_value_with_tax, $this-&gt;total-&gt;prices[0]-&gt;price_currency_id); $percentage = $this-&gt;row-&gt;discount-&gt;discount_percent_amount; $perc_calc = 100 - $this-&gt;row-&gt;discount-&gt;discount_percent_amount; $perc_text = 1*$this-&gt;row-&gt;discount-&gt;discount_percent_amount.'%'; $price_total = $this-&gt;total-&gt;prices[0]-&gt;price_value_with_tax; $advantage = (((100 / $perc_calc ) * $price_total * $percentage)) / 100 ; $advantage_format = number_format($advantage, 2); $value_order = ($price_total / $perc_calc) *100; $value_order_format = number_format($value_order, 2); echo "&lt;p&gt;The purchasing amount is € " . $price_total . ". With your discount " . $perc_text . " this means an advantage of &lt;b&gt;€ " . $advantage_format . "&lt;/b&gt;. (The commercial store value is: € " . $value_order_format . ").&lt;/p&gt;&lt;br /&gt;"; ?&gt;

How can I get this information in the notification email as well? I tried different things, but they end up with errors in the email or blank pages...

Thanks in advance.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg4MDQzMS1hZGQtY3VzdG9tLW9yZGVyLWluZm9ybWF0aW9uLXRvLW5vdGlmaWNhdGlvbi1lbWFpbD90bXBsPW1hcmtkb3du) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

11 years 2 weeks ago [\#220422](#220422) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Add custom order information to notification email](/forum/27-checkout/880431-add-custom-order-information-to-notification-email#220422 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.1  Hi,  In the cart I added code to show the discount percentage that they got and their advantage. That is this code:  How can I get this information in the notification email as well? I tried different things, but they end up with errors in the email or blank pages...  Thanks in advance.")*

Hi,

In the order notifications, the information on the discount is not available.
So you can have such code unless you add some more custom code before that to load the discount and precalculate it and the prices of the product.
So you'll want to call the getPrices function of class.currency and give it the necessary parameters so that it can load the prices of the product and then you'll be able to use that code.

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

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

Less More

- Posts: 45
- Thank you received: 0
-
-

11 years 2 weeks ago [\#220454](#220454) by [Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")  Replied by *[Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")* on topic *[Add custom order information to notification email](/forum/27-checkout/880431-add-custom-order-information-to-notification-email#220454 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.1  Hi,  In the cart I added code to show the discount percentage that they got and their advantage. That is this code:  How can I get this information in the notification email as well? I tried different things, but they end up with errors in the email or blank pages...  Thanks in advance.")*

Just an idea: would it be a solution to save the echo as a variable and put it in a session?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg4MDQzMS1hZGQtY3VzdG9tLW9yZGVyLWluZm9ybWF0aW9uLXRvLW5vdGlmaWNhdGlvbi1lbWFpbD90bXBsPW1hcmtkb3du) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

11 years 2 weeks ago [\#220466](#220466) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Add custom order information to notification email](/forum/27-checkout/880431-add-custom-order-information-to-notification-email#220466 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.1  Hi,  In the cart I added code to show the discount percentage that they got and their advantage. That is this code:  How can I get this information in the notification email as well? I tried different things, but they end up with errors in the email or blank pages...  Thanks in advance.")*

Hi,

It depends.
It will work for the order creation notification and the order admin notification, but it won't work for the order status notification in most cases as this email is usually sent with the payment gateway notifies your HikaShop that the payment has been made and thus, at that point, you're in the user session of the payment gateway, not the user session of the customer.

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

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

Less More

- Posts: 45
- Thank you received: 0
-
-

11 years 2 weeks ago [\#220600](#220600) by [Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")  Replied by *[Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")* on topic *[Add custom order information to notification email](/forum/27-checkout/880431-add-custom-order-information-to-notification-email#220600 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.1  Hi,  In the cart I added code to show the discount percentage that they got and their advantage. That is this code:  How can I get this information in the notification email as well? I tried different things, but they end up with errors in the email or blank pages...  Thanks in advance.")*

Hi,

Well, I only need it in the order creation email, so that can be a good solution.

I've added the variable to the session and can use it on other pages. But how can I set it in the email? I guess I need to add it to the preload version and HTML version? But how? ![:unsure:](/media/kunena/emoticons/18.png ":unsure:")

Thanks again.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg4MDQzMS1hZGQtY3VzdG9tLW9yZGVyLWluZm9ybWF0aW9uLXRvLW5vdGlmaWNhdGlvbi1lbWFpbD90bXBsPW1hcmtkb3du) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

11 years 1 week ago [\#220635](#220635) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Add custom order information to notification email](/forum/27-checkout/880431-add-custom-order-information-to-notification-email#220635 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.1  Hi,  In the cart I added code to show the discount percentage that they got and their advantage. That is this code:  How can I get this information in the notification email as well? I tried different things, but they end up with errors in the email or blank pages...  Thanks in advance.")*

Hi,

You can add it directly in the HTML version.
For example: Code:

&lt;?php echo $_SESSION['my_variable'];

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

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

Less More

- Posts: 45
- Thank you received: 0
-
-

11 years 1 week ago [\#220796](#220796) by [Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")  Replied by *[Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")* on topic *[Add custom order information to notification email](/forum/27-checkout/880431-add-custom-order-information-to-notification-email#220796 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.1  Hi,  In the cart I added code to show the discount percentage that they got and their advantage. That is this code:  How can I get this information in the notification email as well? I tried different things, but they end up with errors in the email or blank pages...  Thanks in advance.")*

Thanks, but didn't work. What i did was the following:

1. I set the variable in the cart - showcart view.
2. In the checkout-cart view I load it and it does show the value I want.
3. I used several codes to try to get it in the email, but it remains empty or throwes a 500-error.

This code works in the checkout, but throws a 500-error in the email: Code:

&lt;?php // Grab session ## $session = JFactory::getSession(); $value_format = $session-&gt;get('value_format'); echo $value_format; ?&gt;

I also tried the following codes, but they remained without result/data (but no error): Code:

&lt;?php // echo $_SESSION['value_format']; ?&gt; and &lt;?php // print "{$_SESSION['value_format']}"; ?&gt;

Thanks, hope you can help me with this.

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

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

Less More

- Posts: 45
- Thank you received: 0
-
-

11 years 1 week ago -  11 years 1 week ago [\#221016](#221016) by [Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")  Replied by *[Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")* on topic *[Add custom order information to notification email](/forum/27-checkout/880431-add-custom-order-information-to-notification-email#221016 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.1  Hi,  In the cart I added code to show the discount percentage that they got and their advantage. That is this code:  How can I get this information in the notification email as well? I tried different things, but they end up with errors in the email or blank pages...  Thanks in advance.")*

Well, I managed to get this to work. The code needed to be altered a little.

Maybe it can help someone else in the future, so this is what I did:

In cart - showcart.php I added the following code to get the variables in the session: Code:

&lt;?php $session = JFactory::getSession(); $registry = $session-&gt;get('registry'); $session-&gt;set('value_format', $value_format); $registry-&gt;set('value_format', $value_format); ?&gt;

In the email HTML-version I added the following code: Code:

&lt;?php // Grab session ## $session = JFactory::getSession(); $value_format = $session-&gt;get('value_format'); echo $value_format; ?&gt;

One tip if you want to know what Joomla stored in the session (this helped me a lot): Code:

&lt;?php $registry = $session-&gt;get('registry'); echo $registry; ?&gt;

Maybe it could be better or cleaner, but it works!

So, maybe someone can [ help me with my other question](http://www.hikashop.com/forum/development/880364-send-confirmation-mail-to-linked-other-adresses.html)??? ![;)](/media/kunena/emoticons/24.png ";)")

Last edit: 11 years 1 week ago by [Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile").

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

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

11 years 1 week ago [\#220953](#220953) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Add custom order information to notification email](/forum/27-checkout/880431-add-custom-order-information-to-notification-email#220953 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.1  Hi,  In the cart I added code to show the discount percentage that they got and their advantage. That is this code:  How can I get this information in the notification email as well? I tried different things, but they end up with errors in the email or blank pages...  Thanks in advance.")*

Hi,

Just to be sure, when using the echo or print, the lines were not commented ?
Where in the email do you have placed this code ? In the preload part ?

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

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

Less More

- Posts: 45
- Thank you received: 0
-
-

11 years 1 week ago [\#221070](#221070) by [Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")  Replied by *[Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")* on topic *[Add custom order information to notification email](/forum/27-checkout/880431-add-custom-order-information-to-notification-email#221070 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.1  Hi,  In the cart I added code to show the discount percentage that they got and their advantage. That is this code:  How can I get this information in the notification email as well? I tried different things, but they end up with errors in the email or blank pages...  Thanks in advance.")*

Hi,

You mean that last code? I placed in the HTML-version. The lines were readable, allthough a bit messy. But was just to give me some more info.

I also used that code on the checkout-cart view.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg4MDQzMS1hZGQtY3VzdG9tLW9yZGVyLWluZm9ybWF0aW9uLXRvLW5vdGlmaWNhdGlvbi1lbWFpbD90bXBsPW1hcmtkb3du) 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.131 seconds

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