This Function Has Been Available Since:|
(AFCommerce v 2.1, Functions v 1.1)
string = afc_create_product_receipt (id)
This function is used to create a receipt for the current basket session for the current user on your website. I created this function to be used to send an email receipt to the store owner in case there is an error while processing the payment and the order is lost. Paypal's standard payment gateway requires the customer to push the "return to merchant" button to return to your website for the order to be stored in your database. Any 3rd party gateway like this example will have the same problem, and I will add another feature for Paypal using their "Instant Payment Notification" or IPN for short, which would fix this problem. Other 3rd party gateways do not have an option like this, so this function was necessary to send the receipt to the store owner in case there is a problem like this.
So for now, this function is only used in the "processcheckout.php" file, and only if you turn on the feature called "paypal_send_order_email_before_payment" on the advanced options page in the admin area. If your store starts receiving a lot of orders, and your accepting payments online (not check or money order, or any creative methods of payment you come up with on your own), you should really use some type of on site payment gateway, like the Verisign Payflow Pro (now owned by PayPal), or Paypal's new Website Payments Pro payment gateway. These gateways make the actual credit card transaction happen on your website instead of a 3rd party's website (like 2checkout.com) where the transaction happens on their website, and the customer must return to your website for the order to be processed. All shopping carts have this same problem when it comes to 3rd party gateways.
It is also important to not that this function creates the receipt in a format made for an email, which is NOT in html. If you wish to display this receipt in one of your scripts as html, you can simple add the "pre" html tag before you print the receipt to the page, and close the "pre" tag after the receipt. *** This function is NOT the function used to create the real receipts that are created in processpayment.php, which is where the actual order is processed. That order receipt is MUCH better and also adds the order to your database, while this function DOES NOT.
id (integer) - Anytime you see this variable being passed to a function, all you need to do is simply use the variable $id, which is automatically set for you when dbinfo.php is called.
This function returns a receipt for all of the current user's shopping basket's products.
Open Source: Yes
There are currently no examples for this function.
Back to Functions List