Jump to content

select currency in header.


system32

Recommended Posts

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}
Link to comment
Share on other sites

  • 2 years later...
15 hours ago, Kelby said:

How to get it work for 7.8 please?

the above would still work in any version of Six after v7.7...

DZqTv3W.png

the main issue you might hit is if you are using currencies for which WHMCS doesn't include a native flag - if that occurs, then I would use a different flag directory for the images, get all flags icons from the same source site and use them instead - there's no point replacing existing flag image files as WHMCS would just overwrite them during an update.

Link to comment
Share on other sites

On 6/13/2020 at 1:14 PM, brian! said:

the above would still work in any version of Six after v7.7...

DZqTv3W.png

the main issue you might hit is if you are using currencies for which WHMCS doesn't include a native flag - if that occurs, then I would use a different flag directory for the images, get all flags icons from the same source site and use them instead - there's no point replacing existing flag image files as WHMCS would just overwrite them during an update.

Nice work!

Would you please give me this code?

Link to comment
Share on other sites

37 minutes ago, Kelby said:

Would you please give me this code?

it's the same as posted above - except the output is in a 3 column div and is using a custom folder for the icons.

{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}<div class="col-md-4"><img src="{$BASE_PATH_IMG}/newflags/{$currchoice.code|substr:0:3|strtolower}.png">&nbsp;<a href="{$currentpagelinkback}currency={$currchoice.id}">{if $currency.id eq $currchoice.id}<u>{/if}{$currchoice.code}</u></a></div>{/foreach}<br><br>'><i class="fal fa-sack-dollar"></i> <b class="caret"></b></a>
	</li>
{/if}
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