- Posts: 12
- Thank you received: 0
Payment Notification Email
14 years 2 weeks ago #64983
by smeako
Payment Notification Email was created by smeako
Hi Guys,
I have a Hikashop set up for my cricket club with no registration requirement to purchase products. I do have a custom field for email in all products which is mandatory and would like to send the purchaser a confirmation email to the address entered in this field if they have selected bank transfer as a payment method.
Site address is www.diggerscc.com.au if that helps.
How do I achieve this?
I have a Hikashop set up for my cricket club with no registration requirement to purchase products. I do have a custom field for email in all products which is mandatory and would like to send the purchaser a confirmation email to the address entered in this field if they have selected bank transfer as a payment method.
Site address is www.diggerscc.com.au if that helps.
How do I achieve this?
Please Log in or Create an account to join the conversation.
14 years 2 weeks ago - 14 years 2 weeks ago #65163
by nicolas
Replied by nicolas on topic Re: Payment Notification Email
Hi,
You will have to edit the order creation notification email via the menu System->Emails and add that code at the end of the HTML version:
You will have to edit the order creation notification email via the menu System->Emails and add that code at the end of the HTML version:
Code:
<?php
$email = '';
foreach($data->products as $product){
if(!empty($product->email)){
$email = $product->email;
break;
}
}
if(!empty($email) && $data->order_payment_method=='banktransfer') $data->customer->user_email = $email;
?>
Last edit: 14 years 2 weeks ago by nicolas.
Please Log in or Create an account to join the conversation.
14 years 2 weeks ago #65380
by smeako
Replied by smeako on topic Re: Payment Notification Email
Hi Nicolas,
Thank you for your quick response. I have found the HTML Version code to modify and placed the code at the end. I'm not sure whether I have put it in the correct place or not though or whether I need to modify it in any way. This is what the bottom of the HTML version file now looks like.
<td height="10">
</td>
</tr>
</tbody>
</table>
</div>
<?php
$email = '';
foreach($data->products as $product){
if(!empty($product->email)){
$email = $product->email;
break;
}
}
if(!empty($email) && $data->order_payment_method=='banktransfer') $data->customer->user_email = $email;
?>
Have I placed the code in the corret place?
Thank you
Thank you for your quick response. I have found the HTML Version code to modify and placed the code at the end. I'm not sure whether I have put it in the correct place or not though or whether I need to modify it in any way. This is what the bottom of the HTML version file now looks like.
<td height="10">
</td>
</tr>
</tbody>
</table>
</div>
<?php
$email = '';
foreach($data->products as $product){
if(!empty($product->email)){
$email = $product->email;
break;
}
}
if(!empty($email) && $data->order_payment_method=='banktransfer') $data->customer->user_email = $email;
?>
Have I placed the code in the corret place?
Thank you
Please Log in or Create an account to join the conversation.
14 years 2 weeks ago #65602
by nicolas
Replied by nicolas on topic Re: Payment Notification Email
Yes, that's correct.
Please Log in or Create an account to join the conversation.
14 years 1 week ago #65671
by smeako
Replied by smeako on topic Re: Payment Notification Email
Thanks nicolas,
It looks like it is now trying to send the email but now getting this message.
"You must provide at least one recipient email address."
Any ideas on that one.
Cheers
It looks like it is now trying to send the email but now getting this message.
"You must provide at least one recipient email address."
Any ideas on that one.
Cheers
Please Log in or Create an account to join the conversation.
14 years 1 week ago #65882
by nicolas
Replied by nicolas on topic Re: Payment Notification Email
Mmm. I'm not sure.
Maybe you should try with another variable name in order to avoid overwriting another variable with the same name :
<?php
$sendingEmail = '';
foreach($data->products as $product){
if(!empty($product->email)){
$sendingEmail = $product->email;
break;
}
}
if(!empty($sendingEmail) && $data->order_payment_method=='banktransfer') $data->customer->user_email = $sendingEmail;
?>
Maybe you should try with another variable name in order to avoid overwriting another variable with the same name :
<?php
$sendingEmail = '';
foreach($data->products as $product){
if(!empty($product->email)){
$sendingEmail = $product->email;
break;
}
}
if(!empty($sendingEmail) && $data->order_payment_method=='banktransfer') $data->customer->user_email = $sendingEmail;
?>
Please Log in or Create an account to join the conversation.
14 years 1 week ago #65972
by smeako
Replied by smeako on topic Re: Payment Notification Email
Hi nicolas,
I now have this code at the bottom of the html version file
</td>
</tr>
</tbody>
</table>
</div>
<?php
$sendingEmail = '';
foreach($data->products as $product){
if(!empty($product->email)){
$sendingEmail = $product->email;
break;
}
}
if(!empty($sendingEmail) && $data->order_payment_method=='banktransfer') $data->customer->user_email = $sendingEmail;
?>
I no longer get the error message but still don't get an email. I get the attached screen after checkout which is correct but no email.
I have now set up a new custom field with the type "item" and column name "sendingemail" and published that. I have also attached a list of my custom fields.
If I unpublish my original email field - type "item" and column name "email" the error returns so I now have 2 email fields showing in the product screen.
Sorry to hassle but just can't work out why this email won't send. I have also tried changing the text in the html version to lower case as the feild column name defaults to lower case when you create it.
Thanks
I now have this code at the bottom of the html version file
</td>
</tr>
</tbody>
</table>
</div>
<?php
$sendingEmail = '';
foreach($data->products as $product){
if(!empty($product->email)){
$sendingEmail = $product->email;
break;
}
}
if(!empty($sendingEmail) && $data->order_payment_method=='banktransfer') $data->customer->user_email = $sendingEmail;
?>
I no longer get the error message but still don't get an email. I get the attached screen after checkout which is correct but no email.
I have now set up a new custom field with the type "item" and column name "sendingemail" and published that. I have also attached a list of my custom fields.
If I unpublish my original email field - type "item" and column name "email" the error returns so I now have 2 email fields showing in the product screen.
Sorry to hassle but just can't work out why this email won't send. I have also tried changing the text in the html version to lower case as the feild column name defaults to lower case when you create it.
Thanks
Please Log in or Create an account to join the conversation.
Time to create page: 0.184 seconds