Re: custom forms - data collection
I have yet to upload my store to a server, hence cannot test any emails, but am seeking insight on the following:
That the person that completes the form also gets a copy of the form via email, but without any admin (OFFICE?) stuff, so that the person can reply to the email with file attachments or other correspondence...
In includes\modules\pages\my_page\header_php.php, after the line:
zen_mail(STORE_NAME, SEND_TO_ADDRESS, EMAIL_SUBJECT, $email_text, $email . ' ' . $lastname, $firstname, array('EMAIL_MESSAGE_HTML' => $email_html), 'my_page');
I propose to insert something like:
zen_mail($person_name, $person_email, $email_subject, $email_textX, SEND_TO_DEPT_ADDRESS . ' ' . STORE_DEPT_NAME, array('EMAIL_MESSAGE_HTML' => $email_html), 'my_page');
but with the following manipulations:
$person_name = $namefirst . ' ' . $namelast;
$person_email = $email
$email_subject = $work_id . ' ' . $work_title (where work_id and $work_title are each limited/truncated to 32 chars max, thus 64 chars total)
$email_textX = form input (My Page Data Submission) less any admin (OFFICE?) stuff
SEND_TO_DEPT_ADDRESS = as defined in includes\languages\english\my_page.php
STORE_DEPT_NAME = as defined in includes\languages\english\my_page.php
However, I have yet to work out what the last parts of the line do ie:
array('EMAIL_MESSAGE_HTML' => $email_html) (I only want to send and receive plain text, no html, emails)
'my_page'
Nor these lines located just above the proposed insertion
$email_text = zen_output_string_protected($email_text);
$email_html = nl2br("\n" . $email_text);
Thanks in advance.
Re: custom forms - data collection
Quote:
Originally Posted by
dw08gm
I have yet to upload my store to a server, hence cannot test any emails, but am seeking insight on the following:
That the person that completes the form also gets a copy of the form via email, but without any admin (OFFICE?) stuff, so that the person can reply to the email with file attachments or other correspondence...
In includes\modules\pages\my_page\header_php.php, after the line:
zen_mail(STORE_NAME, SEND_TO_ADDRESS, EMAIL_SUBJECT, $email_text, $email . ' ' . $lastname, $firstname, array('EMAIL_MESSAGE_HTML' => $email_html), 'my_page');
I propose to insert something like:
zen_mail($person_name, $person_email, $email_subject, $email_textX, SEND_TO_DEPT_ADDRESS . ' ' . STORE_DEPT_NAME, array('EMAIL_MESSAGE_HTML' => $email_html), 'my_page');
but with the following manipulations:
$person_name = $namefirst . ' ' . $namelast;
$person_email = $email
$email_subject = $work_id . ' ' . $work_title (where work_id and $work_title are each limited/truncated to 32 chars max, thus 64 chars total)
$email_textX = form input (My Page Data Submission) less any admin (OFFICE?) stuff
SEND_TO_DEPT_ADDRESS = as defined in includes\languages\english\my_page.php
STORE_DEPT_NAME = as defined in includes\languages\english\my_page.php
However, I have yet to work out what the last parts of the line do ie:
array('EMAIL_MESSAGE_HTML' => $email_html) (I only want to send and receive plain text, no html, emails)
'my_page'
Nor these lines located just above the proposed insertion
$email_text = zen_output_string_protected($email_text);
$email_html = nl2br("\n" . $email_text);
Thanks in advance.
Hi there. Are you still wanting to receive HTML email from your form?
Here's a pretty good explanation of the zen_mail() function: showpost.php?p=364047&postcount=6
DrByte says the last three parameters are optional. ($block [the array for html email], $module [in your case it looks to be 'my_page'], and $attachments_list [which it doesn't look like you're using].)
I personally would keep the line $email_text = zen_output_string_protected($email_text); but you can nix the other if you're sending plain text.
Re: custom forms - data collection
Quote:
Originally Posted by
mmand
Hi there. Are you still wanting to receive HTML email from your form?
In this instance, the initial thought was to receive just a pre-ordained list of labels/input in plain text, but not to do away with HTML emails altogether, as might be desireable for Newsletters and other correspondance. As such, the form primarily serves to guarantee a checklist of required info.
I appreciate the link, which I am currently viewing with other material.
The issues of how to code the sending of the email and excluding the admin (OFFICE) stuff remain to sorted.
Re: custom forms - data collection
I have created a supplier registration form based on this mod, where the only remaining problem is getting the Country to display as its Name rather than its Number (eg "Australia" rather than "13") after selection from the Country dropdown menu.
Rather than post the entire files, references to Country are as follows:
includes/modules/pages/supplier_registration/header_php.php
Line 33
$country = '';
After if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
Line 61
$country = zen_db_prepare_input($_POST['zone_country_id']);
After // BOF Error Messages
Line 111
if (!zen_not_null($country)) {
$error = true;
$messageStack->add('supplier_registration', 'Please select your country');
}
After //assemble the email contents:
Line 203
'country:' . "\t" . $country . "\n" .
includes/templates/your_template/tpl_supplier_registration_default.php
After <fieldset>
Line 76
<label class="inputLabel" for="country"><?php echo ENTRY_COUNTRY; ?></label>
<?php echo zen_get_country_list('zone_country_id', $selected_country, 'id="country" ') . (zen_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="alert">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?>
What have I done wrong?
TIA
Re: custom forms - data collection
Bump.
While I am sure the problem lies with the zone_country_id, changing this to country_name, as well as changing numerous other variants in the code, has not yet produced the desired effect - display of country name in the email.
I feel Wits End is fast approaching.
Re: custom forms - data collection
How to add country dropdown that returns the country name
Quote:
Originally Posted by
dw08gm
I have created a supplier registration form based on this mod, where the only remaining problem is getting the Country to display as its Name rather than its Number (eg "Australia" rather than "13") after selection from the Country dropdown menu.
Rather than post the entire files, references to Country are as follows:
includes/modules/pages/supplier_registration/header_php.php
Line 33
$country = '';
After if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
Line 61
$country = zen_db_prepare_input($_POST['zone_country_id']);
After // BOF Error Messages
Line 111
if (!zen_not_null($country)) {
$error = true;
$messageStack->add('supplier_registration', 'Please select your country');
}
After //assemble the email contents:
Line 203
'country:' . "\t" . $country . "\n" .
includes/templates/your_template/tpl_supplier_registration_default.php
After <fieldset>
Line 76
<label class="inputLabel" for="country"><?php echo ENTRY_COUNTRY; ?></label>
<?php echo zen_get_country_list('zone_country_id', $selected_country, 'id="country" ') . (zen_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="alert">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?>
What have I done wrong?
TIA
How to add country dropdown that returns the country name, rather than country_id number, in email forms (eg band_signup).
Further to my posts above, I think I have a solution. Although not thoroughly tested, eg text vs html emails, the country name now appears as such in Email Archive Manager. If anyone has a better solution, please post.)
A. In includes\functions\html_output.php, towards the end of the file and immediately before
Code:
/*
* Assesses suitability for additional parameters such as rel=nofollow etc
*/
add
Code:
/*
* Creates a pull-down list of countries names (and extract country name)
*/
function zen_get_country_listname($name, $selected = '', $parameters = '') {
$countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
$countries = zen_get_countries();
for ($i=0, $n=sizeof($countries); $i<$n; $i++) {
$countries_array[] = array('id' => $countries[$i]['countries_name'], 'text' => $countries[$i]['countries_name']);
}
return zen_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
}
Notes A:
1. This code is a copy of the preceeding function zen_get_country_list, except 'countries_id' is replaced by 'countries_name'.
2. There is no override for includes\functions\html_output.php, therefore upon upgrade, the new file may have to be edited accordingly.
3. Ideally this code would be placed in either includes\modules\pages\your_page\header_php.php or includes\templates\your_template\templates\tpl_your_page_default.php, but I am unsure about the placement. Anyone?
B. In includes\modules\pages\your_page\header_php.php, after
Code:
if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
add (or change to)
Code:
$country = zen_db_prepare_input($_POST['countries_name']);
C. In includes\templates\your_template\templates\tpl_your_page_default.php, amongst the list of <labels>
add (or change to)
Code:
<label class="inputLabel" for="country"><?php echo ENTRY_COUNTRY; ?></label>
<?php echo zen_get_country_listname('countries_name', $selected_country, 'id="country"') . (zen_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="alert">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?>
<br class="clearBoth" />
Notes B and C:
1. If adding (rather than replacing) the code from steps B and C, you will need to add the other bits of code as per the above quoted post.
I want to share my custom form with a customer upload
I want to share my custom form with a customer upload. This custom form was made for my sellers to submit their products to us to sell.
1. This uses a custom form created from the "band signup"
2. A popup window created with a generator
3. An additional program called "upload-point"
4. Set up additional check to make sure customer uploads file
5. It emails me that a product is submitted - but requires the customer to enter the file name.
6. It puts the uploaded files in a folder named "files" with the original file name, not a zencart renumbered file name.
7. The popup window asks for the file, then shows the file being uploaded, then is reported that the file has been uploaded successfully.
Take a look creativelearnables.com/index.php?main_page=submit_product . You can try it with a small image or text file to see how it works.
I was just so excited, I had to share.
If anyone is interested in making a form like this, let me know.:clap:
Re: custom forms - data collection
I am interested, particularly the upload file part.
Can only one file be uploaded per form, or can it handle multiple file uploads with (say) advice of the filenames in the comments section?
Does it come with an auto-complete function, for those already with an account?
Re: I want to share my custom form with a customer upload
Sounds great.. Ever give any thought of bundling this up and submitting it as a contribution or even bundling it up and posting it to this thread.. I certainly would be interested in a form like this..