Latest News: (loading..)
JackinLad

Contact Us additional Fields & Errors

9 posts in this topic

Hi there anyone

I installed the latest version of oSC.

When I tested the Contact us page, I received the email, but the "name", etc ... does not show in the message body.

I also want to include a "mobile" or "phone" number, so that if I receive the amil, that I can have the senders email address, name, phone / mobile number, and the actual message all included in the message body.

I played around, but my knowledge of pHp is to poor.

Can someone help please ?

Thanx in Advance

Share this post


Link to post
Share on other sites

"latest version" being what? The official current version 2.3.4 is totally obsolete -- don't use it. Install and run the community-supported version osC 2.3.4BS Edge instead, which is the only production-ready up-to-date version offered. 2.4 is still beta, and 3.0 is dead. 2.3.4.1 may be a little better than plain 2.3.4, but is not totally updated.

We'll also need to know your PHP version and which add-ons you've installed (if any).

Share this post


Link to post
Share on other sites

contact_us.php

$enquiry = tep_db_prepare_input($_POST['mobilnr']);

//+++++++++++++++++++


if (!tep_validate_email($mobilnr)) {
      $error = true;

      $messageStack->add('contact', ENTRY_EMAIL_MOBIL_TEL_CHECK_ERROR);
    }

//+++++++++++++++++++

<tr>
<td class="fieldValue"><br>
<?php echo ENTRY_EMAIL_MOBIL_TEL; ?><br>
<?php echo tep_draw_input_field('mobilnr'); ?></td>
</tr>

//+++++++++++++++++++

Language file:

define('ENTRY_EMAIL_MOBIL_TEL_CHECK_ERROR', 'Enter your mobile nr:');

define('ENTRY_EMAIL_MOBIL_TEL', 'Your mobile nr:');

Edited by Yepi

Share this post


Link to post
Share on other sites

@JackinLad

You have two different questions here:

1) How can you collect additional information from the customer when they use the 'Contact Us' page. @Yepi has addresses some of that above. Be aware that if you *require* the customer to include this additional information, you will have to make sure that you have the proper error-checking in place so that it is indeed included.

2) How to include this additional information in the email sent to you, the store owner. These additional fields will need to be included in the tep_mail() function within contact_us.php.

Also note that the 'Contact Us' page does not store any of this information in a database table. The only thing that is saved is that a 'contact us' event happened, and that is saved in the action recorder.

HTH

Malcolm

Share this post


Link to post
Share on other sites
Yes I know, It is just an additional input field with the error message 

Share this post


Link to post
Share on other sites
Saving to the database is not necessary. Here is the line with the data sent by email

 

if ($ error == false) {
      tep_mail (STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $ Query, $ name, $ email_adresse,  $ mobilnr );

Edited by Yepi

Share this post


Link to post
Share on other sites
It is understandably constructed. You can easily extend it to more fields
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added) VALUES ('XXXXX', 'CONTACT_YOURFIELD_DISPLAY', 'true', 'XXXXXXX ? true = ja, false = nein', '25', '5', now(), now());

contact_us.php

 

$yourfield           = $_POST['yourfield'];
//////////////////////////////////////////////////////////////

 

. "\n\n" . ENTRY_YOURFIELD . ' ' . $yourfield
///////////////////////////////////////////////////////////////////////////////

 

if (CONTACT_YOURFIELD_DISPLAY == 'true') {
    if (strlen($mobile) < 1) {
      $error = true;
      $messageStack->add('anfrage', ENTRY_YOURFIELD_CHECK_ERROR);
    }else{
    }
    }
///////////////////////////////////////////////////////////////////////////
    

tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $betreff, $text, $name, $address, $email_address, $mobile, $yourfield);
//////////////////////////////////////////////////////////////////////////

 

<td class="fieldKey"><?php if (CONTACT_YOURFIELD_DISPLAY == 'true') { ?><?php echo ENTRY_YOURFIELD; ?><br>
                <?php echo tep_draw_input_field('yourfield', $yourfield, 'size="45"'); ?>
            <?php }else{}?></td>
/////////////////////////////////////////////////////////////////////////

 

languages/en/contact_us.php

 

define('ENTRY_YOURFIELD', 'xxxxxxxxx:');
define('ENTRY_YOURFIELD_CHECK_ERROR', 'xxxxxxxxx:');

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now