Jump to content
system32

select currency in header.

Recommended Posts

I want a currency option from the header section of our theme.

I tried some resources, but it didn't.
For example, the following codes.

 

The menu does not open.

  • Like 1

Share this post


Link to post
Share on other sites
On 26/05/2018 at 22:35, system32 said:

I want a currency option from the header section of our theme.

I tried some resources, but it didn't.
For example, the following codes.

did you follow that thread to the final post which linked to an updated thread that works with v7.2.2?

having checked the code in the updated thread again, I can confirm that it still works with v7.5.1 (using the Six template)...

pqtXzar.png

On 26/05/2018 at 22:35, system32 said:

The menu does not open.

which implies that it's a JavaScript / jQuery issue... that's very likely if you followed the original thread as that code is out of date for current WHMCS v7.5 releases.

so if you followed the updated thread, make the changes to header.tpl and the required changes to templates/six/js/scripts.min.js (usually by editing scripts.js and minifying it) then this currency header code will work with the "Six" template... if you're using a custom template (especially one not based on Six), then it may not necessarily work, or might require changes to different files in order to do so... your WHMCS client area seems to be down, so I was unable to determine what you are using. :?:

as a further update to this, you can add the currency header changes without the need to modify scripts.min.js - so this solution requires only a template code change within header.tpl to work, no other external js modifications. :idea:

in v7.5.1, it would be...

<!-- Currency -->
{if !$loggedin && count($currencies) > 1}
	<li>
		<a href="#" class="choose-currency" data-toggle="popover" id="currencyChooser" data-container="body" data-placement="bottom" data-content='{foreach from=$currencies item=currchoice}<img src="{$BASE_PATH_IMG}/flags/{$currchoice.code|substr:0:2|strtolower}.png"> <a href="{$currentpagelinkback}currency={$currchoice.id}">{if $currency.id eq $currchoice.id}<u>{/if}{$currchoice.code}</u></a>{/foreach}'><i class="fa fa-usd"></i> <b class="caret"></b></a>
	</li>
{/if}

the updated method would also work in v6.2.2 too (though using slightly different code because of layout changes since that release)...

{if !$loggedin && count($currencies) > 1}
	<div class="pull-right nav">
		<a href="#" class="quick-nav" data-toggle="popover" id="currencyChooser" data-container="body" data-placement="bottom" data-content='{foreach from=$currencies item=currchoice}<img src="{$BASE_PATH_IMG}/flags/{$currchoice.code|substr:0:2|strtolower}.png"> <a href="{$currentpagelinkback}currency={$currchoice.id}">{if $currency.id eq $currchoice.id}<u>{/if}{$currchoice.code}</u></a> {/foreach}'><i class="fa fa-usd"></i> {$LANG.choosecurrency}<span class="caret"></span></a>
	</div>
{/if}

aPntspH.png

so i've no reason to assume that the updated code wouldn't work in any WHMCS release since v6.22 (probably even earlier versions of v6 too - but I don't have a dev to check that).

also, because it's just relying on Bootstrap JS Popover, it will likely have a greater chance of working on custom templates too. :)

v7.7.1 update - to take account of the Font Awesome changes, the code should be...

<!-- Currency -->
{if !$loggedin && count($currencies) > 1}
	<li>
		<a href="#" class="choose-currency" data-toggle="popover" id="currencyChooser" data-container="body" data-placement="bottom" data-content='{foreach from=$currencies item=currchoice}<img src="{$BASE_PATH_IMG}/flags/{$currchoice.code|substr:0:2|strtolower}.png"> <a href="{$currentpagelinkback}currency={$currchoice.id}">{if $currency.id eq $currchoice.id}<u>{/if}{$currchoice.code}</u></a>{/foreach}'><i class="far fa-dollar-sign"></i> <b class="caret"></b></a>
	</li>
{/if}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

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