Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Adding additional email alert WordPress

  • REFUNDED

Hi, I am using a template from templatic called 'Emporium'. I will be listing products from different suppliers and would like to alert them when a sale is made for one of their products.

I would like to add an email field to a product post which can be used to send an order confirmation to that address when the product is purchased.

the website is www.todayonlyoffers.com.au

Answers (4)

2010-10-08

Zach Reed answers:

Have you checked out the wp_mail mail function? [[LINK href="http://codex.wordpress.org/Function_Reference/wp_mail"]]http://codex.wordpress.org/Function_Reference/wp_mail[[/LINK]]

It could probably do what you wanted it to do, I think. haha I am more or less trying to help, I don't know if that would do the trick or not.

2010-10-08

Tom Ransom answers:

Include the email address as a custom field for each post. Then when the sale is completed, you have the information need to send a confirmation.

A more specific answer would depend on how you intend to complete the sale.

2010-10-08

Nilesh shiragave answers:

I saw your website. right now when i select a product to purchase it sends me to a page where there is one button called "Send Inquiry". As you want to send additional email when the product get purchased. i didn't get any purchase options on your website? or you want the additional email facility for the "Send Inquiry" page?

And for each product there will be a different email address for inquiry. If yes then we have to add email addresses using custom fields.

Let me know.

2010-10-08

John Cotton answers:

AS Nilsh says, it isn't clear from your site when a sale is "made", so it's hard to be precise about where the code should go.

However, you need three steps:

1. Add a custom field called supplierEmail to each product page/post.
2. Find the point in your code where the product is actually purchased.
3. Drop in some code that looks a bit like this:


$supplierEmail = get_post_meta($post->ID, "supplierEmail", true);

if ($supplierEmail != "") {
$body = "WHATEVER YOU WANT TO PUT IN THE MESSAGE";
wp_mail($supplierEmail, "todayonlyoffers has made a sale!", "<html>" . $body. "</html>", "Content-Type: text/html; charset=ISO-8859-1");
}


I don't know what e-commerce code Emporium uses but you might find a hook that you can use and then put the above code in a function to be called as necessary.

Regards

John