-
Language/Currency Links in Header
In response to a post asking how to put language flags/currency links in the header, I developed a mod that will allow you to do that. It allows the display of the language icons (flags) and/or currency symbols as links in the header navigation section so that the customer can select language/currency from there.
The Language and Currency links can be turned on/off independently of each other from the Admin panel. The currency symbol is that set for the currency from Admin: the left symbol is used if one exists, otherwise the right symbol is used (as in the case of the Euro).
The module (coded for Zen Cart v1.3.0 +) has been submitted to the downloads section, here
-
Re: Language/Currency Links in Header
Forgot to add - I left in the code from the currencies and languages sideboxes that prevents the links from showing on checkout pages. I'm sure the development team had a good reason for doing that, so I just left it in.
-
Re: Language/Currency Links in Header
Downloaded, installed, working fine
Quote:
I left in the code from the currencies and languages sideboxes that prevents the links from showing on checkout pages. I'm sure the development team had a good reason for doing that, so I just left it in.
Also checked feature above, working correctly.
Great contribution, thank you
:smile:
-
Re: Language/Currency Links in Header
Hello all,
I can confirm that this mod works on my site.
Just a quick maybe stupid question, which css file and where is it best to place the css parts?
#navCurrenciesWrapper a {
color: #ffffff;
text-decoration: none;
}
#navCurrenciesWrapper a:hover {
color: #000000;
text-decoration: none;
}
I tried stylesheet_new and stylesheet_old and it messed up the site. Any help would be gratefully appreciated.
Regards,
Russ
-
Re: Language/Currency Links in Header
it should go into your main override stylesheet, although really it can go into any sheet that gets auto-loaded. There's nothing in that style code that will mess up a site.
-
Re: Language/Currency Links in Header
bunyip,
Thank you for this contribution. Excellent work and just what I've been looking for! I do have a question for you. At this point, the language flags are next to the "Search" box on the right. I would like to position the flags right in the center of the header (both horizontally and vertically). What would be the best way to get that result? Thank you!:thumbsup:
-
Re: Language/Currency Links in Header
Great mod - I wanted these in the header from the start but just found your contribution yesterday.
I can't seem to get them lined up with the main nav. Tried switching placement of the code both in tpl_header.php and the style sheet. Even tried using a - top margin, but it just won't budge.
What am I doing wrong?
http://judysgems.com/ZenCart/
Judy
-
Re: Language/Currency Links in Header
Great mod, but i have a small problem.
I need the first flag to be in about 50px from the right. I tried using Margin and Padding in the stylesheet and got the same results with both.
If i use either, the first flag starts 50px in, but the 2nd flag is also 50px from the first flag.
I need the 1st flag 50px in and the 2nd and 3rd flags a few px separation.
Also, i can't get the flag to start a few px lower in the header. no matter margin or padding, it doesn't change higher or lower in position.
can you help please
-
Re: Language/Currency Links in Header
Is there a way for this to give a title tag of the currency or use the currency name in addition to the symbol?
Works fine on 1.3.7 by the way, not using the css code supplied, just code placement and looks fine. I also corrected it so as to validate found in the tpl_header_language file.(change absmiddle to middle)
-
Re: Language/Currency Links in Header
Has anyone yet found/posted a solution on how to change the code that the currency code appears instead of the currency symbol??
I saw it on a ZC live site (which I unfortunately cannot remember), so it works... but how?
Thx for help.
T.
-
3 Attachment(s)
Re: Language/Currency Links in Header
Another problem:
Using the magnify option in IE7 (lower right corner), the currency symbols mix up.
Screenshots included of
100%
125%
150%
Help is greatly appreciated. Thx.
T.
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
TMontana
Has anyone yet found/posted a solution on how to change the code that the currency code appears instead of the currency symbol??
I saw it on a ZC live site (which I unfortunately cannot remember), so it works... but how?
Thx for help.
T.
I have done this with my site
http://shop.dgbremner.com
Example CAD
1 Admin-->Localization --> Currencies
2 Edit the symbol left to display $
3 Edit the symbol right to display CAD, " " will add a space after your prices then the CAD, so customers know what currency they are dealing with during shopping.
4 do this with all the other currencies you wish to use.
5 go to shop/includes/modules/header_currencies.php and edit it to look like this:
$currencies_array[] = array('id' => $key, 'text' => (zen_not_null($value['symbol_right']) ? $value['symbol_right'] : $value['symbol_right']) );
That will display the CAD instead of the $.
-
Re: Language/Currency Links in Header
I'd love to figure out how to replace the text with images. In my case, I have 2 currencies, and I need one image displayed when the currency is not selected and another displayed when the currency is selected.
-
Re: Language/Currency Links in Header
I am also looking for replacing the currency symbol text with images. Does anyone know how to do that? Please advise. Thank you.
-
Re: Language/Currency Links in Header
How can I highlight the active or selected currency text in the header?
I am using the Currency/Language mod provided by Bunyip.
Thanks.
-
Re: Language/Currency Links in Header
this mod is great! I'd like to use the word english rather then have a flag is this possible?
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
joerod
this mod is great! I'd like to use the word english rather then have a flag is this possible?
i'd like the same thing, can someone help with how to do this?
thanks
nev
-
Re: Language/Currency Links in Header
Same here... let's say I have both english and french languages installed. I would like to have the word link "English" when the site is currently showing in french, and vice-versa.
Is this possible?
Thanks in advance!
-
Re: Language/Currency Links in Header
anyone have any ideas on this? would be a great addition to this great mod, thanks in advance!
-
Re: Language/Currency Links in Header
Hello.
I've uloaded the files to the root directory and added the code to the tpl_header.php but the mod does not show up. I use CherryZen. Where should this mod be turned on/of in the Amin?
-
Re: Language/Currency Links in Header
I have managed to get something working. Pretty basic code but it works fine.
$lang1 = $_SESSION["language"];
if ($lang1 == "french") {
// french text...
}
if ($lang1 == "english") {
// english text...
}
Hope it helps. It solved my problem.
-
Re: Language/Currency Links in Header
Hello.
I've put the code into the tpl_header.php but it didn't work. Where and how hould I put the code to.
Thank you for help.
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
gleb486
Hello.
I've put the code into the tpl_header.php but it didn't work. Where and how hould I put the code to.
Thank you for help.
is your tpl_header.php stored in the default_template or the custom template?
-
Re: Language/Currency Links in Header
Sorry I forgot to give some important information...
You need to download and apply the following add-on:
http://www.zen-cart.com/index.php?ma...roducts_id=107
Once applied, you will have a new file called tpl_header_languages.php in the same folder than tpl_header.php.
You need to edit that file. Originally it has the little country flags as links to change language but I wanted a simple word that would link to the opposite language.
Hope this helps.
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
diverpeter
is your tpl_header.php stored in the default_template or the custom template?
It is in defaul template.
-
Re: Language/Currency Links in Header
I've installed this contribution for currency to display in the header - fantastic, top right, just where I want it to appear. I'd like to add "tool tips", "title" and/or "alt" tags to each currency link. I'm looking in tpl_header_currencies.php:
$content = " ";
for ($i=0; $i<sizeof($currencies_array); $i++) {
$content .= '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('language')) . 'currency=' . $currencies_array[$i]['id'], $request_type) . '">' . $currencies_array[$i]['text'] . '</a> ';
}
echo $content;
?>
Please can anyone tell me how to call the currency code to appear when you mouse over the relevant currency symbol? USD, GBP, EUR, CAD and AUD are the ones that I have active.
As ever, my thanks in advance.
-
Re: Language/Currency Links in Header
At present, if you look at the currency symbols displayed in 'my' header, they are $ € £ $ $ - if I could get the "tool tip" alt"" or title"" to work, it would help identify the correct $ USD, CAD or AUD to the customer. I hope that someone can point me in the right direction.
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
spinnywoman
At present, if you look at the currency symbols displayed in 'my' header, they are $ € £ $ $ - if I could get the "tool tip" alt"" or title"" to work, it would help identify the correct $ USD, CAD or AUD to the customer. I hope that someone can point me in the right direction.
In the file, /includes/templates/[CUSTOM]/common/tpl_header.php
replace...
require(DIR_WS_MODULES . 'header_currencies.php');
with...
require(DIR_WS_MODULES . zen_get_module_directory('header_currencies.php'));
You can see an example at my store: http://www.serahsonline.com
To get the drop-down, I replaced everything in /includes/templates/templates_default/common/tpl_header_currencies.php with the following code:
$content = "";
$content .= zen_draw_form('currencies_form', zen_href_link(basename(ereg_replace('.php','', $PHP_SELF)), '', $request_type, false), 'get');
$content .= zen_draw_pull_down_menu('currency', $currencies_array, $_SESSION['currency'], 'onchange="this.form.submit();"') . $hidden_get_variables . zen_hide_session_id();
$content .= '</form>';
echo $content;
-
Re: Language/Currency Links in Header
Hi.
I have installed bunyip's most excellent currency header mod and it works fine. However, an ongoing issue I have is attempting to display a preferred sort order of the currencies.
I only have GBP, EUR and USD and this is the order I wish to achieve.
See: www.prestigeringcompany.com/index.php and you will note the order is USD, EUR, GBP
I have deleted and reset the currencies to try and change the order and I have tried kuroi's fix and changed the currency title to try and influence any alphabetic sort, etc... but I am having no luck and slowly going mad...
Would anybody know how I can achieve the preferred sort order of GBP EUR USD ...???
Thank you kindly in advance...
Steve
-
Re: Language/Currency Links in Header are Doubled
I am using Zen Cart 1.3.8a.
I tried Language/Currency contribution.
My Language gets doubled. One flag appears in a header, another one appears to be not in a right column but sort of higher, between the header and the main table.
Tried to do it several times, the same thing happens.
The one which appears in the right below the header is not the sidebox, because it is off in Admin.
Can you guys help?
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
121webconsultancy
Hi.
I have installed bunyip's most excellent currency header mod and it works fine. However, an ongoing issue I have is attempting to display a preferred sort order of the currencies.
I only have GBP, EUR and USD and this is the order I wish to achieve.
See:
www.prestigeringcompany.com/index.php and you will note the order is USD, EUR, GBP
I have deleted and reset the currencies to try and change the order and I have tried kuroi's
fix and changed the currency title to try and influence any alphabetic sort, etc... but I am having no luck and slowly going mad...
Would anybody know how I can achieve the preferred sort order of GBP EUR USD ...???
Thank you kindly in advance...
Steve
Hello,
Also trying to get the above. Any solution pls?
Thank you
-
Re: Language/Currency Links in Header
Berserker,
The problem is that Zen Cart doesn't have a built-in sort order capability for currencies like it has for languages. You would have to modify your admin currencies page and the database currencies table in order to implement a sort order.
Here's the steps to do so - please make a backup of your database and affected files first!
1. Add the sort order field to the currencies table - run this query from Admin > Tools > Install SQL Patches:
PHP Code:
ALTER TABLE currencies ADD sort_order INT(3) NOT NULL DEFAULT '0';
2. Edit admin/currencies.php so you can enter a sort order:
after this line (line 42):
PHP Code:
$value = zen_db_prepare_input((float)$_POST['value']);
add this line
PHP Code:
$sort_order = zen_db_prepare_input($_POST['sort_order']);
edit the sql query at line 45 so it reads:
PHP Code:
$sql_data_array = array('title' => $title,
'code' => $code,
'symbol_left' => $symbol_left,
'symbol_right' => $symbol_right,
'decimal_point' => $decimal_point,
'thousands_point' => $thousands_point,
'decimal_places' => $decimal_places,
'value' => $value,
'sort_order' => $sort_order);
before this line at line 200,
PHP Code:
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
add this line:
PHP Code:
<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_SORT_ORDER; ?></td>
Edit the query at line 204 so it reads:
PHP Code:
$currency_query_raw = "select currencies_id, title, code, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, last_updated, value, sort_order from " . TABLE_CURRENCIES . " order by sort_order";
after this line at line 225,
PHP Code:
<td class="dataTableContent" align="right"><?php echo number_format($currency->fields['value'], 8); ?></td>
add this line
PHP Code:
<td class="dataTableContent" align="right"><?php echo $currency->fields['sort_order']; ?></td>
After this line at line 269,
PHP Code:
$contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_VALUE . '<br>' . zen_draw_input_field('value'));
add this line
PHP Code:
$contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_SORT_ORDER . '<br>' . zen_draw_input_field('sort_order'));
After this line at line 286
PHP Code:
$contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_VALUE . '<br>' . zen_draw_input_field('value', $cInfo->value));
add this line
PHP Code:
$contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_SORT_ORDER . '<br>' . zen_draw_input_field('sort_order', $cInfo->sort_order));
3. Add the two new language definitions to admin/includes/languages/english/currencies.php (or to a new file in admin/includes/languages/english/extra_definitions/)
PHP Code:
define('TABLE_HEADING_SORT_ORDER', 'Sort Order');
define('TEXT_INFO_CURRENCY_SORT_ORDER', 'Sort Order:');
4. Edit the file includes/classes/currencies.php (this is a core file - no override capability)
Modify the query at line 27 to read:
PHP Code:
$currencies_query = "select code, title, symbol_left, symbol_right, decimal_point,
thousands_point, decimal_places, value, sort_order
from " . TABLE_CURRENCIES . " order by sort_order";
You should be done...now you can add/edit sort orders for the currencies from admin, and they should be displayed in that order in the header.
-
Re: Language/Currency Links in Header
Hi,
As per an earlier post, I've modified the currency display into a drop down list by replacing all the codes in tpl_header_currencies with:
$content = "";
$content .= zen_draw_form('currencies_form', zen_href_link(basename(ereg_replace('.php','', $PHP_SELF)), '', $request_type, false), 'get');
$content .= zen_draw_pull_down_menu('currency', $currencies_array, $_SESSION['currency'], 'onchange="this.form.submit();"') . $hidden_get_variables . zen_hide_session_id();
$content .= '</form>';
echo $content;
?>
However the drop down list displays the currency with my left symbol (US$, S$ etc). I'm trying to display the full title of the respective currency instead (US Dollar, Singapore Dollar etc), just like that on http://www.serahsonline.com
Will some kind soul please advise on this? Thanks!
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
missy eiinix
Hi,
As per an earlier post, I've modified the currency display into a drop down list by replacing all the codes in tpl_header_currencies with:
$content = "";
$content .= zen_draw_form('currencies_form', zen_href_link(basename(ereg_replace('.php','', $PHP_SELF)), '', $request_type, false), 'get');
$content .= zen_draw_pull_down_menu('currency', $currencies_array, $_SESSION['currency'], 'onchange="this.form.submit();"') . $hidden_get_variables . zen_hide_session_id();
$content .= '</form>';
echo $content;
?>
However the drop down list displays the currency with my left symbol (US$, S$ etc). I'm trying to display the full title of the respective currency instead (US Dollar, Singapore Dollar etc), just like that on
http://www.serahsonline.com
Will some kind soul please advise on this? Thanks!
Edit your copy of includes/modules/header_currencies.php
replace this line:
PHP Code:
$currencies_array[] = array('id' => $key, 'text' => (zen_not_null($value['symbol_left']) ? $value['symbol_left'] : $value['symbol_right']) );
with this:
PHP Code:
$currencies_array[] = array('id' => $key, 'text' => $value['title']);
-
Re: Language/Currency Links in Header
Thanks, that worked perfectly!
-
Re: Language/Currency Links in Header
Hello anyone note that this Language/Currency header disapper on all the Checkout pages?
-
Re: Language/Currency Links in Header
Hello bunyip I just read your very first post and see that you keep the code to prevernt this header show on all Checkout pages. How if I really want to remove these code? Or at least just show the Language header? It's really necessary for me. Thanks!
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
cocteau
Hello bunyip I just read your very first post and see that you keep the code to prevernt this header show on all Checkout pages. How if I really want to remove these code? Or at least just show the Language header? It's really necessary for me. Thanks!
To have the language links display on the checkout pages, edit includes/modules/header_languages.php
change this section of code at lines 12-18:
PHP Code:
// test if box should display
$show_currencies= false;
// don't display on checkout page:
if (substr($current_page, 0, 8) != 'checkout') {
$show_currencies= true;
}
to be just:
PHP Code:
// test if box should display
$show_currencies= true;
Make exactly the same edit to the file includes/modules/header_currencies.php if you want the currency links to display on checkout pages.
-
Re: Language/Currency Links in Header
Thank so much for the reply. :smile:
-
Re: Language/Currency Links in Header
A download a: Contribution: Language/Currency Links in Header
Hay to install?
Whare to put code into tpl_header.php?
<!-- bof languages/currencies header display -->
<div id="navCurrenciesWrapper" class="forward">
<?php
if (HEADER_LANGUAGES_DISPLAY == 'True') require(DIR_WS_MODULES . 'header_languages.php');
if (HEADER_CURRENCIES_DISPLAY == 'True') require(DIR_WS_MODULES . 'header_currencies.php');
?>
</div>
<!-- eof languages/currencies header display -->
I trie to put code on end in file end nothing happen.
Whare to put new classes to my stylesheet so I can control the format of the currency links?
#navCurrenciesWrapper a {
color: #ffffff;
text-decoration: none;
}
#navCurrenciesWrapper a:hover {
color: #000000;
text-decoration: none;
}
-
Re: Language/Currency Links in Header
hey, thanks so much for this! I wanted this in the footer actually so I just switched everything that said header to footer and it works great!
-
Re: Language/Currency Links in Header
Hello there,
Installed this mod and working correctly. Just wondering, how do I get it to display the code instead of symbol? For example, I would like to display GBP instead of £.
Thanks
-
Re: Language/Currency Links in Header
Fantastic! This worked perfectly! I used it in the footer instead (granted the naming convention is a little off then in the Admin but eh..hehehe)
Thanks for the solution! (glad I searched the forums before working the hack out on my own)
-
Re: Language/Currency Links in Header
This mod is great, but is there a way to make the Language into a dropdown box with the language names instead of images? I managed to get a dropdown box for currencies, but can't get it to work for languages. The dropdown box shows up, but there are no values.
Thanks!
-
Re: Language/Currency Links in Header
Need some help here. Real newbie :frusty:
I have 1.3.8 version and I want to move my currency and language up to the right side of the navigation bar in header. I have tried to download a free mod
Contribution: Language/Currency Links in Header
Version: 1.0
Designed for: Zen Cart v1.3.0.1
Designed by: Neville Kerr
License: under the GPL - See attached License for info.
Support: Only given via the forums, please.
I just can't get it to work. Also when I try to turn off from Admin/layout box controller/sideboxes... nothing happens when I switch to off. I am working on a localhost.
Any patient guidance would be great :bigups:
-
Re: Language/Currency Links in Header
ZC 1.3.8
I want to use this module, but I have a completely custom header. Not using the boxes thing that ZC is so famous for.
The client wants to place flags for NZ & US on the header. We are currently in the US and the entire website is US. So we are basically adding NZ.
Can we use this module without using the boxes?
I'm trying to figure out if this is going to be a good fit for us. If not, then I'm open to suggestions.
The client definitely wants flag and not drop down.
if you want to see the website, you can go to www.martekdavits.com
Thanks for your help.
Michelle
-
Re: Language/Currency Links in Header
Just wanted to say that I installed this module and made some modifications mentioned in previous posts (show drop-down box and full currency name instead of symbol). Everything works perfectly and it can be seen at Athens Collectibles displaying on the right of the navigation bar.
Many thanks to the writer and contributors to amendments for this very nice module. :bigups:
-
Re: Language/Currency Links in Header
Great plugin! Is it possible to use images instead of the currency symbol such as how the language use flags as images?
-
Re: Language/Currency Links in Header
will this be working for zc v1.3.9? is there an updated version? thanks.:smile:
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
elaineben
will this be working for zc v1.3.9? is there an updated version? thanks.:smile:
I have it installed on 139h and is working well.
-
Re: Language/Currency Links in Header
Hello.
I need the language for this contribute to show up as dropdown <select> . can anyone help put please.
thanks.
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
tony_sar
Hello.
I need the language for this contribute to show up as dropdown <select> . can anyone help put please.
thanks.
anyone ??? someone ?? :unsure:
-
Re: Language/Currency Links in Header
I have this mod installed for months and it's working fine as I reported in a previous post. I recently upgraded to Zen Cart 1.5 and it still works without any problem.
Just because I'm an uneasy mind, I have tried to change the currency drop-down box to display a small flag next to the currency title. I added the image tag before the currency and, although it looks nice on the Administration site, it displays the image code as text within the drop-down. The screenshot below is self explanatory:
I know that it should be fairly easy for the developer to point me to the right direction. Unfortunately, I'm not a PHP programmer and can not figure out which file to change and how.
Any help will be much appreciated. I hope that this thread is still monitored after many months of inactivity.
-
Re: Language/Currency Links in Header
you can not show image in dropdown select box using html .. you may have to use jquery or ajax / javascript to achieve this .
-
Re: Language/Currency Links in Header
Quote:
you can not show image in dropdown select box using html .. you may have to use jquery or ajax / javascript to achieve this
Having searched a lot on the web before posting here, I was afraid that this would be the case. Just hoped that somebody had found a way to achieve it.
Anyway, thanks for the reply and wishes for a nice day from a snowing Athens.
-
Re: Language/Currency Links in Header
-
Re: Language/Currency Links in Header
Thank you tony_sar, I had already found this page when searching the web. It looks like the solution but needs programming beyond my skills. :blink:
-
Re: Language/Currency Links in Header
I just installed this mod in a 1.3.9h site, and like others, I can report it works fine. I made one slight change. In the includes/templates/MY_TEMPLATE/common/tpl_header_currencies.php file, I changed...
PHP Code:
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">';
... to ...
PHP Code:
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="header_currency">';
I did that to get a distinct class name to make it easy to style the dropdown (and to get rid of some inherited styles which I didn't want.)
Also, as you probably just noticed, I installed the dropdown in my header, so I changed a couple of filenames and their references in the files themselves, just replacing 'footer' with 'header'.
Thanks for the mod!
Rob
-
Re: Language/Currency Links in Header are Doubled
I have a website with two languages, Chinese and English. I'm creating a responsive layout now, so I want to loose most of the clutter.
For the languages I want to display only the language that is NOT active, so it is a switch button.
I'm a newby...
I've installed the currency language in header mod, and have tried to implement the solution from MarcWon, to show one flag only. Stripped the tpl_language_header.php as well as the modules/languages_header.php but I somehow either end up with a page only showing the stuff that's before the flags in the header, or with both flags.
This is the solution that MarcWon said worked for his problem, but I cannot get it to work.
-
Re: Language/Currency Links in Header are Doubled
Hi, is this module on the plugin page still compatible with the latest zen cart v1.5.1?
-
Re: Language/Currency Links in Header are Doubled
Hi,
I don't know if it's officially marked as compatible but it works fine on my site after upgrading to 1.5.1
I hope this helps.
-
Re: Language/Currency Links in Header are Doubled
-
Re: Language/Currency Links in Header are Doubled
I installed this and I have one flag image (when clicked oni t does nothing) and the currency symbols are working as links. I would like to use the images of flags as links. I download the flag gifs by bunyip and then when I look at my zencart it has 5 flags and the currency symbols side by side. Should I keep the flag gifs as one image? or do I need to separate them? and how to make flags as links? what do I need to edit?
I have copied all files to correctly folders and successfully applied the sql instructions.
In admin>config>layout settings I can see the 2 new additions and they are set to true. I am running this on my local machine using xampp.
Any help would be appreciated.:huh:
-
Re: Language/Currency Links in Header are Doubled
I found the solution for adding flags as links instead of the currency symbol in another post THANKS TO RBARBOUR.
At present I have got it to display the flags and the links are working but its still displaying currency symbols also. I am still working on it.
However if you want to achieve this, look at the suggestion in the link below.
http://www.zen-cart.com/showthread.p...ge+link+header
Basically go to your tpl_header_currencies and give the link an ID:
$content = " ";
for ($i=0; $i<sizeof($currencies_array); $i++) {
$content .= '<a id="navTopCurrencyId' . $currencies_array[$i]['id'] . '"' . 'href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('language')) . 'currency=' . $currencies_array[$i]['id'], $request_type) . '">' . $currencies_array[$i]['text'] . '</a> ';
}
echo $content;
?>
and then add in your css style sheet this css.
#navTopCurrencyIdUSD {
padding:0px 2px 7px 30px;
background-image: url(../images/USD.png);
background-repeat:no-repeat;
}
and repeat it for each flag.
-
Re: Language/Currency Links in Header
Finally, I've updated Language/Currency Links in Header for Zen Cart 1.55f including Mobile/Responsive Template files!
It should be available shortly in the forum and as always on my site.
How it works:
- You can now display the language icons (flags) and currency symbols as links in the navigation section of your header.
- Switch displays in the line below the Home/Log In/Shopping Cart header and by default floats to the right WITH the search header ON/OFF (desktop).
- Loads below main logo on all mobile pages to prevent conflict with stock menu flyout (mobile).
- In Admin > Configuration > Layout Settings - Turn Languages/Currencies ON/OFF
Key Features
- Installs into Template Default, Responsive_Classic and YOUR_TEMPLATE
- Design notes included for easy updates - CSS styling
- Compatible with text-icon swap for currency display
- Code is split to display on mobile/responsive or desktop with separate CSS
Install Into:
- Admin, Live Site
Works With:
- All Twitch Modules
Note: This module is compatible with post #64:
https://www.zen-cart.com/showthread....34#post1214534
If my work has helped you today in any way, show your appreciation with things like positive feedback or donations.
-
Re: Language/Currency Links in Header
For those wanting to add the currency 'code' or currency ID to the desktop header display...
Stock Display:
Language [Flag] $ € £ $ $
Add ID to Display:
Language [Flag] USD $ EUR € GBP £ CAD $ AUD $
includes/templates/YOUR_TEMPLATE/common/tpl_header_currencies.php
replace line 13
$content .= '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('language')) . 'currency=' . $currencies_array[$i]['id'], $request_type) . '">' . $currencies_array[$i]['text'] . '</a> ';
with this:
$content .= '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('language')) . 'currency=' . $currencies_array[$i]['id'], $request_type) . '">' . $currencies_array[$i]['id'] . ' ' . $currencies_array[$i]['text'] . '</a> ';
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
cocteau
Hello anyone note that this Language/Currency header disapper on all the Checkout pages?
Reminder in case this answer got lost...
The code is designed to be hidden during checkout by default to ensure the language and currency is maintained during the checkout before passing data to API's and the like...
includes/modules/YOUR_TEMPLATE/header_currencies.php
PHP Code:
// test if box should display
$show_currencies= false;
// don't display on checkout page:
if (substr($current_page, 0, 8) != 'checkout') {
$show_currencies= true;
}
-
Re: Language/Currency Links in Header
There now exists an add-on upgrade pack for this module:
Twitch Add Sort Order Control to Language/Currency Links in Header
This module will install sort_order into your already installed 'Language/Currency Links in Header' module and allow use of the new sort field in Admin > Localization > Currencies
The default function of the stock header_currencies is to simply print out each value found in the currency array one at a time matched to the order found in the DB [currency ID]. This doesn't allow control of display unless the ID hard code is changed. So I added a sort_order column to ensure anything using the code, title or currency ID will NOT be affected sitewide. I have also limited the data manipulation using sort to the final - currency header display only.Because this module installs using NULL in the sort_order:
- Admin will display alphabetically by currency name until there are sort orders to sort through
- If the code can not resolve a sort conflict it will get screwy and follow the next logical output possible - likely title.
As an added feature:
The admin display sort order is ALSO the sort order used on the live site.
- That means you will see immediately the order the site will display in admin each time you update the sort order.
- This will help prevent duplicate sort order # problems also :)
This add on module is available on my site and I am in the process of merging it with the recent Language/Currency Links in Header v2.0 for v2.1 release shortly!
-
Re: Language/Currency Links in Header
ZC Version 1.5.6a and I have very little modifications made to the stock files...
I got this to work on my site. Managed to have the currency ID show by changing in Localisation de Symbol to the Symbol and ID which in my case, helps. Now it shows as I want it on desktop and mobile but can't make it show on tablet. Am I doing something of when specified mobile below it is because it is mobile only? And if that is the case, can you offer some pointers on having it show on tablet?
thanks you
Quote:
Originally Posted by
twitchtoo
Finally, I've updated
Language/Currency Links in Header for
Zen Cart 1.55f including
Mobile/Responsive Template files!
It should be available shortly in the forum and as always on my site.
How it works:
- You can now display the language icons (flags) and currency symbols as links in the navigation section of your header.
- Switch displays in the line below the Home/Log In/Shopping Cart header and by default floats to the right WITH the search header ON/OFF (
desktop).
- Loads below main logo on all mobile pages to prevent conflict with stock menu flyout (
mobile).
- In Admin > Configuration > Layout Settings -
Turn Languages/Currencies ON/OFF
Key Features
- Installs into Template Default, Responsive_Classic and YOUR_TEMPLATE
- Design notes included for easy updates - CSS styling
- Compatible with text-icon swap for currency display
- Code is split to display on mobile/responsive or desktop with separate CSS
Install Into:
- Admin, Live Site
Works With:
- All Twitch Modules
Note: This module is compatible with post #64:
https://www.zen-cart.com/showthread....34#post1214534
If my work has helped you today in any way, show your appreciation with things like
positive feedback or
donations.
-
Re: Language/Currency Links in Header
I found this code that calls to both mobile and tablet... and it works on mobile but it doesn't detect it on my tablet
Quote:
<?php if ( $detect->isMobile() && !$detect->isTablet() || $_SESSION['layoutType'] == 'mobile' ) { ?>
<!-- <div id="navMainSearch1" class="forward"><?php // require(DIR_WS_MODULES . 'sideboxes/search_header.php'); ?></div> -
Quote:
Originally Posted by
mariemeh
ZC Version 1.5.6a and I have very little modifications made to the stock files...
I got this to work on my site. Managed to have the currency ID show by changing in Localisation de Symbol to the Symbol and ID which in my case, helps. Now it shows as I want it on desktop and mobile but can't make it show on tablet. Am I doing something of when specified mobile below it is because it is mobile only? And if that is the case, can you offer some pointers on having it show on tablet?
thanks you
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
mariemeh
I found this code that calls to both mobile and tablet... and it works on mobile but it doesn't detect it on my tablet
What is the tablet make/model?
-
Re: Language/Currency Links in Header
My apologies, I forgot to include that info
iPad 4th A1460
Quote:
Originally Posted by
twitchtoo
What is the tablet make/model?
-
Re: Language/Currency Links in Header
Figured it out. Just in case someone else needs this, the code you added underneatch mobile needs to be added as well under tablet and all is now working. I'm no pro so if there is something wrong with this, please feel free to say.
shop/includes/templates/responsive_classic/common/tpl_header.php
Code:
<!-- bof languages/currencies header display -->
<div id="navCurrenciesWrapperMobile" class="notforward clearBoth">
<?php
if (HEADER_LANGUAGES_DISPLAY == 'true') require(DIR_WS_MODULES . 'header_languages.php');
if (HEADER_CURRENCIES_DISPLAY == 'true') require(DIR_WS_MODULES . 'header_currencies.php');
?>
</div>
<!-- eof languages/currencies header display -->
<?php } else if ( $detect->isTablet() || $_SESSION['layoutType'] == 'tablet' ) { ?>
<!-- <div id="navMainSearch1" class="forward"><?php // require(DIR_WS_MODULES . 'sideboxes/search_header.php'); ?></div> -->
<!-- bof languages/currencies header display -->
<div id="navCurrenciesWrapperMobile" class="notforward clearBoth">
<?php
if (HEADER_LANGUAGES_DISPLAY == 'true') require(DIR_WS_MODULES . 'header_languages.php');
if (HEADER_CURRENCIES_DISPLAY == 'true') require(DIR_WS_MODULES . 'header_currencies.php');
?>
</div>
<!-- eof languages/currencies header display -->
Quote:
Originally Posted by
twitchtoo
What is the tablet make/model?
-
Re: Language/Currency Links in Header
Hi guys, does anybody know how to implement switching language/currencies as a small drop-down menus with a simple text instead of flags. Would appreciate a hint where to find a simple script for that purpose...
-
Re: Language/Currency Links in Header
includes/templates/YOUR_TEMPLATE/common/tpl_header_languages.php and tpl_header_currencies.php build the output display.
You can use the zen dropdown function to convert to dropdowns, just hide/replace the image/link code for $content .=
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
twitchtoo
includes/templates/YOUR_TEMPLATE/common/tpl_header_languages.php and tpl_header_currencies.php build the output display.
You can use the zen dropdown function to convert to dropdowns, just hide/replace the image/link code for $content .=
From what I see in my case:
includes/templates/YOUR_TEMPLATE/common/tpl_header.php build the output.
I can't find the file tpl_header_languages.php
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
Ingar
From what I see in my case:
includes/templates/YOUR_TEMPLATE/common/tpl_header.php build the output.
I can't find the file tpl_header_languages.php
https://www.zen-cart.com/downloads.php?do=file&id=30
Have you installed the module into YOUR_TEMPLATE ?
-
Re: Language/Currency Links in Header
Quote:
Have you installed the module into YOUR_TEMPLATE ?
Yea I considered responsive classic as mine and now I discovered the two mentioned files sitting in includes/templates/template_default/common/
Should I copy the tpl_header_languages.php into responsive_classic? Removing I guess everything after in this lane:
Code:
$content .= '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type) . '">' . zen_image(DIR_WS_LANGUAGES . $value['directory'] . '/images/' . $value['image'], $value['name'], '', '', 'align="absmiddle"') . '</a> ';
-
Re: Language/Currency Links in Header
All of the template override files in the default folder can be copied into the override template folder YOUR_TEMPLATE or responsive_classic as you mentioned.
I would make the move, upload and test to see they are working before changing any of the code. That will preserve your default fileset and prevent breaking the rule of 'one change at a time'.
-
Re: Language/Currency Links in Header
Is there any way to change the order of the currency choices i.e. to have the AUD$ appear first instead of the USD$? Thanks.
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
tctc
Is there any way to change the order of the currency choices i.e. to have the AUD$ appear first instead of the USD$? Thanks.
Which do you have listed as default?
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
tctc
Is there any way to change the order of the currency choices i.e. to have the AUD$ appear first instead of the USD$? Thanks.
Admin > Localization > Currencies > select Currency, click Edit, add sort order to each currency listed.
Refresh the live site when you have finished to see the new sort order.
-
Re: Language/Currency Links in Header
-
Re: Language/Currency Links in Header
There is no way to change the sort order in 1.5.6 but I have AUD as default currency and that does not make any difference. Thanks.
-
Re: Language/Currency Links in Header
There is not any option to do this?
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
tctc
There is no way to change the sort order in 1.5.6 but I have AUD as default currency and that does not make any difference. Thanks.
The current module version has not been tested with 1.56c. All Twitch and public Zen modules are being re-written for 1.56c in funded priority at the moment :)
-
Re: Language/Currency Links in Header
-
Re: Language/Currency Links in Header
There is a new version of this module available for 1.56c with minor bugs fixed and some new features to make it easier to use/install. I'll be packing it up shortly for public release!
-
Re: Language/Currency Links in Header
I downloaded this plugin and wanted to use it for v1.5.7c on a php 7.4.16 site.
Originally the plugin is for v1.5.5 so I compared the original templates with the plugin templates and adjusted them for v1.5.7c
This will work only if your site php is lower than php 7.2
Because each() function is deprecated in php 7.2 you'll get a lot of error logs.
A search in the forum didn't give me any solution but Google found one that I could work out further:
If your site is php 7.2 or higher than find all instances of "each" like:
\includes\modules\header_currencies.php
Replace
PHP Code:
<?php
while (list($key, $value) = each($currencies->currencies)) {
By
PHP Code:
<?php
foreach($currencies->currencies as $key => $value) {
Replace
PHP Code:
<?php
while (list($key, $value) = each($_GET)) {
By
PHP Code:
<?php
foreach($_GET as $key => $value) {
\includes\templates\template_default\common\tpl_header_languages.php
Replace
PHP Code:
<?php
while (list($key, $value) = each($lng->catalog_languages)) {
By
PHP Code:
<?php
foreach ($lng->catalog_languages as $key => $value) {
Changes in ALL_TEMPLATES\common\tpl_header.php for v1.5.7c are more extensive and include a change so it will fit for multi-lingual shops that have customers in whose language the word "language" isn't "language". This word is hard-coded in the file.
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
Philibel
Changes in ALL_TEMPLATES\common\tpl_header.php for v1.5.7c are more extensive and include a change so it will fit for multi-lingual shops that have customers in whose language the word "language" isn't "language". This word is hard-coded in the file.
My adaptation of the plugin works fine for me and as a member of the community of ZenCart users, I thought it would only be fair to share it with others users. So I submitted my version of this plugin which I tested and use for Zen Cart v1.5.7c on a php 7.4.16 site.
I has been approved and is available for download Language/Currency Links in Header version v3.0
-
Re: Language/Currency Links in Header
Hi,
I am installing this addon into a fresh v.1.5.8 test site. I have uploaded all files and when running the SQLpatch from Admin, I get a white screen error and this in my Error Logs....
#1 trigger_error() called at [C:\wamp64\www\158\includes\classes\db\mysql\query_factory.php:667]
#2 queryFactory->show_error() called at [C:\wamp64\www\158\includes\classes\db\mysql\query_factory.php:634]
#3 queryFactory->set_error() called at [C:\wamp64\www\158\includes\classes\db\mysql\query_factory.php:275]
#4 queryFactory->Execute() called at [C:\wamp64\www\158\ADMIN\sqlpatch.php:297]
#5 executeSql() called at [C:\wamp64\www\158\ADMIN\sqlpatch.php:744]
#6 require(C:\wamp64\www\158\ADMIN\sqlpatch.php) called at [C:\wamp64\www\158\ADMIN\index.php:11]
--> PHP Fatal error: 1366:Incorrect integer value: '' for column 'configuration_id' at row 1 :: INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('', 'Show Languages in Header?', 'HEADER_LANGUAGES_DISPLAY', 'true', 'Display the Languages flags/links in Header?', 19, 170, NULL, now(), NULL, 'zen_cfg_select_option(array(''true'', ''false''), '); ==> (as called by) C:\wamp64\www\158\ADMIN\sqlpatch.php on line 297 <== in C:\wamp64\www\158\includes\classes\db\mysql\query_factory.php on line 667.
Can you point me the right direction to correct this to finish the install of this mod??
Thank you for your help,
Jeff
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
NWCE
Hi,
I am installing this addon into a fresh v.1.5.8 test site. I have uploaded all files and when running the SQLpatch from Admin, I get a white screen error and this in my Error Logs....
#1 trigger_error() called at [C:\wamp64\www\158\includes\classes\db\mysql\query_factory.php:667]
#2 queryFactory->show_error() called at [C:\wamp64\www\158\includes\classes\db\mysql\query_factory.php:634]
#3 queryFactory->set_error() called at [C:\wamp64\www\158\includes\classes\db\mysql\query_factory.php:275]
#4 queryFactory->Execute() called at [C:\wamp64\www\158\ADMIN\sqlpatch.php:297]
#5 executeSql() called at [C:\wamp64\www\158\ADMIN\sqlpatch.php:744]
#6 require(C:\wamp64\www\158\ADMIN\sqlpatch.php) called at [C:\wamp64\www\158\ADMIN\index.php:11]
--> PHP Fatal error: 1366:Incorrect integer value: '' for column 'configuration_id' at row 1 :: INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('', 'Show Languages in Header?', 'HEADER_LANGUAGES_DISPLAY', 'true', 'Display the Languages flags/links in Header?', 19, 170, NULL, now(), NULL, 'zen_cfg_select_option(array(''true'', ''false''), '); ==> (as called by) C:\wamp64\www\158\ADMIN\sqlpatch.php on line 297 <== in C:\wamp64\www\158\includes\classes\db\mysql\query_factory.php on line 667.
Can you point me the right direction to correct this to finish the install of this mod??
Thank you for your help,
Jeff
Change that SQL patch from
Code:
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('', 'Show Languages in Header?', 'HEADER_LANGUAGES_DISPLAY', 'true', 'Display the Languages flags/links in Header?', 19, 170, NULL, now(), NULL, 'zen_cfg_select_option(array(''true'', ''false''), ');
to
Code:
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('Show Languages in Header?', 'HEADER_LANGUAGES_DISPLAY', 'true', 'Display the Languages flags/links in Header?', 19, 170, NULL, now(), NULL, 'zen_cfg_select_option(array(''true'', ''false''), ');
... essentially removing that configuration_id value that's invalid (the SQL processing will automatically calculate the next available value).
-
Re: Language/Currency Links in Header
Thanks very much for your help with this lat 9....this worked perfectly!!
Appreciate it,
Jeff
-
Re: Language/Currency Links in Header
Hello,
I made a release of this module for Zen Cart v1.5.8. I removed css file which was not doing as expected and I prefer a thin bar at the top (styles make it thicker). Language flag for the actually used language is not displayed any more, only other available languages flags are, Same thing with currencies.
It works well but I made a mistake in the release with sql queries for install/uninstall. I stupidly did copy these queries from old version when making new release file. They must be corrected as stated above by lat9.
Remove and and everything should be fine. I already submitted a corrected version few days ago but for any reason it has not been approved yet. Until it is available please do the modification above on sql queries.
This small plugin is really a 'plus' in any multilingual Zen Cart, you should try it.
-
Re: Language/Currency Links in Header
I have just submitted a version4.0.2 in plugin section that add a file for template Bootstrap which structure is quite different than standard templates.
-
2 Attachment(s)
Re: Language/Currency Links in Header
Perhaps I'm doing something wrong, but I tried the latest on a test Bootstrap site, and there's nothing being displayed in the header.
It looks like the code is there, but no output is displayed because it's nothing but white-space.
I am attaching two screenshots. The first shows that nothing is displayed (I highlighted it with a blue box). The second shows the page source where you can see the output block is there but only white-space is noted where the content should be.
Attachment 20411
Attachment 20412
Any ideas why that's happening?
-
Re: Language/Currency Links in Header
Quote:
Originally Posted by
Jeff_Mash
Perhaps I'm doing something wrong, but I tried the latest on a test Bootstrap site, and there's nothing being displayed in the header.
It looks like the code is there, but no output is displayed because it's nothing but white-space.
I am attaching two screenshots. The first shows that nothing is displayed (I highlighted it with a blue box). The second shows the page source where you can see the output block is there but only white-space is noted where the content should be.
Attachment 20411
Attachment 20412
Any ideas why that's happening?
Just to check, you need at least two languages/currencies installed for this to work. Actually used language/currency is not displayed.
It looks like something is missing. Did you installed files in template_default, they are necessary.
The only problem I found that still need to be fixed is color diplay for currencies. Default is blue (link) and does not go well with dark background.
-
Re: Language/Currency Links in Header
Okay, thanks for the clarification. I was under the assumption that the plugin itself would offer a dropdown list of translations and currencies. I wasn't aware that it relied on what already preexisted from the store. Now it makes sense why nothing was displayed, because we currently only have one currency (USD) and one language file (English).
-
Re: Language/Currency Links in Header
I have just submitted version 4.0.3 in plugin section:
https://www.zen-cart.com/downloads.php?do=file&id=30
It will now display currencies links in Bootstrap template in a visible color and you can easily customize this by modifying css file.
Instruction/descrition have been updated too.
-
Re: Language/Currency Links in Header
Great work thanks.
Is is possible to make the currencies appear in a pull-down menu?
How to do this?