Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Use different header in each language


pedromau

Recommended Posts

Posted

Hello!

I'm using images instead of dynamic text for the menus "home, new products, my account, Shopping Cart and Checkout".

 

All is fine... except when I change language... I don't know how to define a new path for the images that represents the menus...

If I could use a different header would be easy, but it would have to be inside each language folder...

 

I'm really confuse with this...

 

Something like

http://www.templatemonster.com/oscommerce-...lates/9083.html

 

If you change the language, it won't change the menus on top.

 

Can someone help please?!

Posted
Hello!

I'm using images instead of dynamic text for the menus "home, new products, my account, Shopping Cart and Checkout".

All is fine... except when I change language... I don't know how to define a new path for the images that represents the menus...

If I could use a different header would be easy, but it would have to be inside each language folder...

I'm really confuse with this...

 

http://www.templatemonster.com/oscommerce-...lates/9083.html

If you change the language, it won't change the menus on top.

Can someone help please?!

 

The obvious answer is to stop using images!

 

You already have the language variable set by the time the header.php file is loaded.

So - just write loops around each language parameter :

 

includes/header.php :

 

if ($language=="english") {

print out your english header with the path to the english

etc, for each language

 

} elseif ($language=="french") {

 

} elseif ($language=="german") {

 

} elseif ($language=="klingon") {

 

}

 

Or - a better idea to create a new directory under the images directory for each language, then when you enter header.php, the directory name is populated with the language paramter.

 

ie.

images/english/image1.jpg

images/french/image1.jpg

images/german/image1.jpg

 

Then this :

<td align="right" valign="bottom"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a>  <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a>  <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>'; ?>  </td>

becomes this :

<td align="right" valign="bottom"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . $language .'/header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a>  <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . $language .'/header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a>  <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . $language .'/header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>'; ?>  </td>

 

 

 

easy!

 

david

Posted

I forgot to tell I'm pretty new to php language and to OSC...

 

The code I have in the header for images is this:

 

<td><a href=<?=tep_href_link('index.php')?>><img src=images/m10.gif width=102 height=71 border=0></a><a href=<?=tep_href_link('products_new.php')?>><img src=images/m11.gif width=99 height=71 border=0></a><a href=<?=tep_href_link('account.php')?>><img src=images/m12.gif width=99 height=71 border=0></a><a href=<?=tep_href_link('shopping_cart.php')?>><img src=images/m13.gif width=99 height=71 border=0></a><a href=<?=tep_href_link('checkout_shipping.php')?>><img src=images/m14.gif width=98 height=71 border=0></a></td></tr>

 

So this can't be the best way to have that, because it's getting the images from images folder, and not from a dir inside a language folder..

To change that, just needed to create that folder and change the path... but how would I do that, if helder isn't inside the languages folder?

 

Don't know if I'm explaining myself alright... I'm Portuguese...

Hope u can understand and help.

 

Check my test HERE.

Things needed to change:

- all the menus img

- "browse by categories"

- menu on top ( Specials, Search, Contact Us, Create an account, Customer Login )

- "search" and "advanced search" words

 

 

Thank you!

Posted
<td><a href=<?=tep_href_link('index.php')?>><img src=images/m10.gif width=102 height=71 border=0></a><a href=<?=tep_href_link('products_new.php')?>><img src=images/m11.gif width=99 height=71 border=0></a><a href=<?=tep_href_link('account.php')?>><img src=images/m12.gif width=99 height=71 border=0></a><a href=<?=tep_href_link('shopping_cart.php')?>><img src=images/m13.gif width=99 height=71 border=0></a><a href=<?=tep_href_link('checkout_shipping.php')?>><img src=images/m14.gif width=98 height=71 border=0></a></td></tr>

 

Right. Did you read my post ?

 

Right now, this image lives in your images directory :

http://www.kneeldown.net/temp_shop/images/m11.gif

 

So instead of putting the images at the root of the images directory, create a NEW directory for *each* language you have.

Like this :

http://www.kneeldown.net/temp_shop/images/english/m11.gif

http://www.kneeldown.net/temp_shop/images/french/m11.gif

http://www.kneeldown.net/temp_shop/images/german/m11.gif

 

