Jump to content

Change default number of domain registration years?


gei

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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).
    2oknutM.pngXGUWITL.png
  • 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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated