Post by jmrchaves » Thu Dec 24, 2009 11:46 am

Hi All,

I was wondering is it possible to place de currency drop down menu right next to the language selection in the search box?

If so, how do I do it,

I'm sorry if it's a silly question but I'm just starting to work with this

Thanks,

Joe

Newbie

Posts

Joined
Sun Dec 20, 2009 9:20 pm

Post by huhitschris » Fri Dec 25, 2009 5:24 am

It's not a silly question, to do so is actually somewhat tricky.

This is probably the easiest way I can think of.,,

Open "opencart\catalog\controller\common\header.php" and look for this code:

Code: Select all

$this->children = array(
	'common/language',
	'common/search'
);
Modify the code to look like this:

Code: Select all

$this->children = array(
	'common/language',
	'common/search',
	'module/currency'
);
Save and close this file.

Now open "opencart\catalog\view\theme\default\template\common\header.tpl"

Add this code wherever you want your currency module to appear:

Code: Select all

<?php echo $currency;?>
Save and close this file.

Now the module should appear in your page when you refresh it... however it is still styled to look like a sidebar module. In order to change it's appearance you'll need to open and edit this file: "opencart\catalog\view\theme\default\template\module\currency.tpl"

Hope that helps, let me know how it works out for you buddy. :)

-Chris

Anyone else have a different solution to this problem?

PM me for custom OpenCart template design and development.


New member

Posts

Joined
Wed Aug 19, 2009 3:12 pm

Post by vimal » Mon Dec 28, 2009 5:42 am

Is there a way to get currency and language in a sidebox?

www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel


Active Member

Posts

Joined
Wed Aug 26, 2009 8:54 am
Location - Sweden

Post by huhitschris » Mon Dec 28, 2009 6:02 am

vimal wrote:Is there a way to get currency and language in a sidebox?
Yes, currency is already a sidebox you can enable/disable in the admin. To get language into a sidebox, try this mod:

Add this to your catalog\controller\common\column_right.php, try adding it just before $this->render();

Code: Select all

$this->children[] ='common/language';
Change your catalog\view\theme\default\template\common\column_right.tpl :

Code: Select all

<div id="column_right">
  <?php foreach ($modules as $module) { ?>
  <?php echo ${$module['code']}; ?>
  <?php } ?>
  <div class="box">
      <div class="top">Language</div>
      <div class="middle"><?php echo $language; ?></div>
      <div class="bottom">&nbsp;</div>
  </div>
</div>
Alternatively, an entire module could be created to add the language side box but this quick and dirty mod should do the job for now.

Let me know if this works for you.

PM me for custom OpenCart template design and development.


New member

Posts

Joined
Wed Aug 19, 2009 3:12 pm

Post by vimal » Mon Dec 28, 2009 8:51 am

Hi huhitschris

Thanks for the reply. It does work however, I am trying to save some real estate and get language and currency in the same box. Also, I ave 2 languages on the website and hence the div top can't be just "language".

I have got it on top (header) at the moment and really feel currency and language should have its own sidebox called localization or something. I also feel that the header looks too crowded. It looks better with just the logo and search. :)

www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel


Active Member

Posts

Joined
Wed Aug 26, 2009 8:54 am
Location - Sweden

Post by vimal » Mon Dec 28, 2009 8:53 am

Could you provide a contribution to the community that has language and currency in a sidebox like a combined module?

I would surely be a million times thankful to you! :)

www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel


Active Member

Posts

Joined
Wed Aug 26, 2009 8:54 am
Location - Sweden

Post by huhitschris » Mon Dec 28, 2009 12:36 pm

You can just mod your currency module to include language,

edit "catalog\controller\module\currency.php" and insert this line before $this->render(); :

Code: Select all

$this->children[] = 'common/language';
edit "catalog\view\theme\default\template\module\currency.tpl" to add the echo $language;:

Code: Select all

<div class="box">
  <div class="top"><img src="catalog/view/theme/default/image/icon_currency.png" alt="" /><?php echo $heading_title; ?></div>
  <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="currency_form">
    <div class="middle" style="text-align: center;">
      <select name="currency_code" onchange="$('#currency_form').submit();">
        <?php foreach ($currencies as $currency) { ?>
        <?php if ($currency['status']) { ?>
        <?php if ($currency['code'] == $default) { ?>
        <option value="<?php echo $currency['code']; ?>" selected="selected"><?php echo $currency['title']; ?></option>
        <?php } else { ?>
        <option value="<?php echo $currency['code']; ?>"><?php echo $currency['title']; ?></option>
        <?php } ?>
        <?php } ?>
        <?php } ?>
      </select>
      <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
      <?php echo $language; ?>
    </div>
  </form>
  <div class="bottom">&nbsp;</div>
