Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Moving Welcome Guest Text to Sidebox

Moving Welcome Guest Text to Sidebox

Locked

Views: 1,573

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
11 Oct 2010, 2:52 PM
#1
nacheson avatar

nacheson

New Zenner

Join Date:
May 2010
Posts:
4
Plugin Contributions:
0

Moving Welcome Guest Text to Sidebox

Hello,

I am trying to move the Welcome Guest! Would you like to log yourself in? text from the main center column to a sidebox. I have a black sidebox installed and am able to get the define statements from the index.php for the Welcome Guest Text, but when it displays in the side box I get Hello %s! When logged in.

Does anyone know how to change the %s to the actual Session Variable or get the %s to actually work? What files or text do I need to include? In my sidebox defines.php file I include the following code:

if (STORE_STATUS == '0') {
define('TEXT_GREETING_GUEST', 'Welcome <span class="greetUser">Guest!</span> Would you like to <a href="%s">log yourself in</a>?');
} else {
define('TEXT_GREETING_GUEST', 'Welcome, please enjoy our online showcase.');
}
//define('TEXT_GREETING_PERSONAL', 'Hello <span class="greetUser">%s</span>! Would you like to see our <a href="%s">newest additions</a>?');

define('TEXT_GREETING_PERSONAL', 'Hello <span class="greetUser">%s</span>!');

this is how I output the defined statement:

$content .= '<p>' . TEXT_GREETING_PERSONAL . '</p>';

ANY help you can provide would be much appreciated!!

Thank you!
Natalie <><

12 Oct 2010, 3:21 AM
#2
nacheson avatar

nacheson

New Zenner

Join Date:
May 2010
Posts:
4
Plugin Contributions:
0

Re: Moving Welcome Guest Text to Sidebox

Well I figured it out!!!

First I installed a blank side box

Then I edited the files to be called welcome_sidebox_
You will have to edit inside the files to replace blank with welcome.

I then activated the sidebox in the admin-->Tools-->Layout Boxes and made it the top entry.

I commented out all of the div's in the sidebox files so that it would look like it was just at the top without a header.

In the templates/CUSTOM/sideboxes/tpl_welcome_sidebox.php the following code is the only active code, everything else is commented out.

if (SHOW_CUSTOMER_GREETING == 1) {
echo "<div class='greeting'>" . zen_customer_greeting() . "</div>";
}

The define statements are in includes/languages/english/extra_definitions/CUSTOM/welcome_sidebox_defines.php

if (STORE_STATUS == '0') {
  define('TEXT_GREETING_GUEST', 'Welcome <span class="greetUser">Guest!</span><br><a href="%s">Log In</a>');
} else {
  define('TEXT_GREETING_GUEST', 'Welcome, please enjoy our online showcase.');
}

define('TEXT_GREETING_PERSONAL', 'Welcome %s!<br><a href="%s">Log Out</a>');

This is the code from includes/modules/sideboxes/CUSTOM/welcome_sidebox.php

$show_welcome_sidebox = true;

  if ($show_welcome_sidebox == true) {
      require($template->get_template_dir('tpl_welcome_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_welcome_sidebox.php');

For the Log Out link to actually go to the log off page I had to edit functions_customers.php in the functions folder. I didn't want to do this because when I upgrade it will be overwritten if I don't remember but I couldn't find a way to make a custom functions file.

Line 140 in includes/functions/functions_customers.php:

$greeting_string = sprintf(TEXT_GREETING_PERSONAL, zen_output_string_protected($_SESSION['customer_first_name']), zen_href_link(FILENAME_LOGOFF));

So now I have a very nice Welcome Guest! Log In in the sidebox or a personalized Welcome Friend! Log Off in the sidebox.

I hope that saves someone hours of looking around I know it would have saved me!!!