Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2012
    Posts
    19
    Plugin Contributions
    0

    Default Making the name field not mandatory on the contact page

    i am using Zen Cart 1.50 with the Apparel Boutique template.

    i want to make it not mandatory to enter your name on the contact page.

    any help would be appreciated.

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,489
    Plugin Contributions
    88

    Default Re: Making the name field not mandatory on the contact page

    Create the file /includes/modules/pages/contact_us/header_php_empty_name_ok.php containing:
    Code:
    <?php
    /**
     * Contact Us Page
     *
     * @package page
     * @copyright Copyright 2003-2011 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: header_php.php 18697 2011-05-04 14:35:20Z wilt $
     */
    if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
      if ($zc_validate_email and !empty($enquiry)) {
        // auto complete when logged in
        if($_SESSION['customer_id']) {
          $sql = "SELECT customers_id, customers_firstname, customers_lastname, customers_password, customers_email_address, customers_default_address_id
                  FROM " . TABLE_CUSTOMERS . "
                  WHERE customers_id = :customersID";
    
          $sql = $db->bindVars($sql, ':customersID', $_SESSION['customer_id'], 'integer');
          $check_customer = $db->Execute($sql);
          $customer_email= $check_customer->fields['customers_email_address'];
          $customer_name= $check_customer->fields['customers_firstname'] . ' ' . $check_customer->fields['customers_lastname'];
        } else {
          $customer_email = NOT_LOGGED_IN_TEXT;
          $customer_name = NOT_LOGGED_IN_TEXT;
        }
    
        // use contact us dropdown if defined
        if (CONTACT_US_LIST !=''){
          $send_to_array=explode("," ,CONTACT_US_LIST);
          preg_match('/\<[^>]+\>/', $send_to_array[$_POST['send_to']], $send_email_array);
          $send_to_email= preg_replace ("/>/", "", $send_email_array[0]);
          $send_to_email= trim(preg_replace("/</", "", $send_to_email));
          $send_to_name = trim(preg_replace('/\<[^*]*/', '', $send_to_array[$_POST['send_to']]));
        } else {  //otherwise default to EMAIL_FROM and store name
        $send_to_email = trim(EMAIL_FROM);
        $send_to_name =  trim(STORE_NAME);
        }
    
        // Prepare extra-info details
        $extra_info = email_collect_extra_info($name, $email_address, $customer_name, $customer_email);
        // Prepare Text-only portion of message
        $text_message = OFFICE_FROM . "\t" . $name . "\n" .
        OFFICE_EMAIL . "\t" . $email_address . "\n\n" .
        '------------------------------------------------------' . "\n\n" .
        strip_tags($_POST['enquiry']) .  "\n\n" .
        '------------------------------------------------------' . "\n\n" .
        $extra_info['TEXT'];
        // Prepare HTML-portion of message
        $html_msg['EMAIL_MESSAGE_HTML'] = strip_tags($_POST['enquiry']);
        $html_msg['CONTACT_US_OFFICE_FROM'] = OFFICE_FROM . ' ' . $name . '<br />' . OFFICE_EMAIL . '(' . $email_address . ')';
        $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
        // Send message
        zen_mail($send_to_name, $send_to_email, EMAIL_SUBJECT, $text_message, $name, $email_address, $html_msg,'contact_us');
    
        zen_redirect(zen_href_link(FILENAME_CONTACT_US, 'action=success'));
      }
    } // end action==send
    That file makes it OK for the name not to be specified (as long as the email address and message are OK). Then, create the file /includes/templates/apparel_boutique/css/contact_us.css that contains:
    Code:
    div.alert+br+label+input+span { display: none; }
    That file, for the contact_us page only, causes the asterisk that indicates that the name field is required to be "not displayed".

    No core file overwrites!

 

 

Similar Threads

  1. Contact Us not showing any text except the 3 field
    By pod86 in forum Basic Configuration
    Replies: 1
    Last Post: 5 May 2010, 04:58 AM
  2. Not in FAQs.. How to change Page 2, Page 3 name to the actual page name
    By jdsmith8 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 14 Mar 2009, 12:15 AM
  3. Making a different kind of page - mandatory attributes, etc
    By crawfurd in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 9 Feb 2008, 11:34 AM
  4. Replies: 2
    Last Post: 13 Jul 2006, 11:25 PM

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