I would like to add drop-down country list in Contact Us page. Not sure how to do that.
Now, I have copied contact_us.php in to templates/override and copy Full Name div and changed to Country. So I only have input field for Country not dropdown.
Drop-down country list in Contac Us
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Drop-down country list in Contac Us
You can see an example with a dropdown at https://github.com/CE-PhoenixCart/Phoen ... L182..L187
Code: Select all
$input = new Select($name, array_merge(
[['id' => '', 'text' => PULL_DOWN_DEFAULT]],
$GLOBALS['db']->fetch_all("SELECT countries_id AS id, countries_name AS text FROM countries")
));Re: Drop-down country list in Contac Us
@ecartz Thank you very much. I can add drop-down country list in Contac Us and also include country name in email which send from contact_us.php
For email which send from contact_us.php.
According to https://github.com/CE-PhoenixCart/Phoen ... y-to-email, I have set E-Mail From: noreply@mysite.com. And in email.php I have added my email in Reply-To. So Reply-To have 2 email addresses, my email and customer email
How to set send the mail to 2 email addresses, my email and customer email.
For email which send from contact_us.php.
According to https://github.com/CE-PhoenixCart/Phoen ... y-to-email, I have set E-Mail From: noreply@mysite.com. And in email.php I have added my email in Reply-To. So Reply-To have 2 email addresses, my email and customer email
How to set send the mail to 2 email addresses, my email and customer email.
- burt
- Core Team
- Posts: 4550
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: Drop-down country list in Contac Us
You may have been able to do this with a Hook (rather than using a template file).
I'll try to make such a hook as it'll be good to see how it could (in theory) be done (obviously if it does then work, the hook could be replicated to add in other data to the contact_us form).
If I make it, I'll upload it to this thread for testing.
I'll try to make such a hook as it'll be good to see how it could (in theory) be done (obviously if it does then work, the hook could be replicated to add in other data to the contact_us form).
If I make it, I'll upload it to this thread for testing.
I am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.
- burt
- Core Team
- Posts: 4550
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: Drop-down country list in Contac Us
Add similar after this piece:
// to store owner from customer
Notifications::mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, sprintf(EMAIL_SUBJECT, STORE_NAME), $enquiry, $name, $email_address);
as so:
// to customer from store owner
Notifications::mail($name, $email_address, sprintf(EMAIL_SUBJECT, STORE_NAME), $enquiry, $name, $email_address, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
I don't quite see why the customer would need to have an email sent to them containing the data they just gave you, as they probably know what they wrote
I am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Drop-down country list in Contact Us
The easiest way is to send two copies of the email, like checkout and newsletters do.
But it's a bad idea to set up your Contact Us form to send emails to an email address entered in the form. Because that means that a spammer can use your form to send emails as if they were from you. It works during checkout because
1. The prospective spammer can't enter arbitrary content.
2. It requires a payment. And a spammer won't want to waste a perfectly good stolen credit card on sending a single spam email.
The Contact Us form does accept arbitrary content and doesn't require registration much less an order payment. It should not send to the customer (except possibly a form email like "Thank you for submitting a message.").
- burt
- Core Team
- Posts: 4550
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: Drop-down country list in Contac Us
Hook, completely untested, but looks like it should work to add the "Customer Location" to the email.
Note:
I am not saying this is the right way or the best way to add in extra data to the email.
It is simply a way that you may or may not have thought of.
Note:
I am not saying this is the right way or the best way to add in extra data to the email.
It is simply a way that you may or may not have thought of.
You do not have the required permissions to view the files attached to this post.
I am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.
Re: Drop-down country list in Contac Us
@ecartz Thank you very much for your explanation. I haven't thought about it.But it's a bad idea to set up your Contact Us form to send emails to an email address entered in the form. Because that means that a spammer can use your form to send emails as if they were from you.
@burt It worked like a charm! I never thought to use a hook this way.Hook, completely untested, but looks like it should work to add the "Customer Location" to the email.
In email the "Customer Location" show under the enquiry, is it possible to move it up to show before enquiry.
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Drop-down country list in Contac Us
Change to
Code: Select all
return $GLOBALS['enquiry'] = sprintf(CUSTOMERS_LOCATION, Country::fetch_name(Text::input($_POST['country']))) . $GLOBALS['enquiry'];Code: Select all
return $GLOBALS['enquiry'] = sprintf(CUSTOMERS_LOCATION, $GLOBALS['enquiry'], Country::fetch_name(Text::input($_POST['country'])));Code: Select all
const CUSTOMERS_LOCATION = "Customers Location: %2$s\n\n%1$s";