Jump to content

Additional Policy Agreement


MJHost

Recommended Posts

Hi all, 

I am looking to add an additional checkbox to the order process. This would only appear if a domain name was being purchased as part of the order. I have the hook for the "additional checkbox". Is it possible to edit this, so that it only appears when a domain is in the "basket" too?

Link to comment
Share on other sites

5 hours ago, MJHost said:

I am looking to add an additional checkbox to the order process. This would only appear if a domain name was being purchased as part of the order. I have the hook for the "additional checkbox". Is it possible to edit this, so that it only appears when a domain is in the "basket" too?

i'd be tempted to say yes, because you should just need to search the $session cart value and see if there is a domain reg/tran in there - probably at the ShoppingCartValidateCheckout stage... it's too late to look at coding tonite (especially after 11 hours watching cricket), but with a refreshed mind tomorrow, things should be clearer to me (and i've bookmarked the thread). 🏏

Link to comment
Share on other sites

i'm assuming two things with this answer...

  1. you are referring to John's hook from the thread below....
  2. when you say "This would only appear if a domain name was being purchased as part of the order.", i'm including both domain registrations and transfers in that - if it registrations only you want to check for and not transfers, then that would require additional coding...

somewhere in those 3 existing IF statements, you should just need to add...

    if ($vars['domainsinorder'] != 'true') {
        return false;
    }

the value should be true if it's a reg or transfer, false if owndomain, subdomain or no domains in the cart.

Link to comment
Share on other sites

20 hours ago, brian! said:

i'd be tempted to say yes, because you should just need to search the $session cart value and see if there is a domain reg/tran in there - probably at the ShoppingCartValidateCheckout stage... it's too late to look at coding tonite (especially after 11 hours watching cricket), but with a refreshed mind tomorrow, things should be clearer to me (and i've bookmarked the thread). 🏏

Thank you @brian! - Hope you enjoyed the cricket, I unfortunately missed it. 

 

3 hours ago, brian! said:

i'm assuming two things with this answer...

  1. you are referring to John's hook from the thread below....
  2. when you say "This would only appear if a domain name was being purchased as part of the order.", i'm including both domain registrations and transfers in that - if it registrations only you want to check for and not transfers, then that would require additional coding...

somewhere in those 3 existing IF statements, you should just need to add...


    if ($vars['domainsinorder'] != 'true') {
        return false;
    }

the value should be true if it's a reg or transfer, false if owndomain, subdomain or no domains in the cart.

That's great, yes, I did mean transfers too.

Link to comment
Share on other sites

Me again 😕 

Added the code into the additionalAgreement.php hook file.

if ($vars['domainsinorder'] != 'true') {
        return false;

It is currently just below: 

if ($vars['filename'] != 'cart') {
        return false;

It hasn't worked (or atleast it doesn't appear to have done). The additional checkbox and text is not showing in the checkout process, whether a domain is in the cart or not. Have I entered it into the wrong place?

Link to comment
Share on other sites

15 hours ago, MJHost said:

It hasn't worked (or atleast it doesn't appear to have done). The additional checkbox and text is not showing in the checkout process, whether a domain is in the cart or not. Have I entered it into the wrong place?

no - if I do the same, then it works... the only difference I made, which is trivial and shouldn't affect it working, was to remove that 3rd hook as it's redundant (unless you change the coding to get it to do something).

as it's just a boolean value, you could  use the following alternatives instead and see if that works for you..

    if ($vars['domainsinorder'] != '1') {
        return false;
    }

if it doesn't, then you'll need to add the debug code to the end of the checkout.tpl template and check the popup window to see if the variable exists in your setup...

{if $adminLoggedIn}{debug}{/if}
Link to comment
Share on other sites

6 hours ago, brian! said:

no - if I do the same, then it works... the only difference I made, which is trivial and shouldn't affect it working, was to remove that 3rd hook as it's redundant (unless you change the coding to get it to do something).

as it's just a boolean value, you could  use the following alternatives instead and see if that works for you..


    if ($vars['domainsinorder'] != '1') {
        return false;
    }

if it doesn't, then you'll need to add the debug code to the end of the checkout.tpl template and check the popup window to see if the variable exists in your setup...


{if $adminLoggedIn}{debug}{/if}

I tried the alternative, but that made no difference. But on closer inspection of the checkout process, I noticed that the gatewaylogos.php hook as stopped functioning. So I am thinking something is stopping the hooks working? 

I also note, that I seem to have two "hooks" folders, one inside /includes/ (which is where the additional terms and gateway logo hooks are) and then there is another in the main directory. Is this correct? 

Link to comment
Share on other sites

16 hours ago, MJHost said:

I tried the alternative, but that made no difference. But on closer inspection of the checkout process, I noticed that the gatewaylogos.php hook as stopped functioning. So I am thinking something is stopping the hooks working? 

it should be triggering automatically - looking at your site, the PayPal logo is in the correct folder, so I don't know why it wouldn't show the logo (unless the hook isn't being triggered)... but the two hooks can work happily together...

nn9eRgv.png

16 hours ago, MJHost said:

I also note, that I seem to have two "hooks" folders, one inside /includes/ (which is where the additional terms and gateway logo hooks are) and then there is another in the main directory. Is this correct? 

there should only be one hooks folder, located inside the 'includes' folder... the one inside the main folder is not a default part of WHMCS - maybe it's being used by an addon.... but any hooks in there won't be triggered by a page load... the ones in /includes/hooks/ should be though.

Edited by brian!
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