Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Detecting when a user is on main/category/product pages

Detecting when a user is on main/category/product pages

Locked

Views: 1,352

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
11 Apr 2007, 3:13 AM
#1
rhutchison avatar

rhutchison

New Zenner

Join Date:
Mar 2007
Posts:
21
Plugin Contributions:
0

Detecting when a user is on main/category/product pages

How do I go about detecting when a user is on the home page, a category page, or on a product page? I want to use this information to display different sidebar information depending on what "level" the customer is at on my site.

-Roger

11 Apr 2007, 4:01 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Detecting when a user is on main/category/product pages

You do not need to necessarily "detect" what page they are on but more what page they select to be loaded

In your install of files find includes/templates/template_default/css/CSS_reade_me.txt file for css by page

11 Apr 2007, 4:16 AM
#3
rhutchison avatar

rhutchison

New Zenner

Join Date:
Mar 2007
Posts:
21
Plugin Contributions:
0

Re: Detecting when a user is on main/category/product pages

Thank you for the reference. I read through it and will likely be useful for other ideas I have, but what I am intending to do is strategically add rel="nofollow" to certain anchors depending on what "level" (main/category/product) they are at.

I figure this will involve some conditional statements in the affected sidebox files, but I wanted to get a confirmation on exactly which variables flag the status (like !$this_is_home_page).

-Roger

11 Apr 2007, 4:25 AM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Detecting when a user is on main/category/product pages

In plain english - what are you attempting to accomplish?

11 Apr 2007, 9:27 AM
#5
masterblaster avatar

masterblaster

Totally Zenned

Join Date:
Aug 2004
Location:
Germany
Posts:
528
Plugin Contributions:
0

Re: Detecting when a user is on main/category/product pages

Yes interesting case? What are you trying to do...

You would track the level to the following
product page -> main_page=product_info
category page -> main_page=index&cPath=xxx
home page -> main_page=index (cPath not set)

all being trackable by the php $_GET[] paramenter (for example $_GET[main_page])

12 Apr 2007, 8:23 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Detecting when a user is on main/category/product pages

rhutchison:

How do I go about detecting when a user is on the home page, a category page, or on a product page? I want to use this information to display different sidebar information depending on what "level" the customer is at on my site.

-Roger

($current_page_base) tells you which page they're on.

($this_is_home_page == true) when on home page

a category/product-listing is denoted by (!this_is_home_page && $current_page_base == 'index')

a product page is denoted by ($current_page_base == 'product_info') (assuming you're using the default product-type)

12 Apr 2007, 8:57 AM
#7
masterblaster avatar

masterblaster

Totally Zenned

Join Date:
Aug 2004
Location:
Germany
Posts:
528
Plugin Contributions:
0

Re: Detecting when a user is on main/category/product pages

DrByte:

($current_page_base) tells you which page they're on.

($this_is_home_page == true) when on home page

a category/product-listing is denoted by (!this_is_home_page && $current_page_base == 'index')

a product page is denoted by ($current_page_base == 'product_info') (assuming you're using the default product-type)

Yeah either this way or what I have mentioned above. The vars drbyte mentioned are being controlled by the get parameters ...[EDIT: and are proper Zen Cart coding approaches.]