Post by fireatwire » Tue Aug 31, 2010 3:38 am

Hi,

I want to change the way the currency and language switcher works in my layout.
Has somebody tried to arrange it that way, that you only see the flag-icons, and they are listed side by side on the header template?

Appreciate your help!

New member

Posts

Joined
Wed Feb 03, 2010 5:21 am

Post by JAY6390 » Tue Aug 31, 2010 9:48 am

Just tried this now. It's amazingly easy to do
Open
/catalog/controller/common/header.php
after

Code: Select all

        if (($this->request->server['REQUEST_METHOD'] == 'POST') && isset($this->request->post['language_code'])) {
            $this->session->data['language'] = $this->request->post['language_code'];
        
            if (isset($this->request->post['redirect'])) {
                $this->redirect($this->request->post['redirect']);
            } else {
                $this->redirect(HTTP_SERVER . 'index.php?route=common/home');
            }
        } 
put this code

Code: Select all

        if (($this->request->server['REQUEST_METHOD'] == 'GET') && isset($this->request->get['language_code'])) {
            $this->session->data['language'] = $this->request->get['language_code'];
        
            if (isset($this->request->get['redirect'])) {
                $this->redirect($this->request->get['redirect']);
            } else {
                $this->redirect(HTTP_SERVER . 'index.php?route=common/home');
            }
        } 
Then in /catalog/view/theme/default/template/common/header.tpl find and delete this code

Code: Select all

        <form action="<?php echo str_replace('&', '&', $action); ?>" method="post" enctype="multipart/form-data" id="language_form">
          <div class="switcher">
            <?php foreach ($languages as $language) { ?>
            <?php if ($language['code'] == $language_code) { ?>
            <div class="selected"><a><img src="image/flags/<?php echo $language['image']; ?>" alt="<?php echo $language['name']; ?>" />&nbsp;&nbsp;<?php echo $language['name']; ?></a></div>
            <?php } ?>
            <?php } ?>
            <div class="option">
              <?php foreach ($languages as $language) { ?>
              <a onclick="$('input[name=\'language_code\']').attr('value', '<?php echo $language['code']; ?>'); $('#language_form').submit();"><img src="image/flags/<?php echo $language['image']; ?>" alt="<?php echo $language['name']; ?>" />&nbsp;&nbsp;<?php echo $language['name']; ?></a>
              <?php } ?>
            </div>
          </div>
          <div>
            <input type="hidden" name="language_code" value="" />
            <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
          </div>
        </form>
in it's place put

Code: Select all

        <?php foreach($languages as $language) : ?>
        <a href="<?php echo str_replace('&', '&', $action); ?>&redirect=<?php echo urlencode($redirect); ?>&language_code=<?php echo urlencode($language['code']); ?>"><img src="image/flags/<?php echo $language['image']; ?>" alt="<?php echo $language['name']; ?>" /></a>
        <?php endforeach; ?>
and its done

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by fireatwire » Wed Sep 01, 2010 5:33 pm

+++
thank you! it works perfectly.

(but it's header.php not home.php)

New member

Posts

Joined
Wed Feb 03, 2010 5:21 am

Post by JAY6390 » Wed Sep 01, 2010 6:52 pm

Hi, yes sorry I meant header not home. It was 3am at the time, clearly I should have gone to bed :P

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by fireatwire » Tue Sep 14, 2010 3:59 pm

When I click on a flag to switch the language I get this error:

Warning: Cannot modify header information - headers already sent by (output started at /catalog/model/catalog/category.php:25) in /system/engine/controller.php on line 27

Do you know what I need to do to get it working again?

New member

Posts

Joined
Wed Feb 03, 2010 5:21 am

Post by celestial » Tue Sep 14, 2010 11:58 pm

And the currency???

Celestial - Martín Abel Rosales
Email: martinrosales2012@hotmail.com
Skype: martin.abel.rosales
San José , Costa Rica


User avatar
Expert Member

Posts

Joined
Sat Mar 20, 2010 4:19 am
Location - Costa Rica
Who is online

Users browsing this forum: No registered users and 7 guests