Payment Notification Email

  • Posts: 12
  • Thank you received: 0
11 years 7 months ago #64983

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?

Please Log in or Create an account to join the conversation.

  • Posts: 81566
  • Thank you received: 13075
  • MODERATOR
11 years 7 months ago #65163

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:

<?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: 11 years 7 months ago by nicolas.

Please Log in or Create an account to join the conversation.

  • Posts: 12
  • Thank you received: 0
11 years 7 months ago #65380

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

Please Log in or Create an account to join the conversation.

  • Posts: 81566
  • Thank you received: 13075
  • MODERATOR
11 years 7 months ago #65602

Yes, that's correct.

Please Log in or Create an account to join the conversation.

  • Posts: 12
  • Thank you received: 0
11 years 7 months ago #65671

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

Please Log in or Create an account to join the conversation.

  • Posts: 81566
  • Thank you received: 13075
  • MODERATOR
11 years 7 months ago #65882

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;
?>

Please Log in or Create an account to join the conversation.

  • Posts: 12
  • Thank you received: 0
11 years 7 months ago #65972

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

Attachments:

Please Log in or Create an account to join the conversation.

Time to create page: 0.077 seconds
Powered by Kunena Forum