robetus Posted October 7, 2017 Share Posted October 7, 2017 Is there currently a way with WHCMS 7.3 to automatically set a certain product to Completed instead of Active when the invoice is paid or the product/service has been delivered? I was thinking about a simple if statement somewhere, if product name is this then status = completed. Any ideas on how I could do this? Link to comment Share on other sites More sharing options...
brian! Posted October 7, 2017 Share Posted October 7, 2017 if you want to automate it, then you will need a hook - i'd suggest using product IDs rather than names, because you could make two products have the same name, but they'd still have different product IDs... it's basically just going to be a table update. also, you'd have to ensure that you were only doing this on non-recurring (e.g one-time) products.. https://docs.whmcs.com/Products_Management Quote Note: The status of the service, domain or addon must be Pending, Active or Suspended to generate an invoice. Link to comment Share on other sites More sharing options...
robetus Posted October 9, 2017 Author Share Posted October 9, 2017 Okay thanks, I'll get someone to work on the hook. Link to comment Share on other sites More sharing options...
D9Hosting Posted January 4, 2018 Share Posted January 4, 2018 On 10/9/2017 at 11:42 AM, robetus said: Okay thanks, I'll get someone to work on the hook. Just wondering if you ever got this created? We're looking to create something similar but if you've already made the hook we'd be happy to purchase from you rather than making it ourselves? Link to comment Share on other sites More sharing options...
robetus Posted January 5, 2018 Author Share Posted January 5, 2018 Yes I did, figured it out myself and here it is: <?php use Illuminate\Database\Capsule\Manager as Capsule; use Illuminate\Database\Schema\Blueprint; if (!defined("WHMCS")) { die("This file cannot be accessed directly"); } function modname_CreateAccount($params) { Capsule::table('tblhosting') ->where('id', $params['serviceid']) ->update( [ 'domainstatus' => 'Completed', ] ); } This simple function will change the product status to Completed. You just need to make a server module with this php code inside the file, change modname to what you want to name the module and name the php file the same name. Or you can use it inside a pre-existing module you've already created. WHMCS should really do this as an option. Enjoy! Link to comment Share on other sites More sharing options...
D9Hosting Posted January 5, 2018 Share Posted January 5, 2018 That's great, thanks! Link to comment Share on other sites More sharing options...
Recommended Posts