Jump to content

How to hide Register Currency


Recommended Posts

I must set JPY and USD in Currencies for SSL Pligin for WHMCS.

But I want to deal only JPY.

I want to hide currency-related displays in ClientArea.

 

Maybe currency-related displays are two places.

register.png

cart.png

I want to hide Register Currency.

 

I think there is a way to use the Hook.

Please tell me how to hide Register Currency.

 

Any help would be greatly appreciated!!

Link to comment
Share on other sites

the sidebar can be removed using a hook, check out the first post in the thread below...

 

https://forum.whmcs.com/showthread.php?113791-Hiding-Currency-from-SideBar-Menu-how-to-hide-the-currency&p=461307#post461307

 

for complicated variations, read the entire thread - though probably unnecessary in your situation.

 

for the client registration page, just edit clientregister.tpl and change...

 

                {if $currencies}
                   <div class="form-group">
                       <label for="currency" class="control-label">{$LANG.choosecurrency}</label>
                       <select id="currency" name="currency" class="form-control">
                           {foreach from=$currencies item=curr}
                           <option value="{$curr.id}"{if !$smarty.post.currency && $curr.default || $smarty.post.currency eq $curr.id } selected{/if}>{$curr.code}</option>
                           {/foreach}
                       </select>
                   </div>
               {/if}

to...

 

                {if $currencies}
                   <div class="form-group">
                       <label for="currency" class="control-label">{$LANG.choosecurrency}</label>
                       <select id="currency" name="currency" class="form-control">
                           {foreach from=$currencies item=curr}
                               {if $curr.code eq 'JPY'}
                                   <option value="{$curr.id}"{if !$smarty.post.currency && $curr.default || $smarty.post.currency eq $curr.id } selected{/if}>{$curr.code}</option>
                               {/if}
                           {/foreach}
                       </select>
                   </div>
               {/if}

Link to comment
Share on other sites

I appreciate your kindness.

I can delete Register Currency in Register page and SideBar Menu.

But It didn't work on responsive mode to SideBar Menu.

I use WHMCS7.0.1.

 

 

/templates/orderforms/standard_cart/sidebar-categories-collapsed.tpl

 

 

<!--Delete Register Currency--

{if !$loggedin && $currencies}

<div class="pull-right form-inline">

<form method="post" action="cart.php{if $action}?a={$action}{elseif $gid}?gid={$gid}{/if}">

<select name="currency" onchange="submit()" class="form-control">

<option value="">{$LANG.choosecurrency}</option>

{foreach from=$currencies item=listcurr}

<option value="{$listcurr.id}"{if $listcurr.id == $currency.id} selected{/if}>{$listcurr.code}</option>

{/foreach}

</select>

</form>

</div>

{/if}

--Delete Register Currency//-->

 

 

/templates/six/clientregister.tpl

<!--Delete Register Currency--

{if $currencies}

<div class="form-group">

<label for="currency" class="control-label">{$LANG.choosecurrency}</label>

<select id="currency" name="currency" class="form-control">

{foreach from=$currencies item=curr}

<option value="{$curr.id}"{if !$smarty.post.currency && $curr.default || $smarty.post.currency eq $curr.id } selected{/if}>{$curr.code}</option>

{/foreach}

</select>

</div>

{/if}

--Delete Register Currency//-->

 

 

/includes/hooks/RegisterCurrency.php

<?php

 

 

use WHMCS\View\Menu\Item as MenuItem;

 

 

add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar) {

$secondarySidebar->removeChild('Choose Currency');

});

Link to comment
Share on other sites

  • 4 years later...
On 10/17/2016 at 4:05 PM, brian! said:

the sidebar can be removed using a hook, check out the first post in the thread below...

 

https://community.whmcs.com/showthread.php?113791-Hiding-Currency-from-SideBar-Menu-how-to-hide-the-currency&p=461307#post461307

 

for complicated variations, read the entire thread - though probably unnecessary in your situation.

 

for the client registration page, just edit clientregister.tpl and change...

 

 


                {if $currencies}
                   <div class="form-group">
                       <label for="currency" class="control-label">{$LANG.choosecurrency}</label>
                       <select id="currency" name="currency" class="form-control">
                           {foreach from=$currencies item=curr}
                           <option value="{$curr.id}"{if !$smarty.post.currency && $curr.default || $smarty.post.currency eq $curr.id } selected{/if}>{$curr.code}</option>
                           {/foreach}
                       </select>
                   </div>
               {/if}
 

 

to...

 

 


                {if $currencies}
                   <div class="form-group">
                       <label for="currency" class="control-label">{$LANG.choosecurrency}</label>
                       <select id="currency" name="currency" class="form-control">
                           {foreach from=$currencies item=curr}
                               {if $curr.code eq 'JPY'}
                                   <option value="{$curr.id}"{if !$smarty.post.currency && $curr.default || $smarty.post.currency eq $curr.id } selected{/if}>{$curr.code}</option>
                               {/if}
                           {/foreach}
                       </select>
                   </div>
               {/if}
 

 

I want to apply this on the "twenty-one" template.
It will work now?

Link to comment
Share on other sites

  • 2 weeks later...
On 21/05/2021 at 16:39, M. Rahman said:

I want to apply this on the "twenty-one" template.
It will work now?

the hook should still work on any  theme (though haven't checked).

the ideas would still work on 21, but the code will be different depending on exactly what you want to do.

Link to comment
Share on other sites

  • 1 month later...

Hi,

In the earlier versions of WHMCS I used a similar code from a post from the WHMCS community on the register and the checkout page (if the client would register on that page) to hide a currency and only let the clients choose a certain currency for invoicing, but in the 21 version in the child theme I can't seem to get it to work (I also tried in the parent theme and it didn't show up there either), but only in the checkout.tpl. In the normal register.tpl page it works with the first code below, which I used in the earlier versions of WHMCS. I tried putting the code where the custom fields show up on the page, at the top of the page, outside "if's" etc. but to no avail... The field won't show up whatever I try. I also cleared the template cache multiple times, but I don't know what I'm doing wrong. For example I'd want EUR as the only available option on the checkout registration page and these are two versions of the code that I used:

{if $currencies}
	<div class="col-sm-6">
		<label for="inputCurrency">Choose currency</label>
		<div class="form-group prepend-icon">
			<label for="inputCurrency" class="field-icon">
				<i class="far fa-money-bill-alt"></i>
			</label>
			<select id="inputCurrency" name="currency" class="field form-control">
				{foreach $currencies as $curr}
					{if $curr.code eq 'EUR'}
						<option value="{$curr.id}"{if !$smarty.post.currency && $curr.default || $smarty.post.currency eq $curr.id } selected{/if}>{$curr.code}</option>
					{/if}
				{/foreach}
			</select>
		</div>
	</div>
{/if}

 

 

                                {if !$loggedin && $currencies}  // I also tried without !@loggedin
                                <div class="pull-right form-inline float-right">
                                    <label for="inputCurrency" class="field-icon">
                                        <i class="far fa-money-bill-alt"></i>
                                    </label>
                                    <select name="currency" id="inputCurrency" class="field form-control">
                                        <option value="">{$LANG.choosecurrency}</option>
                                        {foreach from=$currencies item=listcurr}
                                            {if $listcurr.code eq 'EUR'}
                                                <option value="{$listcurr.id}"{if $listcurr.id == $currency.id} selected{/if}>{$listcurr.code}</option>
                                            {/if}
                                        {/foreach}
                                    </select>
                                </div>
                                {/if}

 

Any ideas what I'm doing wrong/why it isn't working?

Thank you

 

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