graziano_68 Posted July 3, 2019 Share Posted July 3, 2019 Hello suppose I have a product ID 5 and a product ID 6 and I want redirect the customer after the payment to a custom link who order the product ID5 should be redirected to page5.html (after the payment) who order the product ID6 should be redirected to page6.html (after the payment) how to do this please ? Thank you 0 Quote Link to comment Share on other sites More sharing options...
graziano_68 Posted July 5, 2019 Author Share Posted July 5, 2019 how much time to see this post live please ? 0 Quote Link to comment Share on other sites More sharing options...
WHMCS ChrisD Posted July 5, 2019 Share Posted July 5, 2019 @granziano_68 this post went live 12 hours after you posted it and has been visable since then 0 Quote Link to comment Share on other sites More sharing options...
graziano_68 Posted July 5, 2019 Author Share Posted July 5, 2019 Hello, thanks for reply, I'm asking because I am still seeing this (right now I am seeing it) " Your content will need to be approved by a moderator. This happens within 24 - 48 hours and applies for your first few posts, usually no more than 10. Please note the moderators cannot remove this moderation step you must go thru this like all other community users. " 0 Quote Link to comment Share on other sites More sharing options...
graziano_68 Posted July 5, 2019 Author Share Posted July 5, 2019 BTW I understood that what I asked in the first post is not possible (since it was moved in dev corner). Anyone knows if exists a WHMCS plugin which permits to do that ? Thank you 0 Quote Link to comment Share on other sites More sharing options...
WHMCS ChrisD Posted July 5, 2019 Share Posted July 5, 2019 @graziano_68 Yes, that message appears above the compose because because anything you post is moderated as it says this applies for your first few posts, usually no more than 10. 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted July 19, 2019 Share Posted July 19, 2019 (edited) Use this hook point. You'll need to use invoiceid parameter to perform a query to look for your product ID 5 and 6. You'll need to join tblinvoiceitems with tblhosting. Once done, you can perform your redirect. Here you can find all details about hooks. Edited July 19, 2019 by Kian 1 Quote Link to comment Share on other sites More sharing options...
graziano_68 Posted October 11, 2019 Author Share Posted October 11, 2019 thank you! 0 Quote Link to comment Share on other sites More sharing options...
graziano_68 Posted October 12, 2019 Author Share Posted October 12, 2019 I'm trying to code the required hook but I have some problem - After the payment the array $var does not contain the product pid=5 , how to add it to $var array ? - When I try to return a value from $var array It does not work for example <?php add_hook('ShoppingCartCheckoutCompletePage', 1, function ($vars) { $firstname = $vars['firstname']; echo "-->$firstname<--"; // Run code to create remote community account here... }); returns nothing , why ? - How to change the button "Continue to the Client area" with "Countinue to mysite.com" and how to change the link tied to this button ? Thank you 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 12, 2019 Share Posted October 12, 2019 3 hours ago, graziano_68 said: After the payment the array $var does not contain the product pid=5 , how to add it to $var array ? Kian gave you a clue about that - $vars only returns certain values, e.g the invoice or order ID... with only that one piece of information, you then have to query the database to get the information you require - which in your case is the PID. untested, but I think it should be along the lines of... <?php # Cart Complete Page Redirection Hook # Written by brian! use WHMCS\Database\Capsule; add_hook('ShoppingCartCheckoutCompletePage', 1, function($vars) { if ($vars['ispaid'] == true) { $orderID = $vars['orderid']; $myproducts = Capsule::table('tblhosting')->where('orderid',$orderID)->pluck('tblhosting.packageid'); if (in_array("5",$myproducts)) { return '<META http-equiv="refresh" content="0;URL=http://www.mydomain.com/ownpage.html" />'; } elseif (in_array("6",$myproducts)) { return '<META http-equiv="refresh" content="0;URL=http://www.mydomain.com/anotherpage.html" />'; } } }); the database query creates a list of products in the order, then if it finds pid=5 in that list, it redirects to one page; if it finds pid=6, it redirects to another page; if neither are in there, it does nothing... the obvious bug in your question is what to do if the order contains both 5 & 6, but I assume that's not going to occur (depending on what those products are)... as written, it will see 5 first and redirect accordingly... btw to make it easier for you to follow, i've used the refresh code from the hook developer docs, though i'd personally use header location redirection... 3 hours ago, graziano_68 said: returns nothing , why ? for starters, $vars['firstname'] won't exist as a variable... 3 hours ago, graziano_68 said: How to change the button "Continue to the Client area" with "Continue to mysite.com" changing the text would require using Language Overrides... $_LANG['orderForm']['continueToClientArea'] = "Continue To Client Area"; 3 hours ago, graziano_68 said: and how to change the link tied to this button ? the easiest way would be to edit the complete.tpl template and change the hardcoded link to clientarea.php in there, but it could possibly be done with a ClientAreaFooterOutput hook using JS. 1 Quote Link to comment Share on other sites More sharing options...
graziano_68 Posted October 12, 2019 Author Share Posted October 12, 2019 Thank you , I will try it 0 Quote Link to comment Share on other sites More sharing options...
graziano_68 Posted October 12, 2019 Author Share Posted October 12, 2019 it worked perfectly thank you! 0 Quote Link to comment Share on other sites More sharing options...
graziano_68 Posted October 21, 2019 Author Share Posted October 21, 2019 Please Brian or anyone who can help, another question, I would set OFF terms of service acceptance if a customer ordesr a product ID 5 OR I would provide the customer another TOS link (not the default TOS link set in WHMCS) if the if a customer orders a product ID 5 . Is it possible ? 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.