Forums / Templates, Stylesheets, Page Layout / Custom contact forms

Custom contact forms

Started by raverx on 22 May 2006, 11:12 PM · Views: 11,492

Results 1 to 13 of 13
22 May 2006, 11:12 PM
#1
raverx avatar

raverx

New Zenner

Join Date:
May 2006
Posts:
3
Plugin Contributions:
0

Custom contact forms

Hey,

Just wondering if there is a module or maybe something a little more obvious that I have missed to produce custom contact forms for ZenCart.

A site I am building requires 2 pages which the visitors to the site will submit information to the store owners to update their in-house customer database.

Whilst I could knock this up as a static page outside of the ZC install, it seems a little funny that this can't be done within the ZC infrastructure?

Any help appreciated :)

..:: INSANE TECHNOLOGIES :: databases - networks - websites ::..

23 May 2006, 3:47 AM
#3
raverx avatar

raverx

New Zenner

Join Date:
May 2006
Posts:
3
Plugin Contributions:
0

Re: Custom contact forms

can this module be used irrespective of a product?

specifically i need 3 pages which are completely unrelated to a product, category or manufacturer which simply act as a contact page, but with alternative fields than what the contact form provides...

..:: INSANE TECHNOLOGIES :: databases - networks - websites ::..

23 May 2006, 4:09 AM
#4
seethrou avatar

seethrou

Totally Zenned

Join Date:
May 2004
Location:
Hong Kong
Posts:
1,156
Plugin Contributions:
0

Re: Custom contact forms

Primary, it is a Ask A Question Contact Form although with the product questions for example. And how and where to use, also how to expand should be depend on you.

A New Starter again

27 Jun 2006, 7:32 AM
#5
davidinho avatar

davidinho

New Zenner

Join Date:
Oct 2005
Posts:
15
Plugin Contributions:
0

Re: Custom contact forms

I'm trying to add a custom form to Zen-Cart and this looks promising but having installed the module, I don't see how I can get the form to display if there's no product info - I need to have a form that appears on an EZ Page.

Has anyone got this module working like that?

27 Jun 2006, 7:50 AM
#6
raverx avatar

raverx

New Zenner

Join Date:
May 2006
Posts:
3
Plugin Contributions:
0

Re: Custom contact forms

i gave up on that module, it was annoying...

just hacked up the contacts page script to do what i wanted it to do...

you need to understand forms to some extent, tho ZenCart has functions to do most things which are pretty easy to understand..

first look in /includes/templates/theme_name/templates/tpl_contact_us_default.php
copy this to whatever you want your new page to be called (in my case 'vip')
sp tpl_vip_default.php

then edit it to suit your requirements

then goto /includes/modules/pages/contact_us/
copy that folder to whatever you called your previous one
ie: /includes/modules/pages/vip/

then edit 'header_php.php' - this will process your form when you POST to it, you will need to match the variable names to what you put in the tpl file

you may also need to go to /includes/languages/english/html_includes and copy define_contact_us.php to define_name.php (ie: define_vip.php)

you will also need to go to /includes/languages/english and copy contact_us.php to the same name (ie: vip.php)

I think that's all I did.. there may have been one other file that needs changing..

I've attached a copy of the 4 files mentioned for anyone who wants to use them as a reference.. just ignore the ladym folder as that's the source tree for the project i was working on..

..:: INSANE TECHNOLOGIES :: databases - networks - websites ::..

27 Jun 2006, 9:39 AM
#7
davidinho avatar

davidinho

New Zenner

Join Date:
Oct 2005
Posts:
15
Plugin Contributions:
0

Re: Custom contact forms

Cool - thanks very much for that raverx I will have a go that way round.

28 Jun 2006, 11:26 AM
#8
davidinho avatar

davidinho

New Zenner

Join Date:
Oct 2005
Posts:
15
Plugin Contributions:
0

Re: Custom contact forms

I have just about got this working now and just thought I'd add that the other file that needs changing is includes/filenames.php where you need to add a define for the name of your folder. So in your previous case, add
define('FILENAME_VIP', 'vip');
you then need to edit the line in your new template

<?php echo zen_draw_form('contact_us', zen_href_link(FILENAME_CONTACT_US, 'action=send')); ?>

to

<?php echo zen_draw_form('vip', zen_href_link(FILENAME_VIP, 'action=send')); ?>

That all seems to work :)

16 Jul 2006, 7:49 PM
#9
wyreworks avatar

wyreworks

New Zenner

Join Date:
Jul 2006
Posts:
16
Plugin Contributions:
0

Re: Custom contact forms

I've added a custom contact page for wholesale inquiries, and am trying to add an extra field. The field shows up on the page, but when I test it, the info from that field does not come through. I've been playing around with this for a couple hours, and tried the method listed here, copied the info from the attached files in that message, nothing works so far. I've attached my two files header_php.php and tpl_wholesale_default.php if anyone has a clue what I've screwed up and how to make it work. Thanks!

raverX:

i gave up on that module, it was annoying...

just hacked up the contacts page script to do what i wanted it to do...

you need to understand forms to some extent, tho ZenCart has functions to do most things which are pretty easy to understand..

first look in /includes/templates/theme_name/templates/tpl_contact_us_default.php
copy this to whatever you want your new page to be called (in my case 'vip')
sp tpl_vip_default.php

then edit it to suit your requirements

then goto /includes/modules/pages/contact_us/
copy that folder to whatever you called your previous one
ie: /includes/modules/pages/vip/

then edit 'header_php.php' - this will process your form when you POST to it, you will need to match the variable names to what you put in the tpl file

