Re: multi lingual banners
Quote:
Originally Posted by
cinziapdl
Hi there,
I've followed the steps listed in post
#22
and it works fine,
But I've got 4 banners in a row and as you can see on my site
here
the second one doesn't show, it copies the first one. If I activate the 4 of them they will be all same as the first one.
I think it is because in configuration/layout settings I put 4 times wide-banners, but how else could I name them. If I try to number them there it doesn't work!
Any idea how to solve this?
Thanks
Make the appropriate settings under Configuration->Layout Setting.
Banner Display Groups - Header Position 1 = Banner1
Banner Display Groups - Header Position 2 = Banner2
Banner Display Groups - Header Position 3 = Banner3
etc.
Now, I can see your first and second banner are using Header Position 2 and header Position 3.
Do the following:
Banner Display Groups - Header Position 2 = Left
Banner Display Groups - Header Position 3 = MidLeft
Go to Banner Manager and set your first banner to group Left1 (Left2, Left3 - depending on your language IDs)
Next, set your second banner to group MidLeft1 (MidLeft2, Midleft3...)
That should do the trick.
Re: multi lingual banners
Quote:
Originally Posted by
balihr
Make the appropriate settings under Configuration->Layout Setting.
Banner Display Groups - Header Position 1 = Banner1
Banner Display Groups - Header Position 2 = Banner2
Banner Display Groups - Header Position 3 = Banner3
etc.
Now, I can see your first and second banner are using Header Position 2 and header Position 3.
Do the following:
Banner Display Groups - Header Position 2 = Left
Banner Display Groups - Header Position 3 = MidLeft
Go to Banner Manager and set your first banner to group Left1 (Left2, Left3 - depending on your language IDs)
Next, set your second banner to group MidLeft1 (MidLeft2, Midleft3...)
That should do the trick.
Thanks Balihr! It works perfectly!
I guessed the other 2 Right and MidRight and it works...
I just can't guess Header Position 1
(the one at the top)
But thanks so much for your help!!!!
Re: multi lingual banners
Quote:
Originally Posted by
cinziapdl
I just can't guess Header Position 1
(the one at the top)
The slideshow? That's not controlled as banners, in your case it's hard-coded and not controlled via admin so the code we used here can't be used.
However, you can use
PHP Code:
<?php if ($_SESSION['languages_id']==1) {
//your lang-1 slider here
}
and so on for each language... :smile:
Re: multi lingual banners
Thanks Balihr, too advanced for me, I'll leave it in one language ;)
Re: multi lingual banners
Did you install the slider you now have by yourself? If so, just repeat that process for the other languages with balihr's if test wrapped around each one. (It can be done a bit more elegantly for multiple languages, but that will work fine.)
Re: multi lingual banners
Quote:
Originally Posted by
gjh42
Did you install the slider you now have by yourself? If so, just repeat that process for the other languages with balihr's if test wrapped around each one. (It can be done a bit more elegantly for multiple languages, but that will work fine.)
No, I did not install it myself. It came with the template. I can change the images from the backoffice in Banner Manager, They are under Banner-1 that is why I thought I could manage different languages from there. I've tried to rename the header group to Wide-Banners in Config. Layout Settings and in Banner Manager Wide-Banners1, Wide-Banners2. But it doesn't work. the images disappear.
So i probably need to add some code next to the slider code, I will try Balihr suggestion and see what happens.
Thanks guys.
Re: multi lingual banners
Quote:
It came with the template. I can change the images from the backoffice in Banner Manager, ... But it doesn't work. the images disappear.
Template Monster apparently hacked into the admin function and appropriated some of it for their slider, so there is no telling exactly what it will take to use it for multiple languages. You can easily duplicate the slider code inside if() tests, but you will probably need to change some bit of code inside the duplicated slider to reference the different banner groups. We can't help with that because we don't know what they did.
Re: multi lingual banners
Quote:
Originally Posted by
gjh42
Template Monster apparently hacked into the admin function...(CUT) ...we don't know what they did.
Gotta luv that TemplateMonster... :P And the best part is, they could have just as easily utilized the banner management system without any hacks and use it for the slider.
Re: multi lingual banners
Quote:
Originally Posted by
balihr
Gotta luv that TemplateMonster... :P And the best part is, they could have just as easily utilized the banner management system without any hacks and use it for the slider.
The only thing I am grateful to TM is the fact that they introduced me to ZenCart, I knew nothing about ecommerce before. Anyway...
This is the part of code where the slider appear, where exactly should I try to insert the code given above? My languages are Italian (id 2) Portuguese (id 6) and English (id 1).
Thanks for your help.
PHP Code:
<!-- ========== HEADER ========== -->
<?php
/* prepares and displays header output */
if (CUSTOMERS_APPROVAL_AUTHORIZATION == 1 && CUSTOMERS_AUTHORIZATION_HEADER_OFF == 'true' and ($_SESSION['customers_authorization'] != 0 or $_SESSION['customer_id'] == '')) {
$flag_disable_header = true;
}
require($template->get_template_dir('tpl_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header.php');
?>
<!-- ============================ -->
<div class="wrapp">
<div class="main-width">
<?php
if($this_is_home_page){
?>
<div class="slider">
<div id="faded">
<div>
<?php
$new_banner_search = zen_build_banners_group(SHOW_BANNERS_GROUP_SET1);
// secure pages
switch ($request_type) {
case ('SSL'):
$my_banner_filter=" and banners_on_ssl= " . "1 ";
break;
case ('NONSSL'):
$my_banner_filter='';
break;
}
$sql = "select banners_id from " . TABLE_BANNERS . " where status = 1 " . $new_banner_search . $my_banner_filter . " order by banners_sort_order";
$banners_all = $db->Execute($sql);
// if no active banner in the specified banner group then the box will not show
$banner_cnt = 0;
while (!$banners_all->EOF) {
$banner_cnt++;
$banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1 . $_SESSION['languages_id']);
echo '<div>'.zen_display_banner('static', $banners_all->fields['banners_id']).'</div>';
// add spacing between banners
if ($banner_cnt < $banners_all->RecordCount()) {
}
$banners_all->MoveNext();
}
?>
</div>
</div>
</div>
<div class="bot-banners">
<!-- BOF- BANNER #2 display -->
<?php
if (SHOW_BANNERS_GROUP_SET2 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET2 . $_SESSION['languages_id'])) {
if ($banner->RecordCount() > 0) {
?>
<div id="bannerTwo"><?php echo zen_display_banner('static', $banner);?></div>
<?php
}
}
?>
<!-- EOF- BANNER #2 display -->
Re: multi lingual banners
Quote:
Originally Posted by
balihr
OK, been working on this for a few hours :frusty: until i realised how simple it is... I wanted my header's Wide-Banners to be multi-lingual.
So, for all those still looking for the answer, here we go:
1. Locate your tpl_header.php file and find this line:
Code:
if (SHOW_BANNERS_GROUP_SET2 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET2))
and replace it with
Code:
if (SHOW_BANNERS_GROUP_SET2 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET2 . $_SESSION['languages_id']))
2. Go to Configuration->Layout Settings and change Banner Display Groups - Header Position 2 to show Wide-Banners (write that in the field)
3. Go to Tools->Banner Manager. Edit your banner and manually assign it to banner group Wide-Banners1. Notice the number 1 - this number represents your language id. Therefore, if you have english (1), german (2) etc, Wide-Banners1 will show when english language is selected and Wide-Banners2 when german is selected. Note: language ids are related to your installed languages, not a general code - if you don't know what id you want to use, simply try different numbers 1,2,3,4,5...
And that's it! If you want to use it on a different position, change the GROUP_SET number accordingly.
Could it be any easier? :smile:
This also works with Flash banners (if you previously set up Flash to run). If you want a Flash banner, use the HTML banner version...
All thanks go to Ajeh!
also works great on 1.5.5, can it be done for banner boxes? thank you