Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2008
    Location
    Massachusetts
    Posts
    163
    Plugin Contributions
    0

    Default 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:
    Code:
    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:
    Code:
    <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.

  2. #2
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default 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...

  3. #3
    Join Date
    Nov 2008
    Location
    Massachusetts
    Posts
    163
    Plugin Contributions
    0

    Default Re: Where would I put a custom defintions file?

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

  4. #4
    Join Date
    Jan 2008
    Posts
    1,700
    Plugin Contributions
    6

    Default Re: Where would I put a custom defintions file?

    Try this:
    PHP Code:
    <div><? echo $MM_EMAIL_TEXT_STATUS_UPDATED ?></div>

  5. #5
    Join Date
    Nov 2008
    Location
    Massachusetts
    Posts
    163
    Plugin Contributions
    0

    Default 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:
    Code:
    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:
    Code:
     
    <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".


  6. #6
    Join Date
    Nov 2008
    Location
    Massachusetts
    Posts
    163
    Plugin Contributions
    0

    Default 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.

  7. #7
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default 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:
    Code:
    $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.
    Neville
    An assumption is what you arrive at when you get tired of thinking...

  8. #8
    Join Date
    Nov 2008
    Location
    Massachusetts
    Posts
    163
    Plugin Contributions
    0

    Default 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!

 

 

Similar Threads

  1. Where do I put custom configuration options?
    By staropram in forum Contribution-Writing Guidelines
    Replies: 0
    Last Post: 19 Jul 2010, 07:49 PM
  2. Where to put file?
    By Twinge in forum Contribution-Writing Guidelines
    Replies: 0
    Last Post: 17 Apr 2009, 09:03 AM
  3. Where to put Linkpoint PEM file?
    By ex.wear in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 19 Sep 2008, 06:59 AM
  4. Where to put new file
    By dwijadas in forum Contribution-Writing Guidelines
    Replies: 6
    Last Post: 6 Jan 2008, 03:11 AM
  5. Replies: 3
    Last Post: 15 Jul 2007, 05:38 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR