Jump to content

Nominet Transfers


pjs32

Recommended Posts

1 minute ago, pjs32 said:

I have tried your hook and it remove the fields, but when pressing continue, up comes this error

lol I never thought to press continue - that's WHMCS Testing Dept level of competence on my part... apologies.  🙄

that being the case, I think you have two options - remove the requirement of that field from the ADF (following the instructions to create a custom file etc) - though that could lead to the field not being filled during registrations (without more coding to make it required), or I modify the hook to insert a dummy value into that required field.

which way do you want to go?

Link to comment
Share on other sites

3 minutes ago, brian! said:

lol I never thought to press continue - that's WHMCS Testing Dept level of competence on my part... apologies.  🙄

that being the case, I think you have two options - remove the requirement of that field from the ADF (following the instructions to create a custom file etc) - though that could lead to the field not being filled during registrations (without more coding to make it required), or I modify the hook to insert a dummy value into that required field.

which way do you want to go?

Hi Brian!

This would be good,if you could do..

 or I modify the hook to insert a dummy value into that required field.

Link to comment
Share on other sites

2 hours ago, pjs32 said:

I modify the hook to insert a dummy value into that required field.

the hook itself is simple enough - tweak the Reg Name field with a dummy value and make it hidden... but I can't think of an obvious way in the hook to hide the fieldname... aaagh!

2qJ3S4G.png

I can't rename it as it's a required field - and even if I could, there's a colon hardcoded in the template... hiding via css would be tricky as there could be registrations and transfers on the same page...

so I think the simplest solution for now is a hook that does the donkey work of the array manipulation and a simple Smarty if statement in the configuredomains.tpl template.

<?php

# Nominet Transfer ADF Hook v2
# Written by brian!
 
function nominet_transfer_adf_hook($vars)
{
	if ($vars['templatefile']=='configuredomains'){
		$domains = $vars['domains'];
		foreach ($domains as $key => $domain) {
			$tld = substr($domain['domain'],strrpos($domain['domain'],"."));
			if ($_SESSION['cart']['domains'][$key]['type'] == "transfer" && $tld == ".uk") {
				$domains[$key]['type'] = 'transfer';
				foreach ($domain['fields'] as $fieldkey => $value) {
					if ($fieldkey == 'Registrant Name') {
						$domains[$key]['fields']['Registrant Name'] = str_replace('value=""','value="dummy"',$value);
						$domains[$key]['fields']['Registrant Name'] = str_replace('type="text"','type="hidden"',$domains[$key]['fields']['Registrant Name']);
					}
					else {
						unset($domains[$key]['fields'][$fieldkey]);
					}
				}
			}
		}
		return array("domains" => $domains);
	}
}
add_hook("ClientAreaPageCart", 1, "nominet_transfer_adf_hook");

and then in the template...

<div class="col-sm-4">{$domainfieldname}:</div>

becomes...

<div class="col-sm-4">{if $domain.type neq 'transfer'}{$domainfieldname}:{/if}</div>

VYo83SB.png

Edited by brian!
Link to comment
Share on other sites

3 minutes ago, pjs32 said:

Unfortunately when you press the last continue button, up comes the error again

*sighs* - I tidied up the code too much before posting it...

$domains[$key]['fields']['Registrant Name'] = str_replace('type="text"','type="hidden"',$value);

should be...

$domains[$key]['fields']['Registrant Name'] = str_replace('type="text"','type="hidden"',$domains[$key]['fields']['Registrant Name']);

the way I had it, only the second line would work - third time lucky. 🙏

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