Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Hiding New products to unauthorised customers

Hiding New products to unauthorised customers

Locked

Started by alexsmith2709 on 21 May 2010, 10:15 AM · Views: 729

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
21 May 2010, 10:15 AM
#1
alexsmith2709 avatar

alexsmith2709

New Zenner

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

Post #1 by alexsmith2709

Hi,
On my store i wish to hide the "new products" box from unauthorised customers. I know i can set "Customer Shop Status - View Shop and Prices" to 1 in the admin panel but that completely removes all the side boxes which i dont want to do.

I have done some searches but cant find anything that fits my needs. I saw people suggesting to use the code:

$show_categories= false;

if (!$_SESSION['customer_id']) {
  // run the code
    $show_categories= true;
} else {
// do not run the code
  $show_categories= false;
}  

if ($show_categories == true) {

but i have no idea where i would put that. My guess would be in the whats_new.php but then i dont know where to put it in there. (i know the variable would change in this statement).

I would be grateful of any help.

Thanks

22 May 2010, 7:16 PM
#2
ajeh avatar

ajeh

Oba-san

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

Post #2 by ajeh

Do you want to block the New Sidebox from Customers not logged in or not logged in and not Approved? :unsure:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

23 May 2010, 12:57 PM
#3
alexsmith2709 avatar

alexsmith2709

New Zenner

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

Post #3 by alexsmith2709

I would like to block it from anyone not logged in and not approved. I would be very happy if this is achievable.

Thanks

23 May 2010, 4:08 PM
#4
ajeh avatar

ajeh

Oba-san

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

Post #4 by ajeh

  if ($_SESSION['customers_authorization'] != xx && $random_whats_new_sidebox_product->RecordCount() > 0 ) {

where XX is the value you want used ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

24 May 2010, 1:20 PM
#5
alexsmith2709 avatar

alexsmith2709

New Zenner

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

Post #5 by alexsmith2709

Where do i put this code? Is it in whats_new.php?
Im not really sure what to do with it. I've tried putting it in whats_new.php but with no luck. I doesnt show the sidebox to customers not logged in (which is a start) but when an unauthorised user logs in they can see the sidebox.

Thanks

24 May 2010, 9:44 PM
#6
ajeh avatar

ajeh

Oba-san

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

Post #6 by ajeh

This is for the sidebox ...

In the file:
/includes/modules/sideboxes/your_template_dir/whats_new.php

You should use the code:

//  if ($random_whats_new_sidebox_product->RecordCount() > 0 ) {
  if ($_SESSION['customer_id'] && $_SESSION['customers_authorization'] == 0 && $random_whats_new_sidebox_product->RecordCount() > 0 ) {

I left out the $_SESSION['customer_id'] ...

Or you could code that to test if the $_SESSION['customers_authorization'] is set and if it is equal to 0 ... either way should work ...

You can adapt the code for other areas of the Catalog ...

On some of the code, you will also need to determine if the Products are considered new or not ...

You can look in the New Product Module in the:
/includes/modules/new_products.php

to see how it tests for new products ...

For the module itself, you can again turn it off based on the IF that is used in the whats_new.php sidebox ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

24 May 2010, 10:25 PM
#7
alexsmith2709 avatar

alexsmith2709

New Zenner

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

Post #7 by alexsmith2709

thanks Ajeh. Got it all working now and even tested with the specials sidebox and it works fine with that too.

Thanks again

24 May 2010, 10:43 PM
#8
ajeh avatar

ajeh

Oba-san

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

Post #8 by ajeh

You are most welcome ... thanks for the update that this is now working for you ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!