Then your code in the header will look like this :

<td><a href=<?=tep_href_link('index.php')?>><img src=images/<? $language ?>/m10.gif width=102 height=71 border=0></a><a href=<?=tep_href_link('products_new.php')?>><img src=images/<? $language ?>/m11.gif width=99 height=71 border=0></a><a href=<?=tep_href_link('account.php')?>><img src=images/<? $language ?>/m12.gif width=99 height=71 border=0></a><a href=<?=tep_href_link('shopping_cart.php')?>><img src=images/<? $language ?>/m13.gif width=99 height=71 border=0></a><a href=<?=tep_href_link('checkout_shipping.php')?>><img src=images/<? $language ?>/m14.gif width=98 height=71 border=0></a></td></tr>

 

 

david

Posted

Well...

I made what you told me to... but nothing happened..

What am I doing wrong!?

 

Is this needed?: if so, what do I need to put in the italic part?

if ($language=="english") {

print out your english header with the path to the english

etc, for each language

 

} elseif ($language=="french") {

 

} elseif ($language=="german") {

 

} elseif ($language=="klingon") {

 

}

Posted
Well...

I made what you told me to... but nothing happened..

What am I doing wrong!?

 

Is this needed?: if so, what do I need to put in the italic part?

if ($language=="english") {

print out your english header with the path to the english

etc, for each language

 

} elseif ($language=="french") {

 

} elseif ($language=="german") {

 

} elseif ($language=="klingon") {

 

}

 

Put in the header code that you want to reference for each language.

 

If you're going to use if/else loops, you need to have the output for each language :

<td align="right" valign="bottom"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a>  <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a>  <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>'; ?>  </td>

 

to test, dump this in after the above code and echo out the language to the brwoser - you'll see your results as you toggle the language :

if ($language=="english") {

echo "hello ".$language;

 

} elseif ($language=="french") {

echo "hello ".$language;

 

} elseif ($language=="german") {

echo "hello ".$language;

 

} elseif ($language=="klingon") {

echo "hello ".$language;

 

}

Posted
Can someone help?! Please!? :(

 

 

Hi Mau - I'll take a look at your header.php file.

 

But - to be perfectly honest, if you are still having this much trouble after the posts I have sent you then I think you need to seriously buy a book on PHP and mySQL, or do some online PHP tutorials or something - 'cause this is very basic stuff we're tlaking about here.

 

So - I see you create English, French and German under the images directory - this is good.

But you only actually ahve images in the English and German direcotyr.

 

Are these the two languages you are using ? or are there others ?

 

david

Posted

Damn...

I forgot to say that I've uninstalled the shop from the link in post #3...

I was messing around with it and all stopped working good... so I've installed it again in another directory...

 

I know I am a "php dumb"... but hey.. that's why I'm here, right!? And I appreciate all the work this great community have done.. real deal!

If you asked me for help... lets say... actionscript or photoshop (things i'm good at) I'd be glad to help!

 

But I see your point and I aggree with you :)

 

Altought... I'll give the last shot:

- all I need to change, is the images (that needs to be translated) that are shown in that header and the menu on top... I guess you saw the php file... and u know what I mean.

- I'll only use 3 languages... (EN, PT, ES) but I was trying to figure out how to change that before I start doing new images for the menus.

 

Well...

Thank you once again :) and yes... I'll study more... I'll try to! :)

Posted
- I'll only use 3 languages... (EN, PT, ES) but I was trying to figure out how to change that before I start doing new images for the menus.

 

Mau - here is your file :

http://mllongbow.ca/header.zip

 

5 lines have been edited to pass in the language parameter - and grab the image from that directory.

 

 

david

Posted

ALRIGHT! :)

 

I got it working now thanks to u! :)

Now I understand it!

 

Is it also possible to change the menus at the top right?!

 

I searched for the part of the code you told be to include... but didn't found anything...

if ($language=="english") {

echo "hello ".$language;

 

} elseif ($language=="french") {

echo "hello ".$language;

 

} elseif ($language=="german") {

echo "hello ".$language;

 

} elseif ($language=="klingon") {

echo "hello ".$language;

 

}

Where is that?!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...