Tips and Tricks HQ Forum

Support Forum for Tips and Tricks HQ Products

Register or log in - lost password?

Search the Forum

Tips and Tricks HQ Forum » WP eStore Forum » WP eStore Tweaks

Manual checkout to send-out Purchase Email

(20 posts) (3 voices)
  • Started 2 years ago by André Lundin
  • Latest reply from amin007
  • Related Topics:
    1. How to make a Free Download?
    2. Manual Checkout / Status: Unpaid / don't send registration-link
    3. Populate Manual Checkout From from eMember data
    4. Manual Checkout And Affiliate Commissions
    5. Any way to have the manual checkout add tax?

Tags:

  • customer email
  • free download
  • manage customers
  • Manual Checkout
  • md5
  • stats
12Next »
  1. André Lundin
    Member

    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

    Posted 2 years ago #
  2. amin007
    Key Master

    It'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['item_number'];
    $product_name = $item['name'];
    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.

    Posted 2 years ago #
  3. André Lundin
    Member

    Great! 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

    Posted 2 years ago #
  4. amin007
    Key Master

    Basically 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.

    Posted 2 years ago #
  5. André Lundin
    Member

    Hi!

    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['first_name'];
    $lastname = $this->ipn_data['last_name'];
    $emailaddress = $this->ipn_data['payer_email'];
    $sale_price = $current_cart_item['mc_gross'];

    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

    Posted 2 years ago #
  6. amin007
    Key Master

    Exact 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.

    Posted 2 years ago #
  7. André Lundin
    Member

    Ok, 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['item_number'];
    $current_product_id = $cart_item_data_num;

    But that didn't help :P

    Any thoughts?

    Best Regards
    André Lundin

    Posted 2 years ago #
  8. André Lundin
    Member

    Nevermind 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

    Posted 2 years ago #
  9. amin007
    Key Master

    You 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.

    Posted 2 years ago #
  10. André Lundin
    Member

    Awesome!

    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

    Posted 2 years ago #

RSS feed for this topic

12Next »

Reply »

You must log in to post.

Tips and Tricks HQ Forum is proudly powered by bbPress

Tips and Tricks HQ  | WP Shopping Cart  | WP Affiliate Software  | WordPress Membership Plugin