Remitur Posted September 7, 2020 Share Posted September 7, 2020 The current domain price list provided by WHMCS ( available at page /domain/pricing ) is quite complete (it reports feed for registration, tansfer, renewal and redemption), and it manages different client groups as follows: for unlogged users, it reports default group prices for a logged in user, if it belongs to a certain client group, for each TLD it shows the custom price reserved to that group That's good, and it's working fine... But what if I want to display to unlogged user (on different pages, or selecting from a menu) the different price lists available ? Example: there're 3 different price lists (bound, i.e., to the number of domain managed by the user; or to the amount of previous business) to unlogged users, I would like to show "this is the default price list, if you manage more than 100 domains, there's this different price list; and if you manage more than 300, this is the price list for you" I found no way to do it working just on domain-pricing.tpl (and neither any way to meve it to a different URL), so I guess it's hard-coded in WHMCS... Any idea, any trick about this? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 7, 2020 Share Posted September 7, 2020 1 hour ago, Remitur said: That's good, and it's working fine... there's a but coming.... 🙂 1 hour ago, Remitur said: But what if I want to display to unlogged user (on different pages, or selecting from a menu) the different price lists available ? ultimately, all you're doing is updating the $pricing array with a ClientAreaPage hook based on a value you can pass in the relevant menu url link... 1 hour ago, Remitur said: I found no way to do it working just on domain-pricing.tpl (and neither any way to move it to a different URL), so I guess it's hard-coded in WHMCS... I guess it's hard-coded in the sense that WHMCS is creating the pricing array internally and passing it to the template, but an incomplete shortcut solution would be to use the GetTLDPricing API to re-create the pricing array... that will get you most of the way there, but with a few missing pieces, .e.g you can pass a currency or client id to it, so passing a client id of a member of a particular client group, will return the pricing array of that client group in that client's currency - but the returned domain pricing mostly won't be currency formatted (e.g no prefix/suffix on the prices) (fixable in the hook), nor could the user change currency on the page - unless you could assign a client id for each client group in each currency you use. the alternative would be to just query the relevant database tables, passing a client group and currency in the query and then formatting the array similar to the existing pricing array (if you were going to use the existing template).... doable, removed the reliance on the API but would take much longer to write. in terms of doing it on a new page, then you would just create a .php page as per normal, get the pricing array in the hook and pass it to the template and output the array in the template however yo wish to. data feeds would be an option too, but not a good one as returning the data that way would be slower than using a hook - so if you're going to do this on a WHMCS page, i'd suggest going down the hook road rather than feeds. 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.