If this is your first visit, check our documentation. To post, register or login.

ez page off/on?

Started by munchie on 20 Jul 2011, 8:40 AM · Views: 2,636

Results 1 to 20 of 36
20 Jul 2011, 8:40 AM
#1
munchie avatar

munchie

New Zenner

Join Date:
Jun 2011
Posts:
14
Plugin Contributions:
0

Post #1 by munchie

hi all,

i was wondering whether it is possible to have the "login" link on the ez page header and have this changed to "logoff" if the customer has logged in?

what files would need to be edited or process needed to do this? also, can this be done with an image? i.e. have an image change from "login" to "logoff" button if user is signed in?

any help appreciated!

20 Jul 2011, 10:10 AM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Post #2 by stevesh

Not sure what you're asking. That would be the title of an EZ page, which you can change in Admin - Tools - EZ Pages.

20 Jul 2011, 10:15 AM
#3
munchie avatar

munchie

New Zenner

Join Date:
Jun 2011
Posts:
14
Plugin Contributions:
0

Post #3 by munchie

sorry, its https://www.teenybooks.co.uk

as you can see, there is a login nav link at the top right and also i recently added a logoff link on ez page which is there permenantly atm as well as a login image on the right.

im trying to understand which would be best, either changing the ez page link to not appear if it is a guest visitor viewing and to appear if customer is logged in or to change the login image to show another image when customer is logged in.

would any of these options be possible?

20 Jul 2011, 12:17 PM
#4
munchie avatar

munchie

New Zenner

Join Date:
Jun 2011
Posts:
14
Plugin Contributions:
0

Post #4 by munchie

stevesh:

Not sure what you're asking. That would be the title of an EZ page, which you can change in Admin - Tools - EZ Pages.

i understand that that is the way to create an ez page...but is there a way to create a log off easy page that ONLY shows on the ez page header when the customer is logged in?

20 Jul 2011, 1:01 PM
#5
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Post #5 by gjh42

You would need to add some custom code to /includes/templates/your_template/templates/tpl_ezpages_bar_header.php.```php

<?php if (sizeof($var_linksList) >= 1) { ?> <div id="navEZPagesTop"> <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) { ?> <a href="<?php echo $var_linksList[$i]['link']; ?>"><?php echo $var_linksList[$i]['name']; ?></a><?php echo ($i < $n ? EZPAGES_SEPARATOR_HEADER : '') . "\n"; ?> <?php } // end FOR loop ?> </div> <?php } ?> ```Wrap a test around the <a href=" line to check for the ez-page being processed and display the login link only if not logged in and the logoff link only if logged in. Replace the above code with this: ```php <?php if (sizeof($var_linksList) >= 1) { ?> <div id="navEZPagesTop"> <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) { if (!($var_linksList[$i]['name'] == 'Login' and $_SESSION['customer_id']) or !($var_linksList[$i]['name'] == 'Logoff' and !$_SESSION['customer_id'])) { ?> <a href="<?php echo $var_linksList[$i]['link']; ?>"><?php echo $var_linksList[$i]['name']; ?></a><?php echo ($i < $n ? EZPAGES_SEPARATOR_HEADER : '') . "\n"; ?> <?php } //end if } // end FOR loop ?> </div> <?php } ?> ```Be sure the names are spelled and capitalized the same in the code and the page title.
20 Jul 2011, 3:30 PM
#6
munchie avatar

munchie

New Zenner

Join Date:
Jun 2011
Posts:
14
Plugin Contributions:
0

Post #6 by munchie

thanks gjh for your efforts in helping me to resolve this issue. i will do as you say when i get home and update on the progress!:smartalec:

21 Jul 2011, 7:37 PM
#7
munchie avatar

munchie

New Zenner

Join Date:
Jun 2011
Posts:
14
Plugin Contributions:
0

Post #7 by munchie

gjh42:

You would need to add some custom code to /includes/templates/your_template/templates/tpl_ezpages_bar_header.php.```php

<?php if (sizeof($var_linksList) >= 1) { ?> <div id="navEZPagesTop"> <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) { ?> <a href="<?php echo $var_linksList[$i]['link']; ?>"><?php echo $var_linksList[$i]['name']; ?></a><?php echo ($i < $n ? EZPAGES_SEPARATOR_HEADER : '') . "\n"; ?> <?php } // end FOR loop ?> </div> <?php } ?> ```Wrap a test around the <a href=" line to check for the ez-page being processed and display the login link only if not logged in and the logoff link only if logged in. > Replace the above code with this: > ```php <?php if (sizeof($var_linksList) >= 1) { ?> <div id="navEZPagesTop"> <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) { if (!($var_linksList[$i]['name'] == 'Login' and $_SESSION['customer_id']) or !($var_linksList[$i]['name'] == 'Logoff' and !$_SESSION['customer_id'])) { ?> <a href="<?php echo $var_linksList[$i]['link']; ?>"><?php echo $var_linksList[$i]['name']; ?></a><?php echo ($i < $n ? EZPAGES_SEPARATOR_HEADER : '') . "\n"; ?> <?php } //end if } // end FOR loop ?> </div> <?php } ?> ```Be sure the names are spelled and capitalized the same in the code and the page title.

hi,

i have jus replaced the code but nothing appears to have changed? would it be possible to clarify the last line "Be sure the names are spelled and capitalized the same in the code and the page title"?

i literally replaced the code above as instructed and the "logoff" ez page still shows regardless of whether im logged in or not...am i suppose to change something? or add a "login" ez page too?

22 Jul 2011, 12:56 PM
#8
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Post #8 by gjh42

What are the precise titles of the login and logoff ez-pages? The code needs to use those exactly in order to work.

Looking at your site, the login button is not related to ez-pages at all, so you could either scrap that button and make an ez-page internal link pointing to the login page, or keep the button and remove the code that tests for it in ez-pages.

My advice would be to keep login/logoff functions in one place (showing alternately depending on status), either as links in the ez-pages menu or as buttons where your Login button is. You could use code similar to the above to switch buttons.

23 Jul 2011, 12:06 AM
#9
munchie avatar

munchie

New Zenner

Join Date:
Jun 2011
Posts:
14
Plugin Contributions:
0

Post #9 by munchie

gjh42:

What are the precise titles of the login and logoff ez-pages? The code needs to use those exactly in order to work.

Looking at your site, the login button is not related to ez-pages at all, so you could either scrap that button and make an ez-page internal link pointing to the login page, or keep the button and remove the code that tests for it in ez-pages.

My advice would be to keep login/logoff functions in one place (showing alternately depending on status), either as links in the ez-pages menu or as buttons where your Login button is. You could use code similar to the above to switch buttons.

many thanks for your quick reply gjh42. i would prefer that the buttons switch from login to logoff but where would i place the code to enable the switch or the button images depending on whether customer is login/logoff? at the moment the image is hardcoded within the tpl_header.php i think and not implemented using css. the code above doesnt make much sense to me as my php knowledge is fairly limited.

thanks for the help in advance.

23 Jul 2011, 4:16 AM
#10
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Post #10 by gjh42

Post the area of tpl_header.php where the login button is coded, and I can show you how to implement the switch. There is no CSS involved in any case here, unless you wanted to tweak the position of the button(s).

23 Jul 2011, 10:18 AM
#11
munchie avatar

munchie

New Zenner

Join Date:
Jun 2011
Posts:
14
Plugin Contributions:
0

Post #11 by munchie

gjh42:

Post the area of tpl_header.php where the login button is coded, and I can show you how to implement the switch. There is no CSS involved in any case here, unless you wanted to tweak the position of the button(s).

thanks for your quick response. the code embedded within tpl_header.php is with the div id tag "register"

<div id="register"> <a href="http://teenybooks.co.uk/index.php?main_page=create_account"><img align="left" id="buttons" src="includes/templates/all_business/buttons/english/button_join.jpg"/></a> <a href="http://teenybooks.co.uk/index.php?main_page=login"><img align="right" id="buttons" src="includes/templates/all_business/buttons/english/button_login.jpg"/></a> </div>

the above shows both the join and login buttons but i only want the login image to change to logoff pointing to the logoff page.

i have applied css to "register" to ensure that the position of these 2 images are correct and would want simply the button to change rather than the image to appear somewhere else.....

eaerly awaiting your help, thanks!

23 Jul 2011, 1:57 PM
#12
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Post #12 by gjh42

The stock tpl_header.php has code that does exactly what you want, for text links:```php

<?php if ($_SESSION['customer_id']) { ?>
<li><a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF; ?></a></li>
<li><a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a></li>
<?php } else { if (STORE_STATUS == '0') { ?>
<li><a href="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGIN; ?></a></li>
<?php } } ?>
You can change this to use your image links and insert it into your div:```php
<div id="register">
    <a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><img align="left" id="buttonJoin" src="includes/templates/all_business/buttons/english/button_join.jpg"/></a>
<?php if ($_SESSION['customer_id']) { ?>
    <a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><img align="right" id="buttonLogoff" src="includes/templates/all_business/buttons/english/button_logoff.jpg"/></a>
<?php
      } else {
        if (STORE_STATUS == '0') {
?>
    <a href="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><img align="right" id="buttonLogin" src="includes/templates/all_business/buttons/english/button_login.jpg"/></a>
<?php } } ?>
</div>

I changed the ids from "buttons" to individual ones, as an id is supposed to be unique on a page.

23 Jul 2011, 4:03 PM
#13
meshgraphics avatar

meshgraphics

New Zenner

Join Date:
Mar 2008
Location:
Ontario
Posts:
42
Plugin Contributions:
0

Post #13 by meshgraphics

fyi The breadcrumbs div is overhanging the jquery slider.

my pc Ubuntu FF 3.6

Jonny
http://meshgraphics.com Where shapes become different shapes than the shapes they had been previously. Me do good ad copy 2

31 Jul 2011, 6:55 PM
#14
munchie avatar

munchie

New Zenner

Join Date:
Jun 2011
Posts:
14
Plugin Contributions:
0

Post #14 by munchie

hi gft,

just a quick update, i've finally got round to updating this piece of code and it works like a treat! thank you very much for your guidance, you've been a great help!

thanks for mentioning the overhang, ive got to get that cleared up as well, coding and everything is a completely new thing for me!

i have one question tho, i have searched high and low and it seems that there isnt an easy way to use zencart to adopt 2 different price models?

to clarify, the aim is to sell digital downloads per product but also give the customer the ability to pay a fixed membership cost for, say, a month and get the downloads entirely free, or limited downloads for that month and then roll the subscription on. but also if customer chooses to not go for the subscription, they can also simply pay per product....is it possible?

30 Nov 2011, 7:59 PM
#15
discoverytdi avatar

discoverytdi

Totally Zenned

Join Date:
May 2011
Location:
Sunny Rossendale (not)
Posts:
562
Plugin Contributions:
0

Post #15 by discoverytdi

Ive Just tried this and getting the same as munchie
here's what I did placed this

<?php /** * Page Template * * Displays EZ-Pages Header-Bar content.<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_ezpages_bar_header.php 3377 2006-04-05 04:43:11Z ajeh $ */ /** * require code to show EZ-Pages list */ include(DIR_WS_MODULES . zen_get_module_directory('ezpages_bar_header.php')); ?> <?php if (sizeof($var_linksList) >= 1) { ?> <div id="navEZPagesTop"> <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) { if (!($var_linksList[$i]['name'] == 'Login' and $_SESSION['customer_id']) or !($var_linksList[$i]['name'] == 'Logoff' and !$_SESSION['customer_id'])) { ?> <a href="<?php echo $var_linksList[$i]['link']; ?>"><?php echo $var_linksList[$i]['name']; ?></a><?php echo ($i < $n ? EZPAGES_SEPARATOR_HEADER : '') . "\n"; ?> <?php } //end if } // end FOR loop ?> </div> <?php } ?> into the ezpages tpl overwriting the original disabled the logoff button in the header leaving just the login but the button didn't switch when I login with my test acount test site <http://www.rvsolarsystems.co.uk>

What ever your doing remember to KISS ( Keep It Simple Stupid )

30 Nov 2011, 10:52 PM
#17
discoverytdi avatar

discoverytdi

Totally Zenned

Join Date:
May 2011
Location:
Sunny Rossendale (not)
Posts:
562
Plugin Contributions:
0

Post #17 by discoverytdi

gjh42:

Are your ez-page names precisely Login and Logoff?

yes just checked
http://www.rvsolarsystems.co.uk/shop/index.php

What ever your doing remember to KISS ( Keep It Simple Stupid )

5 Jan 2012, 11:57 PM
#18
keekee avatar

keekee

New Zenner

Join Date:
Dec 2011
Posts:
22
Plugin Contributions:
0

Post #18 by keekee

So you actually create two EZ pages ... One for Login and one for Logoff... Correct?

May all beings give and receive compassion, Live free from fear, And dwell in peace. - author
unknown

6 Jan 2012, 12:09 AM
#19
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Post #19 by gjh42

That's what you need to do. Each of them would be an "internal link".

You can use any names as long as they are handled consistently by the code.

6 Jan 2012, 12:33 AM
#20
keekee avatar

keekee

New Zenner

Join Date:
Dec 2011
Posts:
22
Plugin Contributions:
0

Post #20 by keekee

Thank You. :)

I was going to do this but now in trying to fix something else my host made the whole site SSL and I gotta figure out how to make the unsecure pages work.

If not one thing it's another :cry:

May all beings give and receive compassion, Live free from fear, And dwell in peace. - author
unknown