sweethome Posted June 25, 2023 Share Posted June 25, 2023 hello guys, I'd like to run domain re-calculation on a daily basis so clients moving between categories will get their domain prices from their respective price slabs. Anyone can share a piece of code for this or can code it for a small fee? thanks, Justin 0 Quote Link to comment Share on other sites More sharing options...
WGS Posted June 25, 2023 Share Posted June 25, 2023 Hi, Please contact us here we can discuss in detail here https://whmcsglobalservices.com/whmcs-custom-development 0 Quote Link to comment Share on other sites More sharing options...
wsa Posted June 25, 2023 Share Posted June 25, 2023 Hello, We will be very happy to assist you with this project. Please contact us at https://www.whmcsservices.com/customwhmcs.php Hope to hear from your 0 Quote Link to comment Share on other sites More sharing options...
SimpleSonic Posted June 26, 2023 Share Posted June 26, 2023 Here is a hook that should do what you need: <?php /* * Hook to automatically recalculate pricing for domains after daily cron is ran */ if (!defined("WHMCS")) die("This file cannot be accessed directly"); use WHMCS\Database\Capsule; add_hook('DailyCronJob', 1, function($vars) { logActivity('Starting autorecalculate for domains ', 0); $adminUsername = ''; // Optional for WHMCS 7.2 and later foreach (Capsule::table('tbldomains')->pluck('id') as $v) { localAPI('UpdateClientDomain', array('domainid' => $v, 'autorecalc' => true), $adminUsername); } logActivity('Ending autorecalculate for domains ', 0); }); 1 Quote Link to comment Share on other sites More sharing options...
sweethome Posted June 26, 2023 Author Share Posted June 26, 2023 thanks a lot man, gonna try it tomorrow in cron and see hoe it goes. many thanks for sharing the code, this should probably be in native whmcs as a function.. tnx 0 Quote Link to comment Share on other sites More sharing options...
SimpleSonic Posted June 26, 2023 Share Posted June 26, 2023 25 minutes ago, sweethome said: thanks a lot man, gonna try it tomorrow in cron and see hoe it goes. many thanks for sharing the code, this should probably be in native whmcs as a function.. tnx Just place the code in a file and name it "autocalc.php" and upload it in your WHMCS's "/includes/hooks/" folder and it will run during your daily cron. 0 Quote Link to comment Share on other sites More sharing options...
Ramouz Posted September 28, 2023 Share Posted September 28, 2023 On 6/26/2023 at 10:17 AM, ResellerWiz said: Here is a hook that should do what you need: Thank you very much. It works great and saves A LOT of time. This should be a setting in WHMCS or a feature that we can use on demand. 0 Quote Link to comment Share on other sites More sharing options...
SimpleSonic Posted September 28, 2023 Share Posted September 28, 2023 11 minutes ago, Ramouz said: Thank you very much. It works great and saves A LOT of time. This should be a setting in WHMCS or a feature that we can use on demand. I agree. Recalculating all existing service and/or domain pricing in WHMCS should already be a feature and not require an additional script or addon. 2 Quote Link to comment Share on other sites More sharing options...
Ramouz Posted September 28, 2023 Share Posted September 28, 2023 37 minutes ago, ResellerWiz said: I agree. Recalculating all existing service and/or domain pricing in WHMCS should already be a feature and not require an additional script or addon. There's so much missing in WHMCS it's unbelievable for an important software like it. They don't do much effort for a giant team. I wouldn't use daily existing products/services updates since many customers have different pricing but a feature for it would be nice on certain occasions for sure. Domains is the one where everyone pays the same, at least for us. 0 Quote Link to comment Share on other sites More sharing options...
Ramouz Posted January 24 Share Posted January 24 On 9/28/2023 at 9:56 AM, SimpleSonic said: I agree. Recalculating all existing service and/or domain pricing in WHMCS should already be a feature and not require an additional script or addon. Unfortunately, I've been noticing an issue with the hook in my WHMCS running 7.9 and 7.10. In my other WHMCS sites running 8.4 and 8.8 it is working well, from what I can tell. The issue is this: In the one running WHMCS 7.9: default currency is EUR. Price of .com for now is 13.79 EUR. It is giving the domain price of EUR to the other currencies, USD, CAD. I checked my domain pricing just to make sure and they're not at 13.79, only EUR is. CAD is set to 20.27. USD to 14.92. Yet, they show as 13.79. In the one running WHMCS 7.10: Even worse. Default currency is USD. It increased my .com price of 17.95 USD to 308 USD+. Some at 400 USD. Same for other currencies, around 300-400. When I auto-recalculate manually in the client profile, it sets it correctly until the cron runs later on. It reverts it to the incorrect value. Do you know why this is happening? I suspect I will have to remove the hook on those sites :(. Should I fill in the admin username in the hook code? I did not do that for any site. 0 Quote Link to comment Share on other sites More sharing options...
SimpleSonic Posted January 24 Share Posted January 24 40 minutes ago, Ramouz said: Unfortunately, I've been noticing an issue with the hook in my WHMCS running 7.9 and 7.10. In my other WHMCS sites running 8.4 and 8.8 it is working well, from what I can tell. The issue is this: In the one running WHMCS 7.9: default currency is EUR. Price of .com for now is 13.79 EUR. It is giving the domain price of EUR to the other currencies, USD, CAD. I checked my domain pricing just to make sure and they're not at 13.79, only EUR is. CAD is set to 20.27. USD to 14.92. Yet, they show as 13.79. In the one running WHMCS 7.10: Even worse. Default currency is USD. It increased my .com price of 17.95 USD to 308 USD+. Some at 400 USD. Same for other currencies, around 300-400. When I auto-recalculate manually in the client profile, it sets it correctly until the cron runs later on. It reverts it to the incorrect value. Do you know why this is happening? I suspect I will have to remove the hook on those sites :(. Should I fill in the admin username in the hook code? I did not do that for any site. The hook was meant for v8+, so using it on older version may have unexpected results. Therefore I wouldn’t recommend it. 0 Quote Link to comment Share on other sites More sharing options...
Ramouz Posted January 24 Share Posted January 24 1 hour ago, SimpleSonic said: The hook was meant for v8+, so using it on older version may have unexpected results. Therefore I wouldn’t recommend it. Hmm. Good thing I discovered that then. I suggest editing your post if you're able, to mention that. And, perhaps even the comment in the code since it makes us think we can use it with WHMCS 7.2+. Unless you're able to make it work with WHMCS 7.x =). Or if you can guide me in the right direction, I can check it out with someone. If not, no worries. 0 Quote Link to comment Share on other sites More sharing options...
SimpleSonic Posted January 25 Share Posted January 25 46 minutes ago, Ramouz said: Hmm. Good thing I discovered that then. I suggest editing your post if you're able, to mention that. And, perhaps even the comment in the code since it makes us think we can use it with WHMCS 7.2+. Unless you're able to make it work with WHMCS 7.x =). Or if you can guide me in the right direction, I can check it out with someone. If not, no worries. I simply provided a hook for free that works with WHMCS v8+ for automatic recalculation of services and domains, as-is. If you need something different or need changes made, that would be up to you. -1 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.