</div>
The title of the module will still say "currency", so just go into your language files and change the 'heading_title' to whatever you prefer. Take English for example... change 'catalog\language\english\module\currency.php' :

Code: Select all

$_['heading_title'] = 'Localisation';
Now your cart should show both currency and language inside the "localisation'" module :)

Let me know how that works for ya.

PM me for custom OpenCart template design and development.


New member

Posts

Joined
Wed Aug 19, 2009 3:12 pm

Post by vimal » Mon Dec 28, 2009 7:30 pm

Got the 2 things in the same box..that is great. However, when I try to change the currency it doesn't change it.

If I remove the <?php echo $language; ?> from module/currency.tpl, the crrency change works...

Any idea what it could be?

www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel


Active Member

Posts

Joined
Wed Aug 26, 2009 8:54 am
Location - Sweden

Post by huhitschris » Tue Dec 29, 2009 12:39 am

Ahh yes, you have two overlapping form tag from the two modules. Try this instead, let me know how it works out:

Code: Select all

<div class="box">
      <div class="top"><img src="catalog/view/theme/default/image/icon_currency.png" alt="" /><?php echo $heading_title; ?></div>
        <div class="middle" style="text-align: center;">
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="currency_form">
          <select name="currency_code" onchange="$('#currency_form').submit();">
            <?php foreach ($currencies as $currency) { ?>
            <?php if ($currency['status']) { ?>
            <?php if ($currency['code'] == $default) { ?>
            <option value="<?php echo $currency['code']; ?>" selected="selected"><?php echo $currency['title']; ?></option>
            <?php } else { ?>
            <option value="<?php echo $currency['code']; ?>"><?php echo $currency['title']; ?></option>
            <?php } ?>
            <?php } ?>
            <?php } ?>
          </select>
          <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
           </form>
          <?php echo $language; ?>
        </div>
      <div class="bottom">&nbsp;</div>
    </div>

PM me for custom OpenCart template design and development.


New member

Posts

Joined
Wed Aug 19, 2009 3:12 pm

Post by vimal » Tue Dec 29, 2009 3:48 am

Thank you!! Works fantastic now. Appreciate your help a lot...Thanks once again! :)

www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel


Active Member

Posts

Joined
Wed Aug 26, 2009 8:54 am
Location - Sweden

Post by huhitschris » Wed Dec 30, 2009 2:19 pm

O0

PM me for custom OpenCart template design and development.


New member

Posts

Joined
Wed Aug 19, 2009 3:12 pm

Post by cmebd » Fri Jan 01, 2010 2:31 pm

Hi Chris,

I used your edits to get currency up under Language (have an alignment problem there). However I still have currency (used to be a box) in right column (leftover).

Is it possible for you (or anyone else) to point me in the direction/file that I need to edit in order to get rid of this. I have looked through files "I" thought may need editing but couldn't find anything I recognised.

TIA

christine

Attachments

currency_duplication.JPG

currency duplication graphic - currency_duplication.JPG (23.37 KiB) Viewed 3228 times


User avatar
Active Member

Posts

Joined
Fri Nov 13, 2009 11:17 am
Location - Tasmania, Australia

Post by huhitschris » Fri Jan 01, 2010 3:00 pm

cmebd wrote: I used your edits to get currency up under Language (have an alignment problem there). However I still have currency (used to be a box) in right column (leftover).

Is it possible for you (or anyone else) to point me in the direction/file that I need to edit in order to get rid of this. I have looked through files "I" thought may need editing but couldn't find anything I recognised.
Yea, just go into your admin area and disable the currency module, don't worry it will still show up at the top where you made the mod, but won't appear on the side anymore.

Much more importantly, you need to address a HUGE problem with your website design. See here: http://bancomicsans.com/home.html

shame on you! ;)

PM me for custom OpenCart template design and development.


New member

Posts

Joined
Wed Aug 19, 2009 3:12 pm

Post by cmebd » Fri Jan 01, 2010 5:41 pm

OK I'll just call the site Starbucks - apparently it supposedly looks OK for that - at least my logo isn't in Comic Sans.

Ho Hum >:D ;D

User avatar
Active Member

Posts

Joined
Fri Nov 13, 2009 11:17 am
Location - Tasmania, Australia
Who is online

Users browsing this forum: Amazon [Bot] and 64 guests