you may also need to go to /includes/languages/english/html_includes and copy define_contact_us.php to define_name.php (ie: define_vip.php)

you will also need to go to /includes/languages/english and copy contact_us.php to the same name (ie: vip.php)

I think that's all I did.. there may have been one other file that needs changing..

I've attached a copy of the 4 files mentioned for anyone who wants to use them as a reference.. just ignore the ladym folder as that's the source tree for the project i was working on..

1 Oct 2006, 11:20 PM
#10
granny avatar

granny

New Zenner

Join Date:
Oct 2006
Posts:
1
Plugin Contributions:
0

Re: Custom contact forms

This seems to be the only info I could find for how to create a custom form, and I was pleased to see some quality instruction.

I created my new form and completed all of the steps as instructed, but when I send a test, it just refreshes the screen, with the data that I entered still showing in the boxes, and ads "&action=send" to the end of the URL.

I know how to create a working form in HTML, but this php thing is new to me. Any suggestions?

13 Jan 2009, 4:55 PM
#11
tabr0201 avatar

tabr0201

New Zenner

Join Date:
Jan 2009
Posts:
1
Plugin Contributions:
0

Re: Custom contact forms

I am trying to take the information in the contact form and have it populate a csv file or database instead of an email - is this possible?

30 May 2010, 2:04 AM
#12
mawson avatar

mawson

New Zenner

Join Date:
May 2010
Posts:
17
Plugin Contributions:
0

Re: Custom contact forms

raverX:

i gave up on that module, it was annoying...

just hacked up the contacts page script to do what i wanted it to do...

you need to understand forms to some extent, tho ZenCart has functions to do most things which are pretty easy to understand..

first look in /includes/templates/theme_name/templates/tpl_contact_us_default.php
copy this to whatever you want your new page to be called (in my case 'vip')
sp tpl_vip_default.php

then edit it to suit your requirements

then goto /includes/modules/pages/contact_us/
copy that folder to whatever you called your previous one
ie: /includes/modules/pages/vip/

then edit 'header_php.php' - this will process your form when you POST to it, you will need to match the variable names to what you put in the tpl file

you may also need to go to /includes/languages/english/html_includes and copy define_contact_us.php to define_name.php (ie: define_vip.php)

you will also need to go to /includes/languages/english and copy contact_us.php to the same name (ie: vip.php)

I think that's all I did.. there may have been one other file that needs changing..

I've attached a copy of the 4 files mentioned for anyone who wants to use them as a reference.. just ignore the ladym folder as that's the source tree for the project i was working on..

I have the above form working. Now I want to add a second drop-down menu for a different form field. I added the code to the header_php.php but all that did was put the fields for both drop-down menus in both.

How do I end one drop-down and start a new one?

My code is...

// Pulldown to select a size
// Set default selection:
$default_pulldown_selection = '0';

//For validation, you're looking for the contents of the $_POST['size'] variable
// this is only set after "submit" is clicked.
$pulldown_selected_item = (isset($_POST['size'])) ? $_POST['size'] : $default_pulldown_selection ;

//build an array of entries to be displayed on the template for field 'size':
$pulldown_contents[] = array('id'=>'0', 'text'=>'Please Select');
$pulldown_contents[] = array('id'=>'standard', 'text'=>'Standard');
$pulldown_contents[] = array('id'=>'large', 'text'=>'Large');

// Pulldown to select a color
// Set default selection:
$default_pulldown_selection = '0';

//For validation, you're looking for the contents of the $_POST['color'] variable
// this is only set after "submit" is clicked.
$pulldown_selected_item = (isset($_POST['color'])) ? $_POST['color'] : $default_pulldown_selection ;

//build an array of entries to be displayed on the template for field 'color':
$pulldown_contents[] = array('id'=>'0', 'text'=>'Please Select');
$pulldown_contents[] = array('id'=>'red', 'text'=>'Red');
$pulldown_contents[] = array('id'=>'blue', 'text'=>'Blue');

I think I would have to put some code between these two lines to end one drop-down and start the next.

$pulldown_contents[] = array('id'=>'large', 'text'=>'Large');

End first drop-down

Start second drop-down
// Pulldown to select a color

in the file tpl file I have

<label class="inputLabel" for="size">Select a Size Request:</label>

<?php echo zen_draw_pull_down_menu('size', $pulldown_contents, $pulldown_selected_item); ?> <br class="clearBoth" />

<label class="inputLabel" for="color">Color:</label>

<?php echo zen_draw_pull_down_menu('color', $pulldown_contents, $pulldown_selected_item); ?> <br class="clearBoth" />

Can anybody tell me how to seperate the two drop down box contents? At the moment both boxes have a choice of
Standard
Large
Red
Blue

I would like the first drop-down to have a choice of Standard and Large and the second drop-down choice of Red and Blue

18 Apr 2011, 3:45 PM
#13
dpierri avatar

dpierri

New Zenner

Join Date:
Apr 2011
Posts:
2
Plugin Contributions:
0

Re: Custom contact forms

I'm running version 1.3.9 and noticed that there has not been any questions recently, but I will try this anyhow.
I created all the files and place them where the folders indicated but I can't open the form.
I have purchased and installed a template so could this have an impact as to where the forms come from? Also, could I use the "Create Account" form and do the same? What if I want to replace the "contact us" link on the header and point to my new form instead? What do I do with the Java script? It seems to point to the contact us form when that's not what I want.
I'm new to the whole ZenCart community and technology so please forgive me for my ignorance.
Thanks.
:mellow: