Safir Hosting Posted July 15, 2022 Share Posted July 15, 2022 Hello All, There are some laws like GDPR here in Turkey and we need to auto create and auto fill some agreements on checkout of an order. Can we achieve this? Example Below Service Provider Information Seller Name : ISP Name (fixed data) Seller Address : ISP Address (fixed data) Seller Phone : ISP Phone (fixed data) Seller Fax : ISP Fax (fixed data) Seller e-Mail : ISP Mail (fixed data) Customer Information Customer Name : Need to autofill with Client Information or Contact Information that client selected on checkout page Customer Address : Need to autofill with Client Information or Contact Information that client selected on checkout page Customer Phone : Need to autofill with Client Information or Contact Information that client selected on checkout page and also need to anonymize e-Mail/UserName : Need to autofill with Client Information or Contact Information that client selected on checkout page and also need to anonymize Billing Information Name/Surname/Company Name : Need to autofill with Client Information or Contact Information that client selected on checkout page Tax Office and Tax Number : Need to autofill with custom text area from Client Information or Contact Information that client selected on checkout page and also need to anonymize Customer Adress : Need to autofill with Client Information or Contact Information that client selected on checkout page Customer Phone : Need to autofill with Client Information or Contact Information that client selected on checkout page and also need to anonymize e-Mail/UserName : Need to autofill with Client Information or Contact Information that client selected on checkout page and also need to anonymize CONTRACTUAL SERVICE AND PRODUCT INFORMATION The main features of the Product and Service are available on the Website. The sales price of the product and service subject to the contract, including all taxes, is shown in the table below. If the campaign is organized by the PROVIDER, you can review the basic features of the relevant Service during the campaign. The prices listed and announced on the Website are the selling price. Advertised prices and promises are valid until updated and changed. Prices announced for a period of time are valid until the end of the specified period. Product Name : Need to autofill from cart - if there are more than one products need to be rows Quantity : Need to autofill from cart - if there are more than one products need to be rows Unit Price : Need to autofill from cart - if there are more than one products need to be rows Total (with TAX) : Need to autofill from cart - if there are more than one products need to be rows *** If the product will be shipped, the shipping fee, which is the shipping cost, will be paid by the Client. Shipping Address : Need to autofill with Client Information or Contact Information that client selected on checkout page Shipped To : Need to autofill with Client Information or Contact Information that client selected on checkout page Billing Address : Need to autofill with Client Information or Contact Information that client selected on checkout page Order Date : Need to autofill with Checkout Date Delivery Method : (fixed data) Any Help Appreciated 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Technical Analyst WHMCS JoshQ Posted March 27, 2023 WHMCS Technical Analyst Share Posted March 27, 2023 Hi @Safir Hosting, Assuming that you are wanting to send this out automatically for each order (after successful payment), your best option would be to use the Other Product/Service Welcome Email template, as you have suggested. You can read more about Email Templates here:https://docs.whmcs.com/Email_Templates All of the merge fields that you require are available. You can see a full list of the available merge fields at the bottom of the page when editing any email templates. If you need to send this email under separate cover, this can be done by making use of the AcceptOrder hook (triggers your code when an order is accepted), and the SendEmail API endpoint. You would also need to create a new email template specifically for this purpsoe, which can be done via System Settings > Email Templates. AcceptOrder hook: https://developers.whmcs.com/hooks-reference/shopping-cart/#acceptorder SendEmail API endpoint: https://developers.whmcs.com/api-reference/sendemail/ Implementing this is not something that our team can help you with, as it would be considered a third-party customisation, however the workflow would work like this: Customer places order Order is accepted (either automatically or manually by an admin) AcceptOrder hook is fired, sending a SendEmail request via the internal API Customer receives custom email notification I'm sure that all the brilliant people in the Developer Corner would be happy to help you should you get stuck!https://whmcs.community/forum/41-developer-corner/ Hope this helps 🙂 0 Quote Link to comment Share on other sites More sharing options...
Safir Hosting Posted June 12, 2023 Author Share Posted June 12, 2023 Hello, we tried something and seems not worked. Can you help me, <?php add_hook('OrderPaid', 1, function($vars) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://www.safirhosting.com/includes/api.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array( 'action' => 'SendEmail', // See https://developers.whmcs.com/api/authentication 'username' => 'ApiUserName', 'password' => 'ApiPassword', '//example1' => 'example', 'messagename' => 'Mesafeli Satış Sözleşmesi', 'id' => '1', '//example2' => 'example', 'customtype' => 'product', '//customsubject' => 'Mesafeli Satış Sözleşmesi', '//custommessage' => '<p>Thank you for choosing us</p><p>Your custom is appreciated</p><p>{$custommerge}<br />{$custommerge2}</p>', '//customvars' => base64_encode(serialize(array("custommerge"=>$populatedvar1, "custommerge2"=>$populatedvar2))), 'responsetype' => 'json', ) ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); curl_close($ch); }); 0 Quote Link to comment Share on other sites More sharing options...
andrezzz Posted June 13, 2023 Share Posted June 13, 2023 Hello @Safir Hosting, If you need any help, please don't hesitate dm me 😉 See you soon. 0 Quote Link to comment Share on other sites More sharing options...
Safir Hosting Posted June 13, 2023 Author Share Posted June 13, 2023 I Have done this with perfection by Pete Murphy. Here is the solution that need extra help, I think we can send unlimited information mails with this but be careful on email template group that used, not auto filling some areas. <?php add_hook('AcceptOrder', 1, function($vars) { $command = 'SendEmail'; $postData = array( 'messagename' => 'E-Mail Template Name Here', 'id' => '1', ); $results = localAPI($command, $postData); }); 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.