Zen Cart Logo
Forums / General Questions / Drop-down menu for email subject line in contact form

Drop-down menu for email subject line in contact form

Views: 6,517

Results 1 to 6 of 6
16 Jan 2012, 9:13 AM
#1
lastmiracle avatar

lastmiracle

New Zenner

Join Date:
Nov 2011
Posts:
11
Plugin Contributions:
0

Drop-down menu for email subject line in contact form

Hello! First off, I'm **completely **new to PHP and especially Zen Cart. The client wanted me to help fix a badly customized site, and I'm stuck at this.

I need to make a drop-down menu with subject selections (e.g., Orders Inquiry, Product Info Request, etc.), that will insert into into the subject line of the email.

From digging through the forum, I found the solution separately only each of the tasks (1. how to set up a drop-down menu -- kinda; 2. how to insert subject line through a text input box). I don't know how to combine them together :(

I added: ENTRY_DESCRIPTION and changed EMAIL_SUBJECT in contact_us.php:

define('EMAIL_SUBJECT', 'JHL Style:' .$description);
define('ENTRY_DESCRIPTION', 'Subject:');

I found out about zen_draw_pull_down_menu and I tried to use it but I have no clue how to...

<label class="inputLabel" for="subject"><?php echo ENTRY_DESCRIPTION; ?></label><br class="clearBoth" />
<?php echo zen_draw_pull_down_menu('description', ($error ? $_POST['name'] : $description), ' size="50"'); ?>

These are the options I want to add to the list:

<select name="description">
<option value="Order Inquiries">Order Inquiries</option>
<option value="Returns & Exchanges">Returns & Exchanges</option>
<option value="Product Questions">Product Questions</option>
<option value="Find Your Essence">Find Your Essence</option>
<option value="Other Inquiries">Other</option>
</select>

Thank you in advance for any insight!

Here's the link to the form. It's so messy.

16 Jan 2012, 3:57 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Drop-down menu for email subject line in contact form

There's a mod in the Free Sofware Add Ons that adds a Subject line to the Contact Us form. You might be able to add a dropdown to that.

A little more information about the business issue you're trying to address would help, too. When I've wanted to have various Contact Us messages go to different places, I've just used a different email address for each, created them in Admin - Configuration - Email Options - Set "Contact Us" Email Dropdown List and done the sorting at the receiving end.

16 Jan 2012, 6:32 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Drop-down menu for email subject line in contact form

Instead if you simply add email addresses to the Contact Us Pulldown setting (Admin->Configuration->Email Options), you can direct those emails to different email addresses instead of fussing with any custom coding for subject lines. Assuming the code hasn't already been altered.

17 Jan 2012, 2:22 AM
#4
lastmiracle avatar

lastmiracle

New Zenner

Join Date:
Nov 2011
Posts:
11
Plugin Contributions:
0

Re: Drop-down menu for email subject line in contact form

Thanks guys. I am aware of the email-to option, but the client wanted everything to be pointed to just one email address with different subject line..

:(

28 Feb 2012, 9:42 AM
#5
lastmiracle avatar

lastmiracle

New Zenner

Join Date:
Nov 2011
Posts:
11
Plugin Contributions:
0

Re: Drop-down menu for email subject line in contact form

Here's an update, just for future references for other people who stumble on this:

It's MUCH easier to set up multiple e-mail addresses per DrByte's suggestion. Here's how:

Go to Admin->Configuration->Email Options, click Edit and type in: > Subject1 [email protected], Subject2 [email protected], Subject3 [email protected]

And it will show up automatically as a pull-down menu on your contact form, given that you didn't make any changes to /includes/templates/CUSTOM/templates/tpl_contact_us_default.php, where the default codes for the pull-down menu resides:

<label class="inputLabel" for="send-to"><?php echo SEND_TO_TEXT; ?></label>
<?php echo zen_draw_pull_down_menu('send_to',  $send_to_array, 0, 'id="send-to"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>

And you can change the default label for the list from "Send to Email" to anything, like "Subject", in /includes/languages/english/contact_us.php :

define('SEND_TO_TEXT','Change your label here');

Hope this helps!

28 Feb 2012, 7:12 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Drop-down menu for email subject line in contact form

Make sure to put any language or template alterations into an appropriate override foldername, instead of editing the original files directly.