Jump to content

Show hide text in configuredomains.tpl


web2008

Recommended Posts

This should be simple, but I just can't figure it out.

In "configuredomains.tpl" I will display a text that should not be displayed by domain transfers.

if register domain - Show text
if transfer domain - Don`t show text

Is there anyone who can help me with this?

Link to comment
Share on other sites

1 hour ago, web2008 said:

This should be simple, but I just can't figure it out.

don't get lulled in with that thought - i've wasted a lot of time thinking that with WHMCS! 🙄

1 hour ago, web2008 said:

In "configuredomains.tpl" I will display a text that should not be displayed by domain transfers.

if register domain - Show text
if transfer domain - Don`t show text

Is there anyone who can help me with this?

this would not be straightforward because that page can, and often will, handle a mix of registrations and transfers on the same page... as an illustration of this, take a look at the Smarty variables available (i've removed some unnecessary ones to make the image simpler) when I view 2 transfers and a registration on the configuredomains template...

owUoCvz.png

as you can see, there is no obvious variable to determine if a domain is a transfer or registration... maybe is EPP was required for all transfers, but it isn't for .uk domains - however, the cart session variables will hold which they are! 🙂

to keep things simple, it would be easier to display your custom message inside the {foreach $domains as $num => $domain} loop... you could display it outside of it if you had too, but let's not add any complications like that on a quiet Sunday afternoon! ☺️

{if $smarty.session.cart.domains.{$num}.type eq "transfer"}This is a transfer!!!!!{elseif $smarty.session.cart.domains.{$num}.type eq "register"}This is a new registration!!!{/if}

weJkzVB.png

obviously, where i'm adding "This is a transfer" in the output, you could easily use a Language Override for that if you need the text to be in the client's chosen language. thanks.png

to answer your specific coding question, it would be the code below and you wouldn't need to check if it were a transfer if you're not going to display any text if it is.

{if $smarty.session.cart.domains.{$num}.type eq "register"}This is a new registration!!!{/if}
Link to comment
Share on other sites

20 minutes ago, web2008 said:

Else, is it possible to combine the code below (which works) with yours?

if you say your existing code works, then yes..

{if strpos( $domainfieldname, "Eier type") !== false and substr($domain.domain,-2) eq "no" and $smarty.session.cart.domains.{$num}.type eq "register"}

HTML or Text

{/if}

though your code implies that there is either only one (or it's the last) additional domain field for this TLD or you're outputting inside the $domain.fields foreach...

Link to comment
Share on other sites

3 minutes ago, web2008 said:

What I am trying to do is that my existing code should display HTML / Text only when registering a new domain, not a transfer.

then it should work... if it were me, and if this were for the .no TLD, then i'd probably change the substr from -2 to -3 and search for ".no" - because that second condition would match a .casino domain... the first part wouldn't though, so this is largely irrelevant, but it's a good habit to get into to be as accurate as you can with conditions.

Link to comment
Share on other sites

16 hours ago, web2008 said:

Or, do you think that what I want to do is not possible?

well you haven't told me exactly WHAT you are trying to do and, more importantly, WHERE you're trying to do it in the template.

it might be useful if you attached your configuredomains.tpl template or PM a link to your site and I can figure out what you're trying to do and where... I didn't particularly like the use of that strpos, but you said it was working - so I let that go.

Link to comment
Share on other sites

On 3/18/2019 at 11:58 PM, web2008 said:

What I want is to show the HTML/Text if TLD=.no  and type is "Register"

Now HTML/Text is also displayed when type = "Transfer" and works fine for TLD=.no

I send you a PM with configuredomains.tpl  if you can help.

did you mean  hide this ?

trf4.thumb.PNG.95410df557417cafb2b39095c80e41a6.PNG

open General Settings >> Domaiin >> UnCheck  ==> Allow clients to transfer a domain to you

Edited by lims
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