Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Tweaks › Manual checkout to send-out Purchase Email
Tagged: customer email, free download, manage customers, Manual Checkout, md5, stats
- This topic has 19 replies, 3 voices, and was last updated 14 years, 4 months ago by amin007.
-
AuthorPosts
-
January 19, 2010 at 9:48 pm #673André LundinMember
Hi there! I am currently only using “Manual Checkout” cause I only want to accept invoices as payments.
After I make a “payment” with Manual Checkout, both Buyer and Seller get an email with some information from the “eStore_payment_submission.php” file, regarding some details of the purchase.
But Manual Checkout never sends the email with the encrypted download link (security measure I guess).
I don’t want anything to stop the customer from “taking the product and not paying” atm – as the customer has to register before he can buy anything, inputing all his company details (wich has to be confirmed) so I can invoice him AFTER I see that he made a purchase.
(This is just because the customers we are working with, wants the product immediately and only accepts invoices.)
Could you advise me on how to make the Manual Checkout send out the Purchase Email anyway? (similar to the paypal function)
Or maybe let the “Payment Gateway Settings -> Manual Checkout -> Directions for the Customer” accept tags like: {product_name}, {product_link} and so on.. so I can get the encrypted URL in the manual purchase details email.
Thank you for your help
Best Regards
André Lundin
January 19, 2010 at 11:40 pm #17360amin007ParticipantIt’s better to use the forum for any Tips and Tricks HQ premium products (I get too many comments from all posts of my blog and it can easily get lost).
I understand your requirement and yes it can be done. I am going to give you some guidelines here on how you can do it.
In the “eStore_process_payment_data.php” file look at the “submit_to_manual” function and there is a loop that loops through the items and puts the item details to a string so it can be added to the body of the email later.
in side this loop you can add the following bit of code to generate the download link:
$id=$item;
$product_name = $item;
global $wpdb;
$products_table_name = $wpdb->prefix . “wp_eStore_tbl”;
$retrieved_product = $wpdb->get_row(“SELECT * FROM $products_table_name WHERE id = ‘$id'”, OBJECT);
$download_link = generate_download_link($retrieved_product,$product_name);
The variable “$download_link” will have the encrypted link which you can add to the email body so the customer gets it in the email.
January 20, 2010 at 11:27 am #17361André LundinMemberGreat! Thank you, it works flawless!
Now, I’m not sure how the Customer List works? Do we have to add each customer manually?
Or would there be any way to automatically add the customer to the Customer List?
So we can Edit/Manage Customers and check their WP eStore Stats to track # of purchases?
Best Regards
André Lundin
January 21, 2010 at 12:50 am #17362amin007ParticipantBasically most of the work that happens automatically after the post payment verification in the event of confirmed payment will need to be manually done for manual checkout. The reason is that the plugin has no way of confirming a manual payment.
In your setup you said that you don’t care about payment confirmation so you can probably do all the post payment stuff in the manual checkout code. Simply have a look at the “paypal.php” file (around line 401) and see what it does then you can copy some of those code.
January 21, 2010 at 1:45 pm #17363André LundinMemberHi!
First of all, thank you for helping me with this problem, as I’m sure you have more “crtitical” matters to attend to.
I looked up the code around line 401 in “paypal.php”, example:
// Update the Customer table
$firstname = $this->ipn_data;
$lastname = $this->ipn_data;
$emailaddress = $this->ipn_data;
$sale_price = $current_cart_item;
and I tried to paste it in “eStore_payment_submission.php” after:
function submit_to_manual()
{
Thought it’d be “that simple”, but alas, no success
I can’t actually say I’m a PHP guru, so I’m not really sure how much code i need to copy&paste to make it work.
Would you mind being a bit more specific on what code I need to copy and where I need to paste it?
I’d also gladly let you look at my code, to make this work, if you want and have the time.
Best Regards
André Lundin
January 22, 2010 at 2:36 am #17364amin007ParticipantExact copy and paste is not going to work here as you will need to populate the values of the variable.
For example this piece of code inserts the data into the database but you will need to fill in the values (eg. $firstname, $lastname):
global $wpdb;
$customer_table_name = $wpdb->prefix . “wp_eStore_customer_tbl”;
$updatedb = “INSERT INTO $customer_table_name (first_name, last_name, email_address, purchased_product_id,txn_id,date,sale_amount) VALUES (‘$firstname’, ‘$lastname’,’$emailaddress’,’$current_product_id’,’$transaction_id’,’$clientdate’,’$sale_price’)”;
$results = $wpdb->query($updatedb);
So basically you need to see what that script does then use the same logic to achieve what you want in your scenario.
January 22, 2010 at 3:13 am #17365André LundinMemberOk, I can manage to get the firstname, lastname, and email by writing:
global $current_user;
get_currentuserinfo();
And pasting:
$current_user->user_firstname
$current_user->user_lastname
$current_user->user_email
into the corresponding VALUES.
But I have no idea how to get the: $current_product_id, $transaction_id, $clientdate and $sale_price.
I tried pasting:
$cart_item_data_num = $current_cart_item;
$current_product_id = $cart_item_data_num;
But that didn’t help
Any thoughts?
Best Regards
André Lundin
January 22, 2010 at 3:42 am #17366André LundinMemberNevermind that previous post, I looked up the other tags in eStore_payment_submission.php and found them.
All I am missing now is the $transaction_id, but I guess that’s not being created since I’m using a Manual Checkout? Not that big deal anyway..
Would there be anyway for the purchases to show up on “Stats” aswell? (guess it’s about the same procedure?)
Best Regards
André Lundin
January 22, 2010 at 3:57 am #17367amin007ParticipantYou will need to go through the other file that I mentioned earlier and add whatever post payment stuff you want to do in your manual checkout case.
January 22, 2010 at 4:14 am #17368André LundinMemberAwesome!
I noticed I only had to add $updatedb2 with $sales_table_name and corresponding values to the loop.
Seems I got it all figured out now, thanks to you!
I’m sure there are lots of things that still can be tweaked for Manual Checkout, but I’ll let that rest for now.
Consider this thread closed!
Cheers
André Lundin
June 25, 2010 at 6:24 pm #17369MikeDMemberI have a similar situation, but I can’t get the above instructions to work. Hopefully you can help.
I am building a members-only site. It’s free to become a member, then free to buy any product. I’m using the manual checkout and I want the download links to be in the email to the customer.
In the eStore_process_payment_data.php file there is no “submit_to_manual” function, but it is in eStore_payment_submission.php. In which file do I put your code?
I tried putting your code in eStore_payment_submission.php, but I couldn’t get it to work. What line do I put it in? Can you show me a line of code that I can search for and put the new code after it?
Thank you!
June 26, 2010 at 1:38 am #17370amin007ParticipantRemember, sometimes these manual tweaks get outdated as the new version of the plugin gets released where more code has been added.
Which version of the plugin are you using? What are you exactly trying to do?
June 28, 2010 at 3:15 pm #17371MikeDMemberI’m using WP eStore Version v3.0.4 with WordPress 3.0.
I’m building a site that is a corporate document management tool. The entire WP site is members only. Logged in users can download any document for free. The store is being used because the user might not be at their own computer, so instant download isn’t always appropriate. The user will add files to their shopping cart, then have the download links emailed to them (and instant download will be offered).
I need the store to work as usual, but automatic processing without any payment. The previous poster seemed to have the solution, but it didn’t work for me. Can you help me with any code that might have changed?
As with the previous poster, I also want the transactions to appear in “Stats” and “Manage Customers”.
Thanks!
June 29, 2010 at 3:26 am #17372amin007ParticipantI have added an option in the manual checkout so the customers can get added to the database after checkout automatically.
I will add this other option to the plugin so links can get sent out for manual checkout too. Give me a few days and I will be able to give you an update with these features.
June 29, 2010 at 5:05 pm #17373MikeDMemberamin007,
Thank you for your excellent technical support.
I look forward to using the new features!
-
AuthorPosts
- You must be logged in to reply to this topic.