Forums / General Questions / Add prev/next buttons to navigate through CATEGORIES

Add prev/next buttons to navigate through CATEGORIES

Views: 1,262

Results 1 to 18 of 18
16 Jun 2013, 1:58 PM
#1
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Add prev/next buttons to navigate through CATEGORIES

Hi.
I have a project where I simply have one product per category, hence the categories skip direct to the product. I would like to add navigation buttons to the product page that would navigate to the next category therefore making it possible for customers to navigate as if the category had multiple products as would be the more normal case.
The simple solution, of course would be to have one category with all the products in that category, but I want to avoid this ideally.
tkd revision dot com

Thank you

17 Jun 2013, 1:06 PM
#2
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Add prev/next buttons to navigate through CATEGORIES

A polite bump please.

17 Jun 2013, 2:30 PM
#3
gjh42 avatar

gjh42

Black Belt

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

Re: Add prev/next buttons to navigate through CATEGORIES

You need custom code that uses the current category id or cPath (available from the URL as $_GET['cPath']) to look up the previous and next categories (by sort orders? or ??), then populate buttons with those cPaths in the URL. How would you determine the prev/next order that should be followed? Will these all be top cats, or is there a hierarchy? Hopefully somebody will feel like writing out the actual code to do this.

17 Jun 2013, 2:37 PM
#4
gjh42 avatar

gjh42

Black Belt

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

Re: Add prev/next buttons to navigate through CATEGORIES

You need a SQL query to select * from the categories table, order by ??your criteria. Then you can find the location of the current category in the resulting array and step backward and forward in the array to get the desired destinations.

17 Jun 2013, 2:40 PM
#5
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Add prev/next buttons to navigate through CATEGORIES

Thank you Glenn.
Yes hopefully indeed...anyone seen Lat9 today? :wink:

17 Jun 2013, 2:41 PM
#6
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Add prev/next buttons to navigate through CATEGORIES

gjh42:

You need a SQL query to select * from the categories table, order by ??your criteria. Then you can find the location of the current category in the resulting array and step backward and forward in the array to get the desired destinations.

Hmm, you lost me there lol.

17 Jun 2013, 2:45 PM
#7
gjh42 avatar

gjh42

Black Belt

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

Re: Add prev/next buttons to navigate through CATEGORIES

Meta-code :) not real code, but describes the sequence of what it should do... You can help by clarifying the questions I posted on criteria.

17 Jun 2013, 3:06 PM
#8
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Add prev/next buttons to navigate through CATEGORIES

Listed as per the order of categorise in sidebox. Tell me if I'm not making sense though please.

17 Jun 2013, 5:02 PM
#10
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Add prev/next buttons to navigate through CATEGORIES

gjh42:

You're using category sort order to get the categories organized in the sidebox?

Yep, along with your category dressing mod, that's all...unless you can see something that I've done to the contrary?

17 Jun 2013, 5:49 PM
#12
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Add prev/next buttons to navigate through CATEGORIES

gjh42:

That's the important information, to know the field to order by in the SQL query.

Oh I see, sorry, I'm a bit slow today.
So does that help shed any light on a solution please?

17 Jun 2013, 5:56 PM
#13
gjh42 avatar

gjh42

Black Belt

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

Re: Add prev/next buttons to navigate through CATEGORIES

It gives enough info to do the needed coding, but as I am a week and a half away from our annual festival where we expect 4-5000 people on my land over three days, I have other things on my mind right now:)

17 Jun 2013, 6:07 PM
#14
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Add prev/next buttons to navigate through CATEGORIES

gjh42:

It gives enough info to do the needed coding, but as I am a week and a half away from our annual festival where we expect 4-5000 people on my land over three days, I have other things on my mind right now:)

Well I thank you in advance, you're a very kind man Glenn.
Now, about this festival, can anyone tag along? :wink:

2 Jul 2013, 9:12 AM
#15
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Add prev/next buttons to navigate through CATEGORIES

gjh42:

It gives enough info to do the needed coding, but as I am a week and a half away from our annual festival where we expect 4-5000 people on my land over three days, I have other things on my mind right now:)

Hi Glenn, I hope your festival was another success.
Any chance of a polite bump on this one please...
much appreciated.

3 Jul 2013, 9:16 PM
#16
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Add prev/next buttons to navigate through CATEGORIES

Bump please, I really need this as the finishing touch to my store while I finish populating my products.
Thank you Glenn

4 Jul 2013, 8:57 AM
#18
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Add prev/next buttons to navigate through CATEGORIES

gjh42:

I'm afraid I don't have the spare time to research this and write it now. Hopefully someone will.

Thank you anyway, much appreciated.