Zen Cart Logo
Forums / Basic Configuration / dropdown menu on contact page

dropdown menu on contact page

Locked

Views: 3,652

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
28 Feb 2007, 10:50 PM
#1
kaoschris avatar

kaoschris

New Zenner

Join Date:
Feb 2007
Location:
San Francisco, CA
Posts:
16
Plugin Contributions:
0

dropdown menu on contact page

I can't figure out how to create a dropdown menu on a new contact page I created. I am pretty well versed in XHTML and CSS but know very little about PHP and javascript. If anyone could help I would appreciate it
Thanx

Here is what I have so far:
http://www.lawlessscarab.com/store/index.php?main_page=contact_retail

1 Mar 2007, 1:41 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: dropdown menu on contact page

You did not specify what this is for??? There is code for a multiple # of contacts as a drop down present in includes/templates/template_default/templates/tpl_contact_us_default.php file (allways make a copy and place in your template overrides folder) - find this and you can copy - clone or code it as you need or if js or html wrap in php tags:

<?php
// show dropdown if set
    if (CONTACT_US_LIST !=''){
?>

But if this is what you want it is already there

4 Mar 2007, 6:58 PM
#3
kaoschris avatar

kaoschris

New Zenner

Join Date:
Feb 2007
Location:
San Francisco, CA
Posts:
16
Plugin Contributions:
0

Re: dropdown menu on contact page

The dropdown is for a subject line. I have gotten as far as creating the dropdown list itself, I'm just not sure how to get the options in the dropdown menu to appear.

5 Mar 2007, 4:58 AM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: dropdown menu on contact page

Try posting what you have added and where

5 Mar 2007, 7:29 PM
#5
kaoschris avatar

kaoschris

New Zenner

Join Date:
Feb 2007
Location:
San Francisco, CA
Posts:
16
Plugin Contributions:
0

Re: dropdown menu on contact page

This is what I have done on a new page that I created using a template that I downloaded. The page is /includes/template/MY_TEMPLATE/templates/tpl_contact_retail_default.php

Code:

<label class="inputLabel" for="inquiry_area"><?php echo ENTRY_INQUIRY_DROPDOWN; ?></label>
<?php echo zen_draw_pull_down_menu('inquiry_area', $inquiry_area, ' size="40" id="inquiry_area"');?>
<br class="clearBoth" />

The problem is that on my site I get the dropdown menu but it is empty. I need to know how to fill it in with 4 different options; for example things like current order status or website problems and that's what I don't know how to put in. The example is on this link:

contact retail

The dropdown menu is next to area of inquiry: line of text.

Thanx

6 Mar 2007, 2:54 AM
#6
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: dropdown menu on contact page

You n eed to know that in almot all cases that the tpl file describes the display of information gathered from other files. You now have the page display ok but there is no data to draw from to populate this.

You can inline code this data if it does not change or create another file to gather this info from the DB and make it dynamic if and when the data might be changed.

You have to look at the code I referenced earlier for exactness but a general area would be tpl_contact_us_default.php and includes/modules/pages/contact_us/header_php.php

Basic code for this would be the following but you need to apply a table where this info exists and the zen type of code that you find in the referenced files. also apply a name to the retreived data to be used in your tpl file

mysql_connect("localhost","root","password") or die (mysql_error()); // "root" is the default username.
mysql_select_db("database") or die (mysql_error());
$column = ""; // Set which column to be retrieved.
$table = ""; // Set which table to retrieve column from.
$query="SELECT $column FROM $table";
$result = mysql_query($query);
// echo the select tag:
echo "<select name=\"bla\">";
// Lets loop through the result:
while($row = mysql_fetch_array($result)) {
  echo "<option value=\"$row\">$row</option><br/>\r\n";
}
// echo the closure of the select tag:
echo "</select>";  
7 Mar 2007, 6:18 PM
#7
kaoschris avatar

kaoschris

New Zenner

Join Date:
Feb 2007
Location:
San Francisco, CA
Posts:
16
Plugin Contributions:
0

Re: dropdown menu on contact page

I.m sorry, but you've lost me on this one. Am I supposed to put that code in the header_php.php file or in the tpl_contact_retail_default.php file? Does that code exist already, because if so where would I find it, I don't have it on my tpl_contact_us_default.php file.

7 Mar 2007, 6:28 PM
#8
kaoschris avatar

kaoschris

New Zenner

Join Date:
Feb 2007
Location:
San Francisco, CA
Posts:
16
Plugin Contributions:
0

Re: dropdown menu on contact page

Nevermind, I figured it out. Thanks for all your help. I appreciate it.

14 Mar 2007, 1:37 PM
#9
lukemcr avatar

lukemcr

New Zenner

Join Date:
Feb 2007
Location:
Sacramento, CA
Posts:
64
Plugin Contributions:
0

Re: dropdown menu on contact page

Hey KaosChris, what did you do exactly that worked?

15 Mar 2007, 12:36 AM
#10
kaoschris avatar

kaoschris

New Zenner

Join Date:
Feb 2007
Location:
San Francisco, CA
Posts:
16
Plugin Contributions:
0

Re: dropdown menu on contact page

This is the code used in the tpl_contact_retail_default.php page

<label class="inputLabel" for="inquiry_area"><?php echo ENTRY_INQUIRY_DROPDOWN; ?></label>
<?php echo  "<select name=\"inquiry_area\">" . '<option value="order status">' . ENTRY_ORDER_STATUS . '</option>' . '<option value="change order">' . ENTRY_ORDER_CHANGE . '</option>' . '<option value="website problems">' . ENTRY_WEBSITE . '</option>' . '<option value="shopping cart problems">' . ENTRY_SHOPPING_CART . '</option>' . '<option value="other">' . ENTRY_OTHER . '</option>' . "</select>";?>
<br class="clearBoth" />

Assuming you have the other files that the template file loads correctly then this code should work. If you need the other code just let me know.

21 Mar 2007, 6:40 PM
#11
lukemcr avatar

lukemcr

New Zenner

Join Date:
Feb 2007
Location:
Sacramento, CA
Posts:
64
Plugin Contributions:
0

Re: dropdown menu on contact page

Yeah, if you could PM the code to me, or post it on the boards here for other people to see as well, then that would be great. From what I understand, your code calls the ENTRY_ORDER_STATUS and ENTRY_ORDER_CHANGE variables, among others. This other code you're talking about is how and where those variables are defined, right?

Thanks a lot for your help,

Luke

7 Apr 2007, 7:37 PM
#12
kaoschris avatar

kaoschris

New Zenner

Join Date:
Feb 2007
Location:
San Francisco, CA
Posts:
16
Plugin Contributions:
0

Re: dropdown menu on contact page

Sorry this took so long, here is what I did ( this is for a form to contact about retail orders so change for what you need as needed)

In the file /includes/languages/english/YOUR_STORE/contact_retail.php

define('ENTRY_ORDER_CHANGE', 'I Need to Change My Order');
define('ENTRY_WEBSITE', 'Website Problems');
define('ENTRY_SHOPPING_CART', 'Shopping Cart Problems');
define('ENTRY_OTHER', 'Other');

contact_retail.php is what I called my file, change as needed.

then in the file /includes/templates/YOUR_STORE/templates/tpl_contact_retail_default.php

<label class="inputLabel" for="inquiry_area"><?php echo ENTRY_INQUIRY_DROPDOWN; ?></label>
<?php echo  "<select name=\"inquiry_area\">" . '<option value="order status">' . ENTRY_ORDER_STATUS . '</option>' . '<option value="change order">' . ENTRY_ORDER_CHANGE . '</option>' . '<option value="website problems">' . ENTRY_WEBSITE . '</option>' . '<option value="shopping cart problems">' . ENTRY_SHOPPING_CART . '</option>' . '<option value="other">' . ENTRY_OTHER . '</option>' . "</select>";?>
<br class="clearBoth" />

Where the code corresponds to the name in the contact_retail.php and the option value is for the header so the email will look correct when sent to whoever is receiving it.

Finally, in the file /includes/modules/pages/contact_retail/header.php

"Area of Inquiry:\t\t" . strip_tags($_POST['inquiry_area']) . "\n" .

This way it sends correctly.