Zen Cart Logo
Forums / Addon Language Packs / now in your cart in another language (tpl_header.php)

now in your cart in another language (tpl_header.php)

Views: 4,930

Results 1 to 13 of 13
17 Nov 2011, 11:49 PM
#1
cinziapdl avatar

cinziapdl

New Zenner

Join Date:
Nov 2011
Location:
Harrogate, UK
Posts:
16
Plugin Contributions:
0

now in your cart in another language (tpl_header.php)

Hi there, can anyone help me with this:
I've installed my zen cart in 2 languages and I want the message 'now in your cart' to be in italian for the italian version of the site.
I've followed this thread
http://www.zen-cart.com/forum/showthread.php?t=129945
and now the text is gone from the template.
This text is in the file tpl_header.php and there is no the Italian version of this one. Can anyone tell me how to move this text in the header.php (english and italian) and create the variable in tpl_header.php?
I don't know if that makes sense....
Also, this template is from templatemonster and it seems impossible to change header and footer. I've contacted them via chat and they say that it is 'hard-coded' can anyone tell me if you have any idea of how to go about this. I'd be very grateful!

8 Feb 2012, 2:37 PM
#2
cinziapdl avatar

cinziapdl

New Zenner

Join Date:
Nov 2011
Location:
Harrogate, UK
Posts:
16
Plugin Contributions:
0

Re: now in your cart in another language (tpl_header.php)

Hi Niccol, I'm writing to you because I was following a thread which is now closed where you were offering some help awhile ago: http://www.zen-cart.com/forum/showthread.php?t=129945
I am having the same problem as that french guy, I just can't figure out what he did to solve it, because he is very vague in the explanation.
I've tried to get in touch with him, but he seems inactive since last February.
I am using a purchased template and the text "now in your cart" doesn't translate when I go to the italian version. I found that text with the developer tool kit and it is in the tpl_header.php file.
in this file there is no HEADER_TITLE_CART_CONTENTS but only the text "now in your cart" .
It seems that it does not use a variable.
can you try to help me pleeeeease?
Cinzia

niccol
Re: now in your cart text

Where it says 'now in your cart' replace it with '<?php echo HEADER_TITLE_CART_CONTENTS; ?>

Then in includes/languages/english/header.php set that variable to whatever you want it to say in English. And the same for any other language.

Hi niccol,
thanks for your reply! I've tried what you suggested, but strangely enough in my header.php there is already a variable called HEADER_TITLE_CART_CONTENTS
when I change it to what I want it to say nothing happens.

This is my header.php

<?php 
/** 
 * @package languageDefines 
 * @copyright Copyright 2003-2006 Zen Cart Development Team 
 * @copyright Portions Copyright 2003 osCommerce 
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 
 * @version $Id: header.php 2940 2006-02-02 04:29:05Z drbyte $ 
 */ 

// header text in includes/header.php 
  define('HEADER_TITLE_CREATE_ACCOUNT', 'Create Account'); 
  define('HEADER_TITLE_MY_ACCOUNT', 'My Account'); 
  define('HEADER_TITLE_CART_CONTENTS', 'Shopping Cart'); 
  define('HEADER_TITLE_CHECKOUT', 'Checkout'); 
  define('HEADER_TITLE_TOP', 'Top'); 
  define('HEADER_TITLE_CATALOG', 'Home'); 
  define('HEADER_TITLE_LOGOFF', 'Log Out'); 
  define('HEADER_TITLE_LOGIN', 'Log In'); 

// added defines for header alt and text 
  define('HEADER_ALT_TEXT', ''); 
  define('HEADER_SALES_TEXT', ''); 
  define('HEADER_LOGO_WIDTH', '192px'); 
  define('HEADER_LOGO_HEIGHT', '64px'); 
  define('HEADER_LOGO_IMAGE', 'logo.gif'); 

// header Search Button/Box Search Button 
  define('HEADER_SEARCH_BUTTON','Search'); 
  define('HEADER_SEARCH_DEFAULT_TEXT', 'Enter search keywords here'); 

?>

This is my tpl_header

