gei Posted January 7, 2020 Share Posted January 7, 2020 When a client adds a domain name to their shopping cart (new registration), it's added with a default of 1 year. They do have an option of increasing the number of years manually in the shopping cart. In older versions of WHMCS we modified the shopping cart template to make the default number of years to 2 - that way most clients would leave it at 2, instead of manually dropping it down to 1. Any ideas what hook would we use to accomplish this? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 8, 2020 Share Posted January 8, 2020 15 hours ago, gei said: When a client adds a domain name to their shopping cart (new registration), it's added with a default of 1 year. technically, it uses the minimum priced cycle - so if you didn't add a price for 1-year registrations, but added a price for 2-years, it would choose 2 years etc. 15 hours ago, gei said: In older versions of WHMCS we modified the shopping cart template to make the default number of years to 2 - that way most clients would leave it at 2, instead of manually dropping it down to 1. 15 hours ago, gei said: Any ideas what hook would we use to accomplish this? are you thinking of standard_cart ? I suspect that's it's JS driven and defaults to the shortest priced registration period - you probably won't want to do this, but the simplest way would be to remove 1 year TLD register pricing.... however, I assume you want the user to have the option of choosing 1yr if they want to. off-hand, I can't think of a quick fix solution for this - it's not ideal to change it when the user gets to viewcart, as by then they might have thought they were buying a 1 yr reg for X, only to get there to find it's now a 2-yr reg for Y. 0 Quote Link to comment Share on other sites More sharing options...
gei Posted January 8, 2020 Author Share Posted January 8, 2020 Removing the 1 year option is definitely not ideal, as some clients will want to drop it back down. 1 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 8, 2020 Share Posted January 8, 2020 1 hour ago, gei said: Removing the 1 year option is definitely not ideal, as some clients will want to drop it back down. I hate to suggest this, but it would probably be quicker to switch back to using Modern for registrations. 1 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 9, 2020 Share Posted January 9, 2020 hmmm... with effort, this might be doable - so far it's taken a .js rewrite and two hooks... and it's still incomplete and buggy (the incompleteness will be causing most of the bugs lol). also, i've spotted a horrible bug in viewcart that I don't think I had previously noticed (which was seemingly not in v6). there's probably no point on working on this in v7.8.3 as the js has to be rewritten and I can see small differences in that file in the v7.9 changelog... nothing that would affect this, but they still have to be taken into account... i'll leave that until v7.9.1 is released next week or the week after. that said, i'm still not convinced that it's worth the effort because I suspect that second hook is going to have to do an awful lot of work to make this viable. 0 Quote Link to comment Share on other sites More sharing options...
gei Posted January 9, 2020 Author Share Posted January 9, 2020 Which hook are you using? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 9, 2020 Share Posted January 9, 2020 Just now, gei said: Which hook are you using? modifying the JS sets the default registration period to 2 years - though it assumes that there is a 1 year registration price set for the TLD (I doubt it would work correctly if there wasn't - but haven't tested that yet). changing the JS isn't enough and it returns to being a 1-yr reg at viewcart - so ClientAreaPageCart is used to change the period, initial and renewal prices and a few language strings at viewcart. to update the pricing in the Order Summary box, the OrderDomainPricingOverride hook is used to set the initial/recurring price for that domain... using just ODPO isn't enough because of the way it shows the price in the cart (see first image). I can think of another, possibly better, way to do this - though haven't tested that. removing 1-yr pricing from the domain register pricing array doesn't work - I tried that yesterday in the deluded hope it could be a quick fix. I saw enough after the first two steps above to know that it could be done, just that it could take multiple hooks and significant testing... so postponed for a later date when i've got less of a backlog of commercial projects to complete. 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.