Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Putting currency dropdown in the header

Putting currency dropdown in the header

Locked

Views: 4,799

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
9 Sep 2007, 3:40 PM
#1
vandiermen avatar

vandiermen

Totally Zenned

Join Date:
Feb 2007
Posts:
518
Plugin Contributions:
1

Putting currency dropdown in the header

I am looking to find an easy solution or put the currency dropdown code in the header but what I am doing is not work, I am a bit new with PHP.

This is the code I would like to rip out and put in my header

\includes\templates\template_default\sideboxes\tpl_currencies.php

<?php
    $content = "";
    $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">';
    $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>';
    $content .= '</div>';
?> 
 

Or (I dont know how I would use it but..)

\includes\modules\sideboxes\currencies.php

 
<?php
/**
 * currencies sidebox - allows customer to select from available currencies
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license [URL]http://www.zen-cart.com/license/2_0.txt[/URL] GNU Public License V2.0
 * @version $Id: currencies.php 2834 2006-01-11 22:16:37Z birdbrain $
 */
// test if box should display
  $show_currencies= false;
  // don't display on checkout page:
  if (substr($current_page, 0, 8) != 'checkout') {
    $show_currencies= true;
  }
  if ($show_currencies == true) {
    if (isset($currencies) && is_object($currencies)) {
      reset($currencies->currencies);
      $currencies_array = array();
      while (list($key, $value) = each($currencies->currencies)) {
        $currencies_array[] = array('id' => $key, 'text' => $value['title']);
      }
      $hidden_get_variables = '';
      reset($_GET);
      while (list($key, $value) = each($_GET)) {
        if ( ($key != 'currency') && ($key != zen_session_name()) && ($key != 'x') && ($key != 'y') ) {
          $hidden_get_variables .= zen_draw_hidden_field($key, $value);
        }
      }
      require($template->get_template_dir('tpl_currencies.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_currencies.php');
      $title =  '<label>' . BOX_HEADING_CURRENCIES . '</label>';
      $title_link = false;
      require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
    }
  }
?>
 
 

I took the top code and made a few things to insert into the header but I dont know what I am doing
e.g.

<?php
<div>
 zen_draw_form('currencies_form', zen_href_link(basename(ereg_replace('.php','', $PHP_SELF)), '', $request_type, false), 'get') zen_draw_pull_down_menu('currency', $currencies_array, $_SESSION['currency'], 'onchange="this.form.submit();"') $hidden_get_variables zen_hide_session_id() </form> </div>;
?>
9 Sep 2007, 10:51 PM
#2
dvasdekis avatar

dvasdekis

New Zenner

Join Date:
Nov 2006
Posts:
70
Plugin Contributions:
0

Re: Putting currency dropdown in the header

There is this mod, which, unmodified, gives you text buttons for each active currency. I just discovered it and I'm trying to figure out how to move them around and replace the text with images.

10 Sep 2007, 4:20 PM
#3
vandiermen avatar

vandiermen

Totally Zenned

Join Date:
Feb 2007
Posts:
518
Plugin Contributions:
1

Re: Putting currency dropdown in the header

Thanks!

10 Oct 2008, 12:09 PM
#4
time111 avatar

time111

New Zenner

Join Date:
Sep 2008
Posts:
95
Plugin Contributions:
0

Re: Putting currency dropdown in the header

Use below given code in your header file.

<!-- Currencies -->

<?=zen_draw_form('currencies', zen_href_link(basename(ereg_replace('.php','', $PHP_SELF)), '', $request_type, false), 'get')?>

<?

    if (isset($currencies) && is_object($currencies)) {

      reset($currencies->currencies);
      $currencies_array = array();
      while (list($key, $value) = each($currencies->currencies)) {
        $currencies_array[] = array('id' => $key, 'text' => $value['title']);
      }

      $hidden_get_variables = '';
      reset($_GET);
      while (list($key, $value) = each($_GET)) {
        if ( ($key != 'currency') && ($key != zen_session_name()) && ($key != 'x') && ($key != 'y') ) {
          $hidden_get_variables .= zen_draw_hidden_field($key, $value);
        }
      }
    }

?>

        <?=zen_draw_pull_down_menu('currency', $currencies_array, $_SESSION['currency'], 'class="header1_sel" onchange="this.form.submit();"') . $hidden_get_variables . zen_hide_session_id()?>
</form>
<!-- End Currencies -->
29 Mar 2009, 10:38 AM
#5
time111 avatar

time111

New Zenner

Join Date:
Sep 2008
Posts:
95
Plugin Contributions:
0

Re: Putting currency dropdown in the header

Hi,

Can anyone say how to put one particular default currency in drop down in header irrespective of what default currency is in admin.

~ Time

26 Jun 2010, 4:46 PM
#6
guciguci avatar

guciguci

New Zenner

Join Date:
Dec 2009
Posts:
1
Plugin Contributions:
0

Re: Putting currency dropdown in the header

How about the language code please. Thanks

27 Jun 2010, 6:41 PM
#8
vandiermen avatar

vandiermen

Totally Zenned

Join Date:
Feb 2007
Posts:
518
Plugin Contributions:
1