<!-- ========== SHOPPING CART ========== --> 
                            <?php  
                                if ($_SESSION['cart']->count_contents() == 1) { 
                                    $cart_text = '<span class="cart1">Ora nel tuo carrello ci sono </span><a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') . '">' . $_SESSION['cart']->count_contents() . ' articoli</a>'; 
                                } else { 
                                    $cart_text = '<span class="cart1">Ora nel tuo carrello ci sono </span><a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') . '">' . $_SESSION['cart']->count_contents() . ' articoli</a>'; 
                                } 
                            ?> 
                            <?php echo $cart_text ?>  
                        <!-- =================================== -->

This is my site
http://www.emporiosposa.com
Any idea?
Thanks for your help

8 Feb 2012, 3:46 PM
#3
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: now in your cart in another language (tpl_header.php)

The 'now in you cart' is not part of the basic zen set-up here.

You'll need to create a new variable for this text.

So first in header.php you need to change 'Ora nel tuo carrello ci sono' to something like <?php echo HEADER_NOW_IN_CART; ?>

Then you need to define that. Actually it is best to do it in its own file but you can just add it below the other defines in the existing files, for all three languages.

// header text in includes/header.php  
  define('HEADER_TITLE_CREATE_ACCOUNT', 'Create Account');  
  define('HEADER_TITLE_MY_ACCOUNT', 'My Account');  
  define('HEADER_TITLE_CART_CONTENTS', 'Shopping Cart');  
  define('HEADER_TITLE_CHECKOUT', 'Checkout');  
  define('HEADER_TITLE_TOP', 'Top');  
  define('HEADER_TITLE_CATALOG', 'Home');  
  define('HEADER_TITLE_LOGOFF', 'Log Out');  
  define('HEADER_TITLE_LOGIN', 'Log In'); 
  define('HEADER_NOW_IN_CART', 'Now in your cart'); 
8 Feb 2012, 4:22 PM
#4
cinziapdl avatar

cinziapdl

New Zenner

Join Date:
Nov 2011
Location:
Harrogate, UK
Posts:
16
Plugin Contributions:
0

Re: now in your cart in another language (tpl_header.php)

Hi niccol,
I've followed your instructions to the letter but now the text does not appear at all http://www.emporiosposa.com/

This is my complete tpl_header

<?php
/**
 * Common Template - tpl_header.php
 *
 * this file can be copied to /templates/your_template_dir/pagename<br />
 * example: to override the privacy page<br />
 * make a directory /templates/my_template/privacy<br />
 * copy /templates/templates_defaults/common/tpl_footer.php to /templates/my_template/privacy/tpl_header.php<br />
 * to override the global settings and turn off the footer un-comment the following line:<br />
 * <br />
 * $flag_disable_header = true;<br />
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_header.php 4813 2006-10-23 02:13:53Z drbyte $
 */
?>
<?php

	
  // Display all header alerts via messageStack:
  if ($messageStack->size('header') > 0) {
    echo $messageStack->output('header');
  }
  if (isset($_GET['error_message']) && zen_not_null($_GET['error_message'])) {
  echo htmlspecialchars(urldecode($_GET['error_message']));
  }
  if (isset($_GET['info_message']) && zen_not_null($_GET['info_message'])) {
   echo htmlspecialchars($_GET['info_message']);
} else {

}
?>


<?php
if (!isset($flag_disable_header) || !$flag_disable_header) {
?>

<div id="header">
	<div class="extra-wrapp alt">
		<div class="wrapp">
			<div class="main-width">
				<div class="wrapper">
					<div class="currencies">
						<!-- ========== CURRENCIES ========= -->
							<?php echo zen_draw_form('currencies', zen_href_link(basename(ereg_replace('.php','', $PHP_SELF)), '', $request_type, false), 'get'); ?>
								<div>
									<span class="label"><?php echo BOX_HEADING_CURRENCIES;?>:  </span>
									<?php
										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);
											}
										  }
										}
									?>
									<?php echo zen_draw_pull_down_menu('currency', $currencies_array, $_SESSION['currency'], 'class="select" onchange="this.form.submit();"') . $hidden_get_variables . zen_hide_session_id()?>
								</div>
							</form>
						<!-- ====================================== -->
					</div>
					<div class="lang">
						<!-- ========== LANGUAGES ========== -->			
							<?php 
								if (!isset($lng) || (isset($lng) && !is_object($lng))) {
									$lng = new language;
								}
							
								reset($lng->catalog_languages);
							
								while (list($key, $value) = each($lng->catalog_languages)) {
									echo '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type) . '">' . zen_image(DIR_WS_LANGUAGES.$value['directory'].'/images/'.$value['image'], $value['name'], '', '', ' style="vertical-align:middle;"') . '</a>';
								}
							?>
						<!-- =============================== -->
					</div>
					<div class="navigation">
						<!-- ========== NAVIGATION LINKS ========== -->								
							<?php if ($_SESSION['customer_id']) { ?>
								<a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF; ?></a>
								<a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> 
							<?php
								  } else {
									if (STORE_STATUS == '0') {
							?>
								<a href="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGIN; ?></a>  
							<?php } } ?>  
							
							<?php if ($_SESSION['cart']->count_contents() != 0) { ?>
								<a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a>
								<a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?></a>
							<?php } ?>
						<!-- ====================================== -->
					</div>
				</div>
				<div class="wrapper box2">
					<div class="search">
						<!-- ========== SEARCH ========== -->
							<?php echo zen_draw_form('quick_find_header', zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get');?>
								<div>
							<?php 
								echo zen_draw_hidden_field('main_page',FILENAME_ADVANCED_SEARCH_RESULT);
								echo zen_draw_hidden_field('search_in_description', '1') . zen_hide_session_id();
							?>
							<?php echo zen_draw_input_field('keyword', '', 'class="input1"');?>
							<?php echo zen_image_submit ('search.png', HEADER_SEARCH_BUTTON, 'class="input2" ');?>
								</div>
							</form>
						<!-- ============================ -->
					</div>
					<div class="logo">
						<!-- ========== LOGO ========== -->
							<a href="<?php echo zen_href_link(FILENAME_DEFAULT);?>"><?php echo zen_image(DIR_WS_TEMPLATE.'images/logo.png'); ?></a>
						<!-- ========================== -->
					</div>
					<div class="cart">
						<!-- ========== SHOPPING CART ========== -->
							<?php 
								if ($_SESSION['cart']->count_contents() == 1) {
									$cart_text = '<span class="cart1"><?php echo HEADER_NOW_IN_CART; ?></span><a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') . '">' . $_SESSION['cart']->count_contents() . ' articoli</a>';
								} else {
									$cart_text = '<span class="cart1"><?php echo HEADER_NOW_IN_CART; ?></span><a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') . '">' . $_SESSION['cart']->count_contents() . ' articoli</a>';
								}
							?>
							<?php echo $cart_text ?> 
						<!-- =================================== -->
					</div>
				</div>
			</div>	 
		</div>  
	</div>
	<div class="wrapp">
			<div class="main-width">
				<div class="wrapper box3">
					<!-- ========== MENU ========== -->
						<div class="menu">
							<?php if (EZPAGES_STATUS_HEADER == '1' or (EZPAGES_STATUS_HEADER == '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])))) { ?>
								<?php require($template->get_template_dir('tpl_ezpages_bar_header.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_ezpages_bar_header.php'); ?>
							<?php } ?>
						</div>
					<!-- ========================== -->
				</div>
			</div>
		</div>
	</div>
<div class="main-width">
<!-- ========== CATEGORIES TABS ========= -->
	<?php require($template->get_template_dir('tpl_modules_categories_tabs.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_categories_tabs.php'); ?>
<!-- ==================================== -->
</div>
     
    
       


	<?php 
		if (HEADER_SALES_TEXT != '' || (SHOW_BANNERS_GROUP_SET2 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET2))) {
			if (HEADER_SALES_TEXT != '') {
	?>
        		<div id="tagline"><?php echo HEADER_SALES_TEXT;?></div>
	<?php
    		}
		}
	?>
   





                
    
<?php } ?>

Is there any other file to edit at all?or a string to add somewhere else in the same files? thanks
Cinzia

8 Feb 2012, 4:37 PM
#5
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: now in your cart in another language (tpl_header.php)

So, how did you change it to read 'articuli' now?

8 Feb 2012, 4:53 PM
#6
cinziapdl avatar

cinziapdl

New Zenner

Join Date:
Nov 2011
Location:
Harrogate, UK
Posts:
16
Plugin Contributions:
0

Re: now in your cart in another language (tpl_header.php)

I did not touch the 'articoli' bit at all. In fact I was wandering (in case your strategy worked) how could I on and have the 'articoli' in three languages? I guess I needed to define another variable but how?

8 Feb 2012, 5:03 PM
#7
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: now in your cart in another language (tpl_header.php)

Ooops

You need to change:

                        <!-- ========== SHOPPING CART ========== --> 
                            <?php  
                                if ($_SESSION['cart']->count_contents() == 1) { 
                                    $cart_text = '<span class="cart1"><?php echo HEADER_NOW_IN_CART; ?></span><a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') . '">' . $_SESSION['cart']->count_contents() . ' articoli</a>'; 
                                } else { 
                                    $cart_text = '<span class="cart1"><?php echo HEADER_NOW_IN_CART; ?></span><a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') . '">' . $_SESSION['cart']->count_contents() . ' articoli</a>'; 
                                } 
                            ?> 
                            <?php echo $cart_text ?>  
                        <!-- =================================== --> 

to

                        <!-- ========== SHOPPING CART ========== --> 
                            <?php  
                                if ($_SESSION['cart']->count_contents() == 1) { 
                                    $cart_text = '<span class="cart1">'. HEADER_NOW_IN_CART.'</span><a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') . '">' . $_SESSION['cart']->count_contents() . ' articoli</a>'; 
                                } else { 
                                    $cart_text = '<span class="cart1">'.  HEADER_NOW_IN_CART.'</span><a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') . '">' . $_SESSION['cart']->count_contents() . ' articoli</a>'; 
                                } 
                            ?> 
                            <?php echo $cart_text ?>  
                        <!-- =================================== --> 
8 Feb 2012, 5:04 PM
#8
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: now in your cart in another language (tpl_header.php)

And yes, if you want to do the same for articuli then you'd need to create a new define for that too. Your getting the hang of it :smile:

8 Feb 2012, 5:28 PM
#9
cinziapdl avatar

cinziapdl

New Zenner

Join Date:
Nov 2011
Location:
Harrogate, UK
Posts:
16
Plugin Contributions:
0

Re: now in your cart in another language (tpl_header.php)

Brilliant! IT WORKS
Now I'll try it with the articoli bit :)
Thank you ever so much!

8 Feb 2012, 6:01 PM
#10
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: now in your cart in another language (tpl_header.php)

You are more than welcome:D

9 Feb 2012, 2:30 AM
#11
penfifteenclub avatar

penfifteenclub

New Zenner

Join Date:
Jan 2012
Posts:
10
Plugin Contributions:
0

Re: now in your cart in another language (tpl_header.php)

What are the files called that include home, now in your cart, log in etc

I want to change 'now in your cart' to 'now in your kit' can anyone please help?

9 Feb 2012, 8:26 AM
#12
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: now in your cart in another language (tpl_header.php)

'now in your cart' is not a standard zen cart thing. it is something that your template has introduced. so you need to post a link to the site for people to have a chance of helping you.

9 Feb 2012, 11:31 PM
#13
cinziapdl avatar

cinziapdl

New Zenner

Join Date:
Nov 2011
Location:
Harrogate, UK
Posts:
16
Plugin Contributions:
0

Re: now in your cart in another language (tpl_header.php)

penfifteenclub:

What are the files called that include home, now in your cart, log in etc

I want to change 'now in your cart' to 'now in your kit' can anyone please help?

Generally that now in your cart is in /public_html/includes/templates/YOURTEMPLATE/common/tpl_header.php
or includes/languages/english/header.php

but you can always look in your Developers Tool Kit
just type at the bottom in Look-up in all files
Key or Name: now in your cart and then select All Files Catalog/Admin