Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2005
    Location
    New Jersey
    Posts
    646
    Plugin Contributions
    0

    Default Add a field to the contast us form

    I apologize in advance if this has been asked and answered...I have the latest version of Zen, 1.3.0.2, I would like to add a field for the customer to include their phone number in the contact us form. Is this possible, and if so, can anyone explain how to go about doing so? I don't want this to be required as it is only for people who wish to book shows.

    Thanks in advance,
    Kelly

  2. #2
    Join Date
    Feb 2005
    Location
    New Jersey
    Posts
    646
    Plugin Contributions
    0

    Default Re: Add a field to the contact us form

    BTW I did get some search results for my question, but they are for older versions.

  3. #3
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Add a field to the contast us form

    Since this is about template customizing + for Zen-Cart v1.3x (and, correct, results are only found for older versions only) - sounds like fun.

    // Step 1:

    In your includes/templates/<your_template>/tpl_contact_us_default.php file,

    find:

    PHP Code:
    <label class="inputLabel" for="email-address"><?php echo ENTRY_EMAIL?></label>
    <?php echo zen_draw_input_field('email', ($error $_POST['email'] : $email), ' size="40" id="email-address"') . '<span class="alert">' ENTRY_REQUIRED_SYMBOL '</span>'?>
    <br class="clearBoth" />
    add below:

    PHP Code:
    <label class="inputLabel" for="contactphonenumber"><?php echo ENTRY_TELEPHONE_NUMBER?></label>
    <?php echo zen_draw_input_field('phone_number'$phone_number' size="40" id="phone_number"') . '<span class="alert">' ENTRY_REQUIRED_SYMBOL '</span>'?>
    <br class="clearBoth" />
    // Step 2:

    In your includes/modules/pages/contact_us/<your_template>/header_php.php file,

    find:

    PHP Code:
    $enquiry zen_db_prepare_input(strip_tags($_POST['enquiry'])); 
    add below:

    PHP Code:
    $phone_number zen_db_prepare_input(stripslashes(trim($_POST['phone_number']))) : ""
    Then, find:

    PHP Code:
    if ($zc_validate_email and !empty($enquiry) and !empty($name)) { 
    replace with:

    PHP Code:
    if ($zc_validate_email and !empty($enquiry) and !empty($name) and !empty($phone_number)) { 
    Then, find:

    PHP Code:
    $html_msg['EXTRA_INFO'] = $extra_info['HTML']; 
    add right below:

    PHP Code:
    $html_msg['PHONE_NUMBER'] = $phone_number
    Then, find:

    PHP Code:
    if (empty($enquiry)) {
          
    $messageStack->add('contact'ENTRY_EMAIL_CONTENT_CHECK_ERROR);
        } 
    add right below:

    PHP Code:
    if (empty($phone_number)) {
    $messageStack->add('contact'ENTRY_EMAIL_PHONE_NUMBER_CHECK_ERROR);

    // Step 3:

    In your includes/languages/english/<your_language>/contact_us.php file,

    add the following entries in:

    PHP Code:
    define ('ENTRY_TELEPHONE_NUMBER''Contact phone number:');
    define('ENTRY_EMAIL_PHONE_NUMBER_CHECK_ERROR''You did not filled out your contact phone number.'); 
    // Step 4:

    In your email/email_template_contact_us.html file,

    find:

    PHP Code:
    $EXTRA_INFO 
    add below:

    PHP Code:
    $PHONE_NUMBER 
    Of course, the email template modifications part is only suggested - you can add this variable anywhere you'd like, from that template file, in order to fit your needs.

    I believe these should be all.

  4. #4
    Join Date
    Feb 2005
    Location
    New Jersey
    Posts
    646
    Plugin Contributions
    0

    Default Re: Add a field to the contact us form

    Wow! Thanks for the reply. Let me grab a cup of tea and settle in for a bit! This could take a little while.

    Thank you again!

  5. #5
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Add a field to the contast us form

    Very well. Please advise if it works (even if it doesn't ).

  6. #6
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Add a field to the contast us form

    A couple corrections to TheOracle's post...

    1. Label mismatch:
    PHP Code:
    <label class="inputLabel" for="contactphonenumber"><?php echo ENTRY_TELEPHONE_NUMBER?></label>
    <?php echo zen_draw_input_field('phone_number'$phone_number' size="40" id="phone_number"') . '<span class="alert">' ENTRY_REQUIRED_SYMBOL '</span>'?>
    <br class="clearBoth" />
    should be:
    PHP Code:
    <label class="inputLabel" for="phone-number"><?php echo ENTRY_TELEPHONE_NUMBER?></label>
    <?php echo zen_draw_input_field('phone_number'$phone_number' size="40" id="phone-number"') . '<span class="alert">' ENTRY_REQUIRED_SYMBOL '</span>'?>
    <br class="clearBoth" />
    2. Syntax error:
    PHP Code:
    $phone_number zen_db_prepare_input(stripslashes(trim($_POST['phone_number']))) : ""
    should be:
    PHP Code:
    $phone_number = (isset($_POST['phone_number'])) ? zen_db_prepare_input($_POST['phone_number']) : ''
    (FYI: trim and stripslashes are already done by the prepare-input function)


    3. You said you didn't want the phone number to be "required", so don't make this change:
    PHP Code:
    if ($zc_validate_email and !empty($enquiry) and !empty($name) and !empty($phone_number)) { 

    4. And of course change the text in the new define() to suit your use.
    .

    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.

  7. #7
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Add a field to the contast us form



    Ok ... this one really hurts. I have something in my eye ...


    FYI: trim and stripslashes are already done by the prepare-input function)
    Thanks. I wasn't aware it was included.

  8. #8
    Join Date
    May 2006
    Location
    Texas
    Posts
    565
    Plugin Contributions
    4

    Default Re: Add a field to the contast us form

    sleepless, did you get this to work? For some reason everything seems to look good on mine, but I still don't receive the information I added. Basically, I added a line that asks for the product's name and it is not required. I tested it on my test site, and though it appears to be a functional form.. I never see it in my text-based e-mails.

    Also, when I turn on the HTML emails, where it should show a small field of products that the customer is interested in, it shows $ITEM_NAME (the variable i'm using). Any ideas?

  9. #9
    Join Date
    Jun 2007
    Posts
    71
    Plugin Contributions
    0

    Default Re: Add a field to the contast us form

    Does the codes work or not?

  10. #10
    Join Date
    Mar 2007
    Location
    AZ
    Posts
    1,911
    Plugin Contributions
    2

    Default Re: Add a field to the contast us form

    Quote Originally Posted by rainmist View Post
    Does the codes work or not?
    Try this:

    http://www.zen-cart.com/index.php?ma...roducts_id=337

    or this:

    http://www.zen-cart.com/index.php?ma...roducts_id=331

    Tina

 

 

Similar Threads

  1. v139h Add Field to Contact Us Form
    By Donn in forum General Questions
    Replies: 1
    Last Post: 12 Jan 2012, 11:07 PM
  2. Is there a way to add form field hints for individual attributes?
    By polygone in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 16 Dec 2009, 03:28 AM
  3. How to add form field to the shopper registration page?
    By erikcw in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 7 Oct 2009, 11:03 PM
  4. can i change the contast in my shopping cart
    By delightz in forum Basic Configuration
    Replies: 1
    Last Post: 5 Nov 2006, 08:48 AM

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