I am currently using a SQL query to create a previous and next link on a product page. The follow query is what I currently have working:
{exp:query sql="SELECT exp_category_posts.cat_id,exp_category_posts.entry_id, exp_weblog_titles.entry_id, exp_weblog_titles.url_title AS ut FROM exp_weblog_titles, exp_category_posts WHERE title < '{title}' AND weblog_id = {weblog_id} AND status = 'open' AND cat_id = '36' AND exp_category_posts.entry_id = exp_weblog_titles.entry_id ORDER BY title DESC LIMIT 1"}
<a href="http://{path="><<< PREVIOUS</a> {/exp:query}
{exp:query sql="SELECT exp_category_posts.cat_id,exp_category_posts.entry_id, exp_weblog_titles.entry_id, exp_weblog_titles.url_title AS ut FROM exp_weblog_titles, exp_category_posts WHERE title > '{title}' AND weblog_id = {weblog_id} AND status = 'open' AND cat_id = '36' AND exp_category_posts.entry_id = exp_weblog_titles.entry_id ORDER BY title DESC LIMIT 1"}
<a href="http://{path="><<< NEXT</a> {/exp:query}This is basically grabbing the title and category fields and if the category equals 36 (a particular product line), it will create the links for previous and next. I would post this under the original post that I found it in, but it has been a long while and could not find it.
Anyways, the only problem I have with this code, is that after it reaches the last product the next does not show up (as expected). I would prefer it to still show next but just loop to back to the beginning. Is this possible? Same for the previous.
Thanks,