Zen Cart Logo
Forums / Basic Configuration / Sidebox visible- but not accessible unless logged in

Sidebox visible- but not accessible unless logged in

Locked

Views: 3,184

Results 1 to 18 of 18
This thread is locked. New replies are disabled.
27 May 2009, 10:46 PM
#1
btolly avatar

btolly

New Zenner

Join Date:
May 2009
Posts:
59
Plugin Contributions:
0

Sidebox visible- but not accessible unless logged in

I read the thread about hidinga sidebox until a customer logs in- but is it possible to let customers see the sideboxes but not access them until they log in?

27 May 2009, 10:51 PM
#2
stevesh avatar

stevesh

Black Belt

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

Re: Sidebox visible- but not accessible unless logged in

If you mean that visitors could see, for example, the category names in the Categories sidebox, but couldn't click on them (the names wouldn't be links) until they were logged in, I'm sure you could do that, but I'm not coder enough to tell you exactly how.

If you don't mind my asking, why would you want to?

27 May 2009, 11:01 PM
#3
btolly avatar

btolly

New Zenner

Join Date:
May 2009
Posts:
59
Plugin Contributions:
0

Re: Sidebox visible- but not accessible unless logged in

I am not selling products at this time- I am promoting other companies, services, and educational resources for an on-line community. I would like them to log in to create a comprehensive customer database.

BT
Berkley, MI

28 May 2009, 12:44 AM
#4
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,604
Plugin Contributions:
0

Re: Sidebox visible- but not accessible unless logged in

... So I see something in a sidebox I am interested in, I click on it and get sent to the login? As a user, I would be outta' there so fast ...

28 May 2009, 1:02 AM
#5
btolly avatar

btolly

New Zenner

Join Date:
May 2009
Posts:
59
Plugin Contributions:
0

Re: Sidebox visible- but not accessible unless logged in

Kim -

I appreciate your concern- but until you understand the users I am targeting and why please don't post unless you can give me some meaningful coding direction.

So can you give me some direction to make this happen or is it impossible?

Respectively submitted-

BT

28 May 2009, 10:42 AM
#6
stevesh avatar

stevesh

Black Belt

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

Re: Sidebox visible- but not accessible unless logged in

You haven't mentioned how skilled you are at programming, so there's no way to know if you need code written for you, or a nudge in the right direction.

As I said, I'm not a coder, so if I wanted to do that, I'd search the forums for require login to see if someone else had asked a similar question and had received a useful reply.

You might also post in the Commercial Help Wanted forum.

BTW, you'll find that the devs and the people who hang out here don't see this forum as a you-ask-a-question-we-answer-it sort of thing. We view it as a community, and if you're proposing something that doesn't seem like a good idea, we're likely to say so. Part of the deal.

28 May 2009, 12:24 PM
#7
btolly avatar

btolly

New Zenner

Join Date:
May 2009
Posts:
59
Plugin Contributions:
0

Re: Sidebox visible- but not accessible unless logged in

Thanks for the response and the search suggestion- sometimes it is hard to think the right search words to fine tune what you are looking for.

I looked into the Customer Shop Status- which gives a variety of "out of the box" options - which could possibly be just as frustrating to a user.

There is a website called "lynda.com"- you may be familiar with. It is for software training etc. - they allow access to certain tutorials within a subject title and show an additional list that you can have access to if you sign-up for a membership. I'm not charging for a membership- just want the user to see what else is offered if they sign-in. Maybe I can handle that by a EZ-Page explaining the benefits of membership and then turn on a box once logged in.

I am not a coder by any means- I understand what the code is basically doing but not literally doing- at best.

BTW-I have no problems with questions and opinions- you posed a question and I answered it- they help all of us work out ideas and problems and maybe even straighten out our irrational thinking- but an opinion without any type of attempt to understand why or an attempt to help- is useless for everyone. Dev or not.

Thanks for the help.

29 May 2009, 6:36 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sidebox visible- but not accessible unless logged in

I tend to agree with Kim on this ... but if you gotta do it this way, decide if you want the links when not logged in to just be text with a headline ... login to access or something ...

Then customize the links to either be active or go elsewhere if the customer is not logged in ...

29 May 2009, 7:09 PM
#9
stevesh avatar

stevesh

Black Belt

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

Re: Sidebox visible- but not accessible unless logged in

Another way might be to create two copies of the Blank Sidebox mod. One would have a list of the subscriber-only content, but not links. That one would be active only when the user is not logged in. After he creates an account and logs in, the second sidebox, with links to the content, would be active.

I think there are several threads discussing how to make sideboxes appear/disappear depending on login.

29 May 2009, 7:57 PM
#10
gjh42 avatar

gjh42

Black Belt

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

Re: Sidebox visible- but not accessible unless logged in

Yes! That would be far easier than trying to make individual links change their behavior on login status. You could also make a dummy categories-like sidebox which would switch with the real categories sidebox on login status, etc.

Just provide clear notes about what is happening so users don't get frustrated when things that look like they ought to be links don't do anything.

30 May 2009, 1:36 PM
#11
btolly avatar

btolly

New Zenner

Join Date:
May 2009
Posts:
59
Plugin Contributions:
0

Re: Sidebox visible- but not accessible unless logged in

Thanks everyone for all of your suggestions. I really appreciate it. I will look into them further and get back.

20 Sep 2009, 5:07 PM
#13
gjh42 avatar

gjh42

Black Belt

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

Re: Sidebox visible- but not accessible unless logged in

As a general approach, I would add a test in the ez-page processing file like```php
if($_GET['id'] == xx and !$_SESSION['customer_id']) {
//code to go to login page or output message
}else{
//the existing ez-page processing code
}


If that page is being requested and there is not a customer login id, the custom code is executed; otherwise, the standard ez-page code is executed.
21 Sep 2009, 5:17 AM
#14
mercurysoun_it avatar

mercurysoun_it

New Zenner

Join Date:
Sep 2009
Posts:
9
Plugin Contributions:
0

Re: Sidebox visible- but not accessible unless logged in

Thank you.
Where do you think I can insert the code?which php file?

21 Sep 2009, 7:16 AM
#15
gjh42 avatar

gjh42

Black Belt

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

Re: Sidebox visible- but not accessible unless logged in

/includes/modules/pages/page/header_php.php

At the top of the file, find this```php
// This should be first line of the script:
$zco_notifier->notify('NOTIFY_HEADER_START_EZPAGE');

$ezpage_id = (int)$_GET['id'];
if ($ezpage_id == 0) zen_redirect(zen_href_link(FILENAME_DEFAULT));

$chapter_id = (int)$_GET['chapter'];
and insert the test to get thisphp
// This should be first line of the script:
$zco_notifier->notify('NOTIFY_HEADER_START_EZPAGE');

$ezpage_id = (int)$_GET['id'];
if ($ezpage_id == 0) zen_redirect(zen_href_link(FILENAME_DEFAULT));

if($ezpage_id == xx and !$_SESSION['customer_id']) {
//code to go to login page or output message
}else{
$chapter_id = (int)$_GET['chapter'];

//code to go to login page or output message

At the bottom of the file,add a }```php
// This should be last line of the script:
$zco_notifier->notify('NOTIFY_HEADER_END_EZPAGE');
?>
```to get this```php
}
// This should be last line of the script:
$zco_notifier->notify('NOTIFY_HEADER_END_EZPAGE');
?>

Note that this file is not overrideable; you will have to modify it in the original location. Save a copy renamed as header_php.bak in case of problems.

22 Sep 2009, 5:59 AM
#16
mercurysoun_it avatar

mercurysoun_it

New Zenner

Join Date:
Sep 2009
Posts:
9
Plugin Contributions:
0

Re: Sidebox visible- but not accessible unless logged in

Thank you very much gjh42 and sorry for my ignorance but in my header_php.php i find this:

// This should be first line of the script:
$zco_notifier->notify('NOTIFY_HEADER_START_EZPAGE');

$id = (int)$_GET['id'];
$chapter_id = (int)$_GET['chapter'];
$chapter_link = (int)$_GET['chapter'];

//die('I SEE ' . $id . ' - ' . $group_id);
//die('I SEE ' . $id . ' - ' . $chapter_id);

what can I do?

(sorry again)

22 Sep 2009, 1:16 PM
#18
gjh42 avatar

gjh42

Black Belt

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

Re: Sidebox visible- but not accessible unless logged in

mercurysoun.it - What version of Zen Cart are you using? Your posted snippet looks like it may be old code.
You can adapt the suggestion by changing $ezpage_id to $id and inserting it here (with Ajeh's redirection code included)```php
$id = (int)$_GET['id'];
$chapter_id = (int)$_GET['chapter'];
$chapter_link = (int)$_GET['chapter'];

```php
$id = (int)$_GET['id'];
if($id == xx and !$_SESSION['customer_id']) {
  // if the customer is not logged on, redirect them to the login page
  $_SESSION['navigation']->set_snapshot();
  zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
}else{
$chapter_id = (int)$_GET['chapter'];
$chapter_link = (int)$_GET['chapter'];