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

#   Add custom field to email title

##

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

Less More

- Posts: 75
- Thank you received: 7
-
-

11 years 1 month ago [\#216815](#216815) by [wildweststudios](/forum/user/31720-wildweststudios "View wildweststudios's Profile")  *[Add custom field to email title](/forum/35-orders-management/879766-add-custom-field-to-email-title#216815 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.44 -- PHP version -- : 5.4.41 -- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)  Hi, I would to add the &quot;Company&quot; custom field (address&#95;company) to the title of the admin notification email when an order is placed.  Previously, I was trying to add a Community Builder field but that is too complex at this point.  For the address&#95;company field, I attempted to add the variable to the &quot;order.php&quot; file like so:  but this actually does nothing. I tried adding more variable calls &quot;%s&quot; to my NEW&#95;ORDER&#95;SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.  I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.")* was created by *[wildweststudios](/forum/user/31720-wildweststudios "View wildweststudios's Profile")*

-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.44
-- PHP version -- : 5.4.41
-- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)

Hi, I would to add the "Company" custom field (address_company) to the title of the admin notification email when an order is placed.

Previously, I was trying to add a Community Builder field but that is too complex at this point.

For the address_company field, I attempted to add the variable to the "order.php" file like so:
Code:

$order-&gt;mail-&gt;subject = JText::sprintf('NEW_ORDER_SUBJECT',$address_company,$order-&gt;order_number,HIKASHOP_LIVE);

but this actually does nothing. I tried adding more variable calls "%s" to my NEW_ORDER_SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.

I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg3OTc2Ni1hZGQtY3VzdG9tLWZpZWxkLXRvLWVtYWlsLXRpdGxlP3RtcGw9bWFya2Rvd24=) 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: 86541
- Thank you received: 14304
-
-

11 years 1 month ago [\#216835](#216835) 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 field to email title](/forum/35-orders-management/879766-add-custom-field-to-email-title#216835 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.44 -- PHP version -- : 5.4.41 -- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)  Hi, I would to add the &quot;Company&quot; custom field (address&#95;company) to the title of the admin notification email when an order is placed.  Previously, I was trying to add a Community Builder field but that is too complex at this point.  For the address&#95;company field, I attempted to add the variable to the &quot;order.php&quot; file like so:  but this actually does nothing. I tried adding more variable calls &quot;%s&quot; to my NEW&#95;ORDER&#95;SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.  I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.")*

Hi,

That's the correct way of doing it for the subject.
If that doesn't work, the problem is how you initialize that $address_company variable.
How do you load it ? Are you sure that it is filled with something ?
Normally, it should be available in $order-&gt;cart-&gt;billing_address-&gt;address_company

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

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

Less More

- Posts: 75
- Thank you received: 7
-
-

11 years 1 month ago [\#216858](#216858) by [wildweststudios](/forum/user/31720-wildweststudios "View wildweststudios's Profile")  Replied by *[wildweststudios](/forum/user/31720-wildweststudios "View wildweststudios's Profile")* on topic *[Add custom field to email title](/forum/35-orders-management/879766-add-custom-field-to-email-title#216858 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.44 -- PHP version -- : 5.4.41 -- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)  Hi, I would to add the &quot;Company&quot; custom field (address&#95;company) to the title of the admin notification email when an order is placed.  Previously, I was trying to add a Community Builder field but that is too complex at this point.  For the address&#95;company field, I attempted to add the variable to the &quot;order.php&quot; file like so:  but this actually does nothing. I tried adding more variable calls &quot;%s&quot; to my NEW&#95;ORDER&#95;SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.  I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.")*

Hi Nicolas,

I did load it in the line above, although with the wrong path. I have now included the correct path so that it reads like so:
Code:

$order-&gt;mail-&gt;subject = trim($order-&gt;mail-&gt;subject); if(empty($order-&gt;mail-&gt;subject)) { $address_company = $order-&gt;cart-&gt;billing_address-&gt;address_company; $order-&gt;mail-&gt;subject = JText::sprintf('NEW_ORDER_SUBJECT',$address_company,$order-&gt;order_number,HIKASHOP_LIVE);

but it still will not appear. The field is definitely filled in inside the User account, as well. I've tried adding extra variable placeholders to the language string with no results, except when you add too many it sends an email with "(No subject)".

Hopefully you can see what's going wrong here...

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

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26400
- Thank you received: 4079
-
- [](http://obsi.dev)
-

11 years 1 month ago [\#216992](#216992) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Add custom field to email title](/forum/35-orders-management/879766-add-custom-field-to-email-title#216992 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.44 -- PHP version -- : 5.4.41 -- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)  Hi, I would to add the &quot;Company&quot; custom field (address&#95;company) to the title of the admin notification email when an order is placed.  Previously, I was trying to add a Community Builder field but that is too complex at this point.  For the address&#95;company field, I attempted to add the variable to the &quot;order.php&quot; file like so:  but this actually does nothing. I tried adding more variable calls &quot;%s&quot; to my NEW&#95;ORDER&#95;SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.  I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.")*

Hi,

And what appear in your email subject ?
The access for the custom field data is right ; but you have to be sure that the "$order-&gt;cart" is right there.
That variable is loaded in the email "preload" ; that's mostly why you should create an email override and not modify the HikaShop core files directly ; except if you want to have issues with future updates and loose your modifications.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

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

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

Less More

- Posts: 75
- Thank you received: 7
-
-

11 years 1 month ago [\#217167](#217167) by [wildweststudios](/forum/user/31720-wildweststudios "View wildweststudios's Profile")  Replied by *[wildweststudios](/forum/user/31720-wildweststudios "View wildweststudios's Profile")* on topic *[Add custom field to email title](/forum/35-orders-management/879766-add-custom-field-to-email-title#217167 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.44 -- PHP version -- : 5.4.41 -- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)  Hi, I would to add the &quot;Company&quot; custom field (address&#95;company) to the title of the admin notification email when an order is placed.  Previously, I was trying to add a Community Builder field but that is too complex at this point.  For the address&#95;company field, I attempted to add the variable to the &quot;order.php&quot; file like so:  but this actually does nothing. I tried adding more variable calls &quot;%s&quot; to my NEW&#95;ORDER&#95;SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.  I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.")*

Hi Jerome,

thanks for the response. since I have the following in my order file:
Code:

$order-&gt;mail-&gt;subject = JText::sprintf('NEW_ORDER_SUBJECT',$address_company,$order-&gt;order_number,HIKASHOP_LIVE);

My email subject line reads like so:

**New order No. ZZ-00931 created on Mywebsite.com**

I looked in the preload for my "Order administrator notification" and I don't see the "New Order Subject" line in there at all for me to modify for an override. Am I supposed to add it myself?

Can someone just walk me through what exactly I should do to get this to happen? I'm kind of playing whack-a-mole here and obviously I'm missing something substantial in my understanding. thank you.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg3OTc2Ni1hZGQtY3VzdG9tLWZpZWxkLXRvLWVtYWlsLXRpdGxlP3RtcGw9bWFya2Rvd24=) 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: 86541
- Thank you received: 14304
-
-

11 years 3 weeks ago [\#217994](#217994) 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 field to email title](/forum/35-orders-management/879766-add-custom-field-to-email-title#217994 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.44 -- PHP version -- : 5.4.41 -- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)  Hi, I would to add the &quot;Company&quot; custom field (address&#95;company) to the title of the admin notification email when an order is placed.  Previously, I was trying to add a Community Builder field but that is too complex at this point.  For the address&#95;company field, I attempted to add the variable to the &quot;order.php&quot; file like so:  but this actually does nothing. I tried adding more variable calls &quot;%s&quot; to my NEW&#95;ORDER&#95;SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.  I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.")*

hi,

Ok, in the administrator/components/com_hikashop/classes/order.php file, instead of: Code:

$order-&gt;mail-&gt;subject = trim($order-&gt;mail-&gt;subject); if(empty($order-&gt;mail-&gt;subject)) { $order-&gt;mail-&gt;subject = JText::sprintf('NEW_ORDER_SUBJECT',$order-&gt;order_number,HIKASHOP_LIVE); }

try to put just: Code:

$address_company = $order-&gt;cart-&gt;billing_address-&gt;address_company; $order-&gt;mail-&gt;subject = JText::sprintf('NEW_ORDER_SUBJECT',$address_company,$order-&gt;order_number,HIKASHOP_LIVE);

That should hopefully do it.

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

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

Less More

- Posts: 75
- Thank you received: 7
-
-

11 years 3 weeks ago [\#218100](#218100) by [wildweststudios](/forum/user/31720-wildweststudios "View wildweststudios's Profile")  Replied by *[wildweststudios](/forum/user/31720-wildweststudios "View wildweststudios's Profile")* on topic *[Add custom field to email title](/forum/35-orders-management/879766-add-custom-field-to-email-title#218100 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.44 -- PHP version -- : 5.4.41 -- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)  Hi, I would to add the &quot;Company&quot; custom field (address&#95;company) to the title of the admin notification email when an order is placed.  Previously, I was trying to add a Community Builder field but that is too complex at this point.  For the address&#95;company field, I attempted to add the variable to the &quot;order.php&quot; file like so:  but this actually does nothing. I tried adding more variable calls &quot;%s&quot; to my NEW&#95;ORDER&#95;SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.  I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.")*

Hi Nicolas,

thanks for responding. I did try this and unfortunately it also didn't work.

So just to be clear on what I did - this is what I have now in Order.php
Code:

$order-&gt;mail-&gt;subject = trim($order-&gt;mail-&gt;subject); if(empty($order-&gt;mail-&gt;subject)) { $address_company = $order-&gt;cart-&gt;billing_address-&gt;address_company; $order-&gt;mail-&gt;subject = JText::sprintf('NEW_ORDER_SUBJECT',$address_company,$order-&gt;order_number,HIKASHOP_LIVE); }

Is it possible the problem is somewhere else? I've attached screenshots of what I have in my "address_company" custom field, then that field filled in the User Address Information screen, and then my "NEW_ORDER_SUBJECT" language override. Hopefully this sheds some light on the issue. Thanks!

[ ![01&#95;custom-field.jpg](/forum/attachment/27206) ](/forum/attachment/27206 "...stom-field.jpg")

[ ![02&#95;user&#95;address.jpg](/forum/attachment/27207) ](/forum/attachment/27207 "...er&#95;address.jpg")

[ ![03&#95;language-override.jpg](/forum/attachment/27208) ](/forum/attachment/27208 "...e-override.jpg")

- [ ![01&#95;custom-field.jpg](/forum/attachment/27206) ](/forum/attachment/27206 "...stom-field.jpg") [ ](/forum/attachment/27206?download=1 "...stom-field.jpg")
- [ ![02&#95;user&#95;address.jpg](/forum/attachment/27207) ](/forum/attachment/27207 "...er&#95;address.jpg") [ ](/forum/attachment/27207?download=1 "...er&#95;address.jpg")
- [ ![03&#95;language-override.jpg](/forum/attachment/27208) ](/forum/attachment/27208 "...e-override.jpg") [ ](/forum/attachment/27208?download=1 "...e-override.jpg")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg3OTc2Ni1hZGQtY3VzdG9tLWZpZWxkLXRvLWVtYWlsLXRpdGxlP3RtcGw9bWFya2Rvd24=) 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: 86541
- Thank you received: 14304
-
-

11 years 3 weeks ago [\#218144](#218144) 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 field to email title](/forum/35-orders-management/879766-add-custom-field-to-email-title#218144 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.44 -- PHP version -- : 5.4.41 -- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)  Hi, I would to add the &quot;Company&quot; custom field (address&#95;company) to the title of the admin notification email when an order is placed.  Previously, I was trying to add a Community Builder field but that is too complex at this point.  For the address&#95;company field, I attempted to add the variable to the &quot;order.php&quot; file like so:  but this actually does nothing. I tried adding more variable calls &quot;%s&quot; to my NEW&#95;ORDER&#95;SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.  I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.")*

Hi,

That's not what I said to do in my last message. I said the replace the whole block with the 2 lines. Try like that.

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

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

Less More

- Posts: 75
- Thank you received: 7
-
-

11 years 2 weeks ago [\#218647](#218647) by [wildweststudios](/forum/user/31720-wildweststudios "View wildweststudios's Profile")  Replied by *[wildweststudios](/forum/user/31720-wildweststudios "View wildweststudios's Profile")* on topic *[Add custom field to email title](/forum/35-orders-management/879766-add-custom-field-to-email-title#218647 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.44 -- PHP version -- : 5.4.41 -- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)  Hi, I would to add the &quot;Company&quot; custom field (address&#95;company) to the title of the admin notification email when an order is placed.  Previously, I was trying to add a Community Builder field but that is too complex at this point.  For the address&#95;company field, I attempted to add the variable to the &quot;order.php&quot; file like so:  but this actually does nothing. I tried adding more variable calls &quot;%s&quot; to my NEW&#95;ORDER&#95;SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.  I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.")*

I did it that way and it worked. Thank you.

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

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

Less More

- Posts: 196
- Thank you received: 6
-
-
-
- [](http://www.paschencommunications.com)
-

10 years 7 months ago [\#234640](#234640) by [cpaschen](/forum/user/12420-cpaschen "View cpaschen's Profile")  Replied by *[cpaschen](/forum/user/12420-cpaschen "View cpaschen's Profile")* on topic *[Add custom field to email title](/forum/35-orders-management/879766-add-custom-field-to-email-title#234640 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.44 -- PHP version -- : 5.4.41 -- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)  Hi, I would to add the &quot;Company&quot; custom field (address&#95;company) to the title of the admin notification email when an order is placed.  Previously, I was trying to add a Community Builder field but that is too complex at this point.  For the address&#95;company field, I attempted to add the variable to the &quot;order.php&quot; file like so:  but this actually does nothing. I tried adding more variable calls &quot;%s&quot; to my NEW&#95;ORDER&#95;SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.  I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.")*

Is there any way to make this change via an override - or other means so that each time HS is upgraded we don't have to manually re-apply this change?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg3OTc2Ni1hZGQtY3VzdG9tLWZpZWxkLXRvLWVtYWlsLXRpdGxlP3RtcGw9bWFya2Rvd24=) 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: 86541
- Thank you received: 14304
-
-

10 years 7 months ago [\#234687](#234687) 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 field to email title](/forum/35-orders-management/879766-add-custom-field-to-email-title#234687 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.44 -- PHP version -- : 5.4.41 -- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)  Hi, I would to add the &quot;Company&quot; custom field (address&#95;company) to the title of the admin notification email when an order is placed.  Previously, I was trying to add a Community Builder field but that is too complex at this point.  For the address&#95;company field, I attempted to add the variable to the &quot;order.php&quot; file like so:  but this actually does nothing. I tried adding more variable calls &quot;%s&quot; to my NEW&#95;ORDER&#95;SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.  I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.")*

Hi,

Normally, it should be possible to override the $mail-&gt;subject in the email override without having to edit directly order.php
And in that case, it shouldn't be a problem for updates.

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

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

Less More

- Posts: 196
- Thank you received: 6
-
-
-
- [](http://www.paschencommunications.com)
-

10 years 7 months ago [\#235051](#235051) by [cpaschen](/forum/user/12420-cpaschen "View cpaschen's Profile")  Replied by *[cpaschen](/forum/user/12420-cpaschen "View cpaschen's Profile")* on topic *[Add custom field to email title](/forum/35-orders-management/879766-add-custom-field-to-email-title#235051 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.44 -- PHP version -- : 5.4.41 -- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)  Hi, I would to add the &quot;Company&quot; custom field (address&#95;company) to the title of the admin notification email when an order is placed.  Previously, I was trying to add a Community Builder field but that is too complex at this point.  For the address&#95;company field, I attempted to add the variable to the &quot;order.php&quot; file like so:  but this actually does nothing. I tried adding more variable calls &quot;%s&quot; to my NEW&#95;ORDER&#95;SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.  I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.")*

Sorry, I'm not finding exactly where to do that override.

I've tried using the Hkashop view and the only "email" view that I'm finding are on the "back end":

- form
- form\_param
- listing

But none of them have any code anything similar to this.

Am I just looking in the wrong place?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg3OTc2Ni1hZGQtY3VzdG9tLWZpZWxkLXRvLWVtYWlsLXRpdGxlP3RtcGw9bWFya2Rvd24=) 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: 86541
- Thank you received: 14304
-
-

10 years 7 months ago [\#235113](#235113) 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 field to email title](/forum/35-orders-management/879766-add-custom-field-to-email-title#235113 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.44 -- PHP version -- : 5.4.41 -- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)  Hi, I would to add the &quot;Company&quot; custom field (address&#95;company) to the title of the admin notification email when an order is placed.  Previously, I was trying to add a Community Builder field but that is too complex at this point.  For the address&#95;company field, I attempted to add the variable to the &quot;order.php&quot; file like so:  but this actually does nothing. I tried adding more variable calls &quot;%s&quot; to my NEW&#95;ORDER&#95;SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.  I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.")*

Hi,

You need to do that in the code of the email itself when you edit it via the menu System&gt;Emails of your backend.
There, you won't find any code about $mail, you need to add it like that for example:
&lt;?php $mail-&gt;subject = "my new subject"; ?&gt;

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

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

Less More

- Posts: 75
- Thank you received: 7
-
-

10 years 7 months ago [\#236426](#236426) by [wildweststudios](/forum/user/31720-wildweststudios "View wildweststudios's Profile")  Replied by *[wildweststudios](/forum/user/31720-wildweststudios "View wildweststudios's Profile")* on topic *[Add custom field to email title](/forum/35-orders-management/879766-add-custom-field-to-email-title#236426 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.44 -- PHP version -- : 5.4.41 -- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)  Hi, I would to add the &quot;Company&quot; custom field (address&#95;company) to the title of the admin notification email when an order is placed.  Previously, I was trying to add a Community Builder field but that is too complex at this point.  For the address&#95;company field, I attempted to add the variable to the &quot;order.php&quot; file like so:  but this actually does nothing. I tried adding more variable calls &quot;%s&quot; to my NEW&#95;ORDER&#95;SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.  I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.")*

Hi Nicolas,

to pick up from what *cpaschen* is saying, I'd also like to try to move this into the email override instead of the order.php file.

so to do this, I would open up my 'Order administrator notification' email to add code, and would I add this to the "Preload" section?
Code:

$address_company = $order-&gt;cart-&gt;billing_address-&gt;address_company; $order-&gt;mail-&gt;subject = JText::sprintf('NEW_ORDER_SUBJECT',$address_company,$order-&gt;order_number,' - ',HIKASHOP_LIVE);

I looked through the code in that section, but couldn't tell if there's one place that's better than another to add the code. Is there a specific line that it should be placed?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg3OTc2Ni1hZGQtY3VzdG9tLWZpZWxkLXRvLWVtYWlsLXRpdGxlP3RtcGw9bWFya2Rvd24=) 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: 86541
- Thank you received: 14304
-
-

10 years 7 months ago [\#236498](#236498) 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 field to email title](/forum/35-orders-management/879766-add-custom-field-to-email-title#236498 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.44 -- PHP version -- : 5.4.41 -- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)  Hi, I would to add the &quot;Company&quot; custom field (address&#95;company) to the title of the admin notification email when an order is placed.  Previously, I was trying to add a Community Builder field but that is too complex at this point.  For the address&#95;company field, I attempted to add the variable to the &quot;order.php&quot; file like so:  but this actually does nothing. I tried adding more variable calls &quot;%s&quot; to my NEW&#95;ORDER&#95;SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.  I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.")*

Hi,

That code like that won't work.
You need to change $order to $data everywhere in that code.
And you can add it in the preload of the email, anywhere you want after $data-&gt;cart is loaded.
At the end of the preload for example.

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

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

Less More

- Posts: 75
- Thank you received: 7
-
-

10 years 7 months ago [\#236560](#236560) by [wildweststudios](/forum/user/31720-wildweststudios "View wildweststudios's Profile")  Replied by *[wildweststudios](/forum/user/31720-wildweststudios "View wildweststudios's Profile")* on topic *[Add custom field to email title](/forum/35-orders-management/879766-add-custom-field-to-email-title#236560 "-- HikaShop version -- : 2.5.0 -- Joomla version -- : 3.44 -- PHP version -- : 5.4.41 -- Browser(s) name and version -- : Chrome 45.0.2454.101 (64-bit)  Hi, I would to add the &quot;Company&quot; custom field (address&#95;company) to the title of the admin notification email when an order is placed.  Previously, I was trying to add a Community Builder field but that is too complex at this point.  For the address&#95;company field, I attempted to add the variable to the &quot;order.php&quot; file like so:  but this actually does nothing. I tried adding more variable calls &quot;%s&quot; to my NEW&#95;ORDER&#95;SUBJECT language override, but I think my basic syntax/understanding of how to do this may be off.  I've been searching on this for a while now, but it seems most people want to add these variable within the body of the email, not the subject. Thanks for any help.")*

Thanks Nicolas,

I tried doing this. First, I reverted my "order.php" file to the default code that installs with HikaShop Business 2.6.2.

Then, in the Preload section of my "Order administrator notification" I placed this code at the very bottom:
Code:

$address_company = $data-&gt;cart-&gt;billing_address-&gt;address_company; $shipto_method = $data-&gt;cart-&gt;billing_address-&gt;shipto_method; $data-&gt;mail-&gt;subject = JText::sprintf('NEW_ORDER_SUBJECT',$address_company,$data-&gt;order_number,' - ',$shipto_method,HIKASHOP_LIVE);

But when I placed an order, I get the email but the subject line is completely blank. Can you tell me where I went wrong?

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

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