Something like:
Hello {NAME},
We have great products.
Regards,
philbydevil
{NAME} = customer's first name
I tried : http://forum.opencart.com/viewtopic.php ... il#p123544 but didn't have any luck.
Thanks.
EDIT-SOLVED: this is now a VQMod so you don't have to edit your core file: viewtopic.php?f=121&t=26380
I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1
Sounds a bit more professional (and less like a scam) if the email has their name on it.
If there's no mod/extension already done then I'll just do a nameless email.
I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1
I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1
I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1
It's so seems close....
I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1
5 posts and many self-linked questions...
give us an URLs where you trying to do some actions.
describe what actions you trying to do...
and better in step-by-step form, i.e.:
1) what you have (URL || files || code)
2) what you going to apply/change (buttons/links clicked || new code blocks used)
3) what should you get (describe expected result)
4) what you got instead (describe what you've got in real)
Русское коммьюнити разработчиков OpenCart - myopencart.ru
some useful mods:
[Released] Orders and Comments AT-A-GLANCE, [Released] Prof. Invoice and Packingslip, [Released] Recently viewed
My commercial modules: [W]ebme Compare Products, [W]ebme Bought With This
http://forum.opencart.com/viewtopic.php ... il#p123544
But here it is in relation to your questions:
1. File: admin/controller/sale/contact.php (file is attached to other thread). Code: see other thread.
2. See other thread. No buttons/links changed. I didn't make the original changes to the code. I did however, modify the code listed on that thread. What I did was change all instances of 'name' to 'firstname', and merged it with my current (1.4.9.3) contact.php file (this is the file that is attached to that thread).
3. When writing an email, if you type in {NAME}, the email sent will change this to the customers first name. If you type in {EMAIL} it will change it to the customer's email address (these are usually known as "fields" in mail merge applications).
4. {NAME} and {EMAIL} both work, but when sending to multiple contact, only the first contact/customer on the list actually receives the email. When sending to one contact, it works fine.
So, the mail merge ({NAME}/{EMAIL) is working correctly. The only bug is that of sending to multiple contacts/customers. Thanks.
I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1
Code: Select all
// Prevent Duplicates
$emails = array_unique($emails);
if ($emails) {
$MailTitle = $this->request->post['subject'];
$message = '<html dir="ltr" lang="en">' . "\n";
$message .= '<head>' . "\n";
$message .= '<title>{TITLE}</title>' . "\n";
$message .= '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">' . "\n";
$message .= '</head>' . "\n";
$message .= '<body>' . html_entity_decode($this->request->post['message'], ENT_QUOTES, 'UTF-8') . '</body>' . "\n";
$message .= '</html>' . "\n";
$attachments = array();
if (preg_match_all('#(src="([^"]*)")#mis', $message, $matches)) {
foreach ($matches[2] as $key => $value) {
$filename = md5($value) . strrchr($value, '.');
$path = rtrim($this->request->server['DOCUMENT_ROOT'], '/') . parse_url($value, PHP_URL_PATH);
$attachments[] = array(
'filename' => $filename,
'path' => $path
);
$message = str_replace($value, 'cid:' . basename($filename), $message);
}
}
foreach ($emails as $email) {
$TmpTitle = $MailTitle;
$TmpBody = $message;
$TmpTitle = str_replace("{NAME}",$email["firstname"],$TmpTitle);
$TmpTitle = str_replace("{EMAIL}",$email["email"],$TmpTitle);
$TmpBody = str_replace("{NAME}",$email["firstname"],$TmpBody);
$TmpBody = str_replace("{EMAIL}",$email["email"],$TmpBody);
$TmpBody = str_replace("{TITLE}",$TmpTitle,$TmpBody);
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->hostname = $this->config->get('config_smtp_host');
$mail->username = $this->config->get('config_smtp_username');
$mail->password = $this->config->get('config_smtp_password');
$mail->port = $this->config->get('config_smtp_port');
$mail->timeout = $this->config->get('config_smtp_timeout');
$mail->setTo($email['email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($store_name);
$mail->setSubject($TmpTitle);
foreach ($attachments as $attachment) {
$mail->addAttachment($attachment['path'], $attachment['filename']);
}
$mail->setHtml($TmpBody);
$mail->send();
}
}
From:
Code: Select all
foreach ($results as $result) {
$emails[$result['customer_id']] = $result['email'];
}
Code: Select all
foreach ($results as $result) {
$emails[] = array(
'firstname' => $result['firstname'],
'email' => $result['email']
);
}
From:
Code: Select all
if ($customer_info) {
$emails[] = $customer_info['email'];
}
}
}
Code: Select all
if ($customer_info) {
$emails[] = array(
'firstname' => $customer_info['firstname'],
'email' => $customer_info['email']
);
//$emails[] = $customer_info['email'];
}
}
}
I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1
tell me (or give me a screenshot) what options (see my attached screenshot) are you choosing on that page
Attachments
oc_admin.sale.contact_form_001.png (97.08 KiB) Viewed 9981 times
Русское коммьюнити разработчиков OpenCart - myopencart.ru
some useful mods:
[Released] Orders and Comments AT-A-GLANCE, [Released] Prof. Invoice and Packingslip, [Released] Recently viewed
My commercial modules: [W]ebme Compare Products, [W]ebme Bought With This
As mentioned above, I can get it to work with 1 customer/email, but when I add any additional customers through "Search", only the first customer will receive the email. I am unable to test "To: All Customers" or any other way as this is a live store.
It does really need to work with all ways of sending emails:
"Search" for customer/email address
OR
"To: All Customers"
OR
"To: All Newsletter Subscribers"
OR
"To customers who have ordered Products"
I have been attempting to modify all ways, but can only test the way it's being done in my screenshot, as I'm working with a live store.
Your help is appreciated.
I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1
{NAME} and {EMAIL} still work.
So it seems that the coding problem may actually be related to the parts above that I thought it wasn't related to.
I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1
Code: Select all
// Prevent Duplicates
$emails = array_unique($emails);
so, all file need to be rewrited.
it would be better to use this style of getting emails-array
Code: Select all
$emails[$result['email']] = array(
'firstname' => $result['firstname']
);
Code: Select all
$emails[] = array(
'firstname' => $result['firstname'],
'email' => $result['email']
);
Русское коммьюнити разработчиков OpenCart - myopencart.ru
some useful mods:
[Released] Orders and Comments AT-A-GLANCE, [Released] Prof. Invoice and Packingslip, [Released] Recently viewed
My commercial modules: [W]ebme Compare Products, [W]ebme Bought With This
I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1
So here is my last variant:
Code: Select all
$customers = $emails;
$emails = array();
foreach($customers as $customer) {
if (!in_array($customer['email'], $emails)) {
$emails[$customer['email']] = array(
'firstname' => $customer['firstname'],
'email' => $customer['email']
);
}
}
// Prevent Duplicates
//$emails = array_unique($emails);
Not counting two commented out debug_prints
Attachments
Русское коммьюнити разработчиков OpenCart - myopencart.ru
some useful mods:
[Released] Orders and Comments AT-A-GLANCE, [Released] Prof. Invoice and Packingslip, [Released] Recently viewed
My commercial modules: [W]ebme Compare Products, [W]ebme Bought With This
I've tested the changes on my live store (v1.4.9.3) and it is working for:
"Search" for customer/email address
"To: All Customers"
"To: All Newsletter Subscribers"
Haven't tested for:
"To customers who have ordered Products"
But I am confident that it will work.
For those that want to use this modification, here are the fields to use in your emails:
{NAME} = customer's first name
{EMAIL} = customer's email address
{TITLE} = subject of email (ie. the subject that you enter when composing the email)
Example:
Dear {NAME},
Your registered email address is: {EMAIL}
Thanks,
Store Owner
I don't know when you would actually use the {TITLE} field, but it was in the code from the other thread.
Thanks again afwollis!
I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1
{SURNAME} = customer's last name
Updated file attached. Just rename to contact.php and upload to admin/controller/sale
Make sure you back up first.
Thanks again to afwollis for getting this to work!
Attachments
I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1
OpenCart v1.4.9.4
VQMod | Categories Home | Cleaner By Default - 2 Column | Speak Good English
Both files in this thread are working copies.
I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1
OpenCart v1.4.9.4
VQMod | Categories Home | Cleaner By Default - 2 Column | Speak Good English
EDIT: this is now a VQMod so you don't have to edit your core file: http://forum.opencart.com/viewtopic.php?f=121&t=26380
I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1
Users browsing this forum: Ahrefs [Bot] and 151 guests