Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1
    Join Date
    Jun 2005
    Location
    Austin, Texas, US
    Posts
    216
    Plugin Contributions
    0

    Default Customer Specified Subject Line for Contact Form

    Currently the Contact Us form is referring to a pre-set default text for the subject line of the emails that come in. This is not helpful for my client, since he gets a ton of these emails and wants a good way to prioritize his customer's inquiries.

    Is it possible to add an additional field for subject line in the contact page template and then edit contact_us.php to call the variable for that new field rather than using the static text like "message from store name"?

    It seems like it would be, but as I am a somewhat novice programmer (I've been using Zencart for a while now, but I still am no php expert)....I am wondering just how complex it might get.

    I have done lots of searching in the forum and saw the posts about adding some additional input fields for just collecting more info....but this seems slightly different.

    Is trying to mess with this particular field (email_subject) not a good idea?

    Please advise! Thank you!

  2. #2
    Join Date
    Jan 2004
    Posts
    66,391
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: Customer Specified Subject Line for Contact Form

    Certainly do-able. I've got a similar task on a project list for a client. It's not at the top of the list, but will be done at some point...
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jun 2005
    Location
    Austin, Texas, US
    Posts
    216
    Plugin Contributions
    0

    Default Re: Customer Specified Subject Line for Contact Form

    Holy cow I am so proud of myself I could just spit (jk). I am just a very novice person when it comes to php but I figured out how to do this. Here is how I accomplished this on my test zencart store:

    First I opened the file in my /includes/languages/english/custom template folder/
    called: contact_us.php

    I entered in the following line in between my other input fields so I could prepare to add a new text field in my template:

    define('ENTRY_DESCRIPTION', 'Description for Subject:');


    Next, I edited the file called tpl_contact_us_default.php in:
    templates/my template name/templates/

    I added another couple rows with the following code to make way for my custom subject line which I call "description":


    <tr>
    <td class="plainBoxHeading" colspan="2"><?php echo ENTRY_DESCRIPTION; ?></td>
    </tr>
    <tr>
    <td class="main" colspan="2"><?php echo zen_draw_input_field('description', ($error ? $_POST['name'] : $description), ' size="50"'); ?></td>
    </tr>
    <tr>

    And lastly, I edited the EMAIL_SUBJECT properties in the contact_us.php file to the following:

    define('EMAIL_SUBJECT', 'Question ' . $description);


    I received the email with my appended description in the subject line. Woo hoo!

  4. #4
    Join Date
    Jan 2004
    Posts
    66,391
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: Customer Specified Subject Line for Contact Form

    That's a great start, and will probably suffice for your needs.

    A couple things I note though:
    You may have some problems with that if the person filling in the form makes an error and the validation script shows error messages.
    You may also be vulnerable to SQL injection risks if you don't also sanitize the $_POST['description'] data prior to using it. You didn't show how you're using it, so it's hard to tell how much of a risk you have.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Jan 2007
    Location
    Boston, MA, USA
    Posts
    40
    Plugin Contributions
    0

    Default Re: Customer Specified Subject Line for Contact Form

    Hmm. I have a subject field added from this download, but when I try changing the code in contact_us.php to this:

    define('EMAIL_SUBJECT', 'Message about '. $subject);

    ...it doesn't work. Anyone have any ideas why not?

    It is defined as $subject in tpl_contact_us_default.php:

    <?php echo zen_draw_input_field('subject', $subject, ' size="40" id="subject"')

  6. #6
    Join Date
    Dec 2006
    Posts
    14
    Plugin Contributions
    0

    Default Re: Customer Specified Subject Line for Contact Form

    Quote Originally Posted by MichellyAqua12 View Post
    Hmm. I have a subject field added from this download, but when I try changing the code in contact_us.php to this:

    define('EMAIL_SUBJECT', 'Message about '. $subject);

    ...it doesn't work. Anyone have any ideas why not?

    It is defined as $subject in tpl_contact_us_default.php:

    <?php echo zen_draw_input_field('subject', $subject, ' size="40" id="subject"')
    I also want to add email subject using that contribution.. and try to test myself.. I find that there are no email subject at the customer email that I received...even though I filled in the subject at contact us form when I test run, Can somebody help..

  7. #7
    Join Date
    Jan 2007
    Location
    Boston, MA, USA
    Posts
    40
    Plugin Contributions
    0

    Default Re: Customer Specified Subject Line for Contact Form

    If you edit includes/modules/pages/contact_us/header_php.php, you can at least get the subject to be listed in the email you receive. I'd still like the subject to appear in the email subject line, because it's easier to sort through emails that way, but whatever, at least I can see what the subject is now.

    Ok, first go to admin/includes/languages/english/email_extras.php and find this (should be right near the top):

    Code:
    define('OFFICE_EMAIL','E-mail:');
    Add this below it:

    Code:
    define('OFFICE_SUBJECT','Subject:');
    Then go to includes/modules/pages/contact_us/header_php.php. Go to line 50 or so and find this:

    Code:
    // Prepare Text-only portion of message
        $text_message = OFFICE_FROM . &quot;\t&quot; . $name . &quot;\n&quot; .
        OFFICE_EMAIL . &quot;\t&quot; . $email_address . &quot;\n\n&quot; .
    Replace with this:

    Code:
    // Prepare Text-only portion of message
        $text_message = OFFICE_FROM . &quot;\t&quot; . $name . &quot;\n&quot; .
        OFFICE_EMAIL . &quot;\t&quot; . $email_address . &quot;\n&quot; .
        OFFICE_SUBJECT . &quot;\t&quot; . $subject . &quot;\n\n&quot; .
    You're really just changing part of the OFFICE_EMAIL line, and adding a line below it for the subject. (I didn't edit the HTML message options because I receive text-only emails).

    That should get the emails you receive to now list the subject within the body of the email!

  8. #8
    Join Date
    Dec 2006
    Posts
    14
    Plugin Contributions
    0

    Default Re: Customer Specified Subject Line for Contact Form

    Quote Originally Posted by MichellyAqua12 View Post
    If you edit includes/modules/pages/contact_us/header_php.php, you can at least get the subject to be listed in the email you receive. I'd still like the subject to appear in the email subject line, because it's easier to sort through emails that way, but whatever, at least I can see what the subject is now.

    Ok, first go to admin/includes/languages/english/email_extras.php and find this (should be right near the top):

    Code:
    define('OFFICE_EMAIL','E-mail:');
    Add this below it:

    Code:
    define('OFFICE_SUBJECT','Subject:');
    Then go to includes/modules/pages/contact_us/header_php.php. Go to line 50 or so and find this:

    Code:
    // Prepare Text-only portion of message
        $text_message = OFFICE_FROM . &quot;\t&quot; . $name . &quot;\n&quot; .
        OFFICE_EMAIL . &quot;\t&quot; . $email_address . &quot;\n\n&quot; .
    Replace with this:

    Code:
    // Prepare Text-only portion of message
        $text_message = OFFICE_FROM . &quot;\t&quot; . $name . &quot;\n&quot; .
        OFFICE_EMAIL . &quot;\t&quot; . $email_address . &quot;\n&quot; .
        OFFICE_SUBJECT . &quot;\t&quot; . $subject . &quot;\n\n&quot; .
    You're really just changing part of the OFFICE_EMAIL line, and adding a line below it for the subject. (I didn't edit the HTML message options because I receive text-only emails).

    That should get the emails you receive to now list the subject within the body of the email!
    Oh ... actually thats because of my mistake when upload the header_php.php file.. upload in wrong directory.. its OK right now.. I got the subject in the email.. instead of default subject from store name...

    Btw, thanks for help.. and I also want to try as your suggestion to see the different.. Thanks

  9. #9
    Join Date
    Jan 2007
    Location
    Boston, MA, USA
    Posts
    40
    Plugin Contributions
    0

    Default Re: Customer Specified Subject Line for Contact Form

    The code I gave you is so you can see what subject the customer put - it'll appear in the body of the email. For me, with the text emails I receive, it looks like this:

    From: ____
    Email: ___
    Subject: ___

    ---------------------------------
    (message body here)

    etc.


    I thought you were having the same problem as me where you installed the subject add-on but then had no way of knowing what the subject was because it didn't show up anywhere.

    Were you able to get the subject that the customer writes to appear in the subject line of the email you receive? In place of "Message from STORE_NAME"? That's what I was trying to do, but it won't work for me.

  10. #10
    Join Date
    Dec 2006
    Posts
    14
    Plugin Contributions
    0

    Default Re: Customer Specified Subject Line for Contact Form

    Yes I got the subject line that been filled in by the customer replace the " Message from store name"
    i.e;
    Subject: testing123
    From: "tester" <test######################>
    Date: Thu, March 8, 2007 6:31 pm
    To: [email protected]
    Priority: Normal

    From: tester
    Email: test######################

    ------------------------------------------------------

    This my testing only..

    ------------------------------------------------------

    Office Use Only:
    Etc..

    Just upload all the mod files to the respective directory... The first my problem is my mistake uploading the header_php.php file... you can try to start over again by overwrite the respective files by that mod..

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v139h Product Name to appear in Call for Price (contact us email subject line)
    By cmcneal in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 1 Mar 2012, 11:25 AM
  2. v139h Drop-down menu for email subject line in contact form
    By lastmiracle in forum General Questions
    Replies: 5
    Last Post: 28 Feb 2012, 08:12 PM
  3. v150 Change Contact Us Form Subject?
    By pmurray in forum All Other Contributions/Addons
    Replies: 6
    Last Post: 22 Jan 2012, 10:51 PM
  4. Replies: 1
    Last Post: 8 Mar 2011, 01:36 AM
  5. Adding a subject line to the contact us form
    By bubblegumgoods in forum General Questions
    Replies: 2
    Last Post: 24 Jun 2007, 05:00 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