Forums / Templates, Stylesheets, Page Layout / Where would I put a custom defintions file?

Where would I put a custom defintions file?

Locked

Started by alicia1234 on 27 Jan 2009, 11:12 PM · Views: 1,164

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
27 Jan 2009, 11:12 PM
#1
alicia1234 avatar

alicia1234

Zen Follower

Join Date:
Nov 2008
Location:
Massachusetts
Posts:
164
Plugin Contributions:
0

Where would I put a custom defintions file?

I guess I am looking for the equivalent of includes/extra_datafiles where I can put some constant definitions and be assured that they would automatically load for every page.

Here's what I tried to do:

I created "my_definitions.php" and put it in includes/extra_datafiles.

I modelled it after the "media_manager.php" file that was already there. My file contains one define statement:

define('MM_EMAIL_TEXT_STATUS_UPDATED', ' <br />Hey! Just wanted to let you know that we\'re working to get your order out as quickly as we possibly can. We\'ve just updated your order status!');

Then, in email/email_template_order_status.html, I added:

<div>$MM_EMAIL_TEXT_STATUS_UPDATED</div>

However, the email displays this:
$MM_EMAIL_TEXT_STATUS_UPDATED
instead of what I defined it to be.

I am trying to do this because what I really want to change is "EMAIL_TEXT_STATUS_UPDATED" but that definition is found in

admin/includes/languages/english/orders.php

and to the best of my knowledge, that is a "core" file that cannot be overridden.

27 Jan 2009, 11:17 PM
#2
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: Where would I put a custom defintions file?

You stated that you put your custom file in includes/extra_datafiles/ - but you're talking about actions that occur from admin...try loading your custom file to admin/includes/extra_datafiles/

Neville
An assumption is what you arrive at when you get tired of thinking...

27 Jan 2009, 11:28 PM
#3
alicia1234 avatar

alicia1234

Zen Follower

Join Date:
Nov 2008
Location:
Massachusetts
Posts:
164
Plugin Contributions:
0

Re: Where would I put a custom defintions file?

Thanks. Ok, I put it in admin/includes/extra_datafiles ...
same problem.

28 Jan 2009, 12:02 AM
#5
alicia1234 avatar

alicia1234

Zen Follower

Join Date:
Nov 2008
Location:
Massachusetts
Posts:
164
Plugin Contributions:
0

Re: Where would I put a custom defintions file?

"email_template_order_status.html" is an HTML page ... can't put php code into it. Besides, everything else in it is defined the same way as I've done it.

On a hunch, I decided to just go ahead and edit the core file:
admin/includes/languages/english/orders.php

I put my definition in there.
Still got the same result!

Then, still working in the core file, I changed the definition of "EMAIL_TEXT_STATUS_UPDATED' to be what I wanted. THAT works!

So now I am totally baffled as to why adding my own definition to the core file would not work, but changing the existing one would.

Here's what I now have in the core file:

define('EMAIL_TEXT_STATUS_UPDATED', '<br />Hey THERE! Just wanted to let you know that we\'re working to get your order out as quickly as we possibly can. We\'ve just updated your order status!' . "\n");
define('MM_EMAIL_TEXT_STATUS_UPDATED', ' <br />Hey! Just wanted to let you know that we\'re working to get your order out as quickly as we possibly can. We\'ve just updated your order status!');

And here's whats in email_template_order_status.html:

 
<div>$EMAIL_TEXT_STATUS_UPDATED</div> 
<div>$MM_EMAIL_TEXT_STATUS_UPDATED</div>

The first div displays exactly what I want:
"Hey! Just wanted to let you know that we're working to get your order out as quickly as we possibly can. We've just updated your order status!"

The second one displays:
"$MM_EMAIL_TEXT_STATUS_UPDATED".

:frusty:

28 Jan 2009, 12:28 AM
#6
alicia1234 avatar

alicia1234

Zen Follower

Join Date:
Nov 2008
Location:
Massachusetts
Posts:
164
Plugin Contributions:
0

Re: Where would I put a custom defintions file?

I've concluded that there must be a lot more going on to produce this email than I care to investigate at this time.

I am going to go with editing the core file. Can't waste anymore time on this.

28 Jan 2009, 12:30 AM
#7
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: Where would I put a custom defintions file?

I did some code searching for you...the reason your email isn't being updated as you want is that the email content is being generated by admin/orders.php at line 117:
```
$html_msg['EMAIL_TEXT_STATUS_UPDATED'] = str_replace('\n','', EMAIL_TEXT_STATUS_UPDATED);

Your definition for MM_EMAIL_TEXT_STATUS_UPDATED isn't being used because there is no corresponding element within the variable $html_msg *which is what gets parsed by the email template.
So the bottom line is that you either:
a: modify the core language file (english.php) as you have already done, or 
b: modify the core file orders.php to include your custom element within the $html_msg variable AND add the language definition in either a custom file as you initially tried to do or in a modified core language file.

Either way, you end up having to modify a core file to achieve what you want. :no:

Neville
An assumption is what you arrive at when you get tired of thinking...

28 Jan 2009, 12:35 AM
#8
alicia1234 avatar

alicia1234

Zen Follower

Join Date:
Nov 2008
Location:
Massachusetts
Posts:
164
Plugin Contributions:
0

Re: Where would I put a custom defintions file?

Yup! That's the same conclusion I came to. Modify a core file. :(
But thanks for the reinforcement!