If this is your first visit, check our documentation. To post, register or login.
Forums / All Other Contributions/Addons / Language/Currency Links in Header

Language/Currency Links in Header

Started by bunyip on 1 Jun 2006, 7:44 AM · Views: 47,439

Results 21 to 40 of 121
17 Sep 2008, 2:12 AM
#21
marcwon avatar

marcwon

New Zenner

Join Date:
May 2008
Posts:
3
Plugin Contributions:
0

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.

18 Sep 2008, 11:22 AM
#22
gleb486 avatar

gleb486

New Zenner

Join Date:
Aug 2008
Posts:
19
Plugin Contributions:
0

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.

19 Sep 2008, 9:14 AM
#23
diverpeter avatar

diverpeter

New Zenner

Join Date:
May 2008
Posts:
35
Plugin Contributions:
0

Re: Language/Currency Links in Header

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?

Have Fun. Keep it Zennish!

Visit My Zen Cart Blog at Zen48

19 Sep 2008, 1:12 PM
#24
marcwon avatar

marcwon

New Zenner

Join Date:
May 2008
Posts:
3
Plugin Contributions:
0

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?main_page=product_contrib_info&products_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.

20 Sep 2008, 12:43 AM
#25
gleb486 avatar

gleb486

New Zenner

Join Date:
Aug 2008
Posts:
19
Plugin Contributions:
0

Re: Language/Currency Links in Header

diverpeter:

is your tpl_header.php stored in the default_template or the custom template?

It is in defaul template.

23 Sep 2008, 9:06 AM
#26
spinnywoman avatar

spinnywoman

Zen Follower

Join Date:
Jul 2004
Location:
Oxford
Posts:
101
Plugin Contributions:
0

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.

Ruth

30 Sep 2008, 9:05 AM
#27
spinnywoman avatar

spinnywoman

Zen Follower

Join Date:
Jul 2004
Location:
Oxford
Posts:
101
Plugin Contributions:
0

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.

Ruth

10 Oct 2008, 9:04 AM
#28
serahs avatar

serahs

New Zenner

Join Date:
Mar 2008
Posts:
11
Plugin Contributions:
0

Re: Language/Currency Links in Header

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;**

Serah's - Getting Clean Never Looked So Good!
https://www.serahsonline.com

31 Dec 2008, 4:59 PM
#29
121webconsultancy avatar

121webconsultancy

New Zenner

Join Date:
May 2007
Posts:
42
Plugin Contributions:
0

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

121webconsultancy - Professional Website Design & Internet Marketing

9 Mar 2009, 11:07 PM
#30
alyona avatar

alyona

New Zenner

Join Date:
Feb 2009
Posts:
12
Plugin Contributions:
0

Re: Language/Currency Links in Header

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?

19 May 2009, 2:04 AM
#31
berserker avatar

berserker

Totally Zenned

Join Date:
May 2006
Posts:
712
Plugin Contributions:
0

Re: Language/Currency Links in Header

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

19 May 2009, 4:31 AM
#32
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

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:
ALTER TABLE currencies ADD sort_order INT(3) NOT NULL DEFAULT '0';
  1. Edit admin/currencies.php so you can enter a sort order:
    after this line (line 42):
$value = zen_db_prepare_input((float)$_POST['value']);
```add this line```php
$sort_order = zen_db_prepare_input($_POST['sort_order']);

edit the sql query at line 45 so it reads:

        $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 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> add this line:```php
<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_SORT_ORDER; ?></td>


Edit the query at line 204 so it reads:
```php
  $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
<td class="dataTableContent" align="right"><?php echo number_format($currency->fields['value'], 8); ?></td>

add this line```php
                <td class="dataTableContent" align="right"><?php echo $currency->fields['sort_order']; ?></td>

After this line at line 269,```php
$contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_VALUE . '<br>' . zen_draw_input_field('value'));

add this line
```php
      $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_SORT_ORDER . '<br>' . zen_draw_input_field('sort_order'));

After this line at line 286```php
$contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_VALUE . '<br>' . zen_draw_input_field('value', $cInfo->value));

add this line```php
      $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_SORT_ORDER . '<br>' . zen_draw_input_field('sort_order', $cInfo->sort_order));
  1. 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/)
define('TABLE_HEADING_SORT_ORDER', 'Sort Order');
define('TEXT_INFO_CURRENCY_SORT_ORDER', 'Sort Order:');
  1. Edit the file includes/classes/currencies.php (this is a core file - no override capability)

Modify the query at line 27 to read:

    $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.

Neville
An assumption is what you arrive at when you get tired of thinking...

25 May 2009, 2:46 PM
#33
missy_eiinix avatar

missy_eiinix

New Zenner

Join Date:
May 2009
Posts:
2
Plugin Contributions:
0

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!

1 Jun 2009, 10:12 PM
#34
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: Language/Currency Links in Header

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:

        $currencies_array[] = array('id' => $key, 'text' => (zen_not_null($value['symbol_left']) ? $value['symbol_left'] : $value['symbol_right']) );

with this:

        $currencies_array[] = array('id' => $key, 'text' => $value['title']);

Neville
An assumption is what you arrive at when you get tired of thinking...

2 Jun 2009, 2:51 AM
#35
missy_eiinix avatar

missy_eiinix

New Zenner

Join Date:
May 2009
Posts:
2
Plugin Contributions:
0

Re: Language/Currency Links in Header

Thanks, that worked perfectly!

7 Jun 2009, 12:11 AM
#36
cocteau avatar

cocteau

New Zenner

Join Date:
Feb 2009
Posts:
15
Plugin Contributions:
0

Re: Language/Currency Links in Header

Hello anyone note that this Language/Currency header disapper on all the Checkout pages?

7 Jun 2009, 12:20 AM
#37
cocteau avatar

cocteau

New Zenner

Join Date:
Feb 2009
Posts:
15
Plugin Contributions:
0

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!

7 Jun 2009, 5:04 AM
#38
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: Language/Currency Links in Header

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
// 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
// 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.

Neville
An assumption is what you arrive at when you get tired of thinking...

8 Jun 2009, 6:20 PM
#39
cocteau avatar

cocteau

New Zenner

Join Date:
Feb 2009
Posts:
15
Plugin Contributions:
0

Re: Language/Currency Links in Header

Thank so much for the reply. :smile:

10 Jul 2009, 3:01 PM
#40
kobra8 avatar

kobra8

Zen Follower

Join Date:
Mar 2009
Location:
Serbia
Posts:
350
Plugin Contributions:
0

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;
}