rayfinkel2 Posted February 21, 2007 Share Posted February 21, 2007 Previous/Next Above Product Images - Pagination? -------------------------------------------------------------------------------- Hi, I am currently building a website and I want to figure out how the programmer added the previous and next buttons above the image on this page: http://www.yandy.com/Microfiber-Halter-Bandeau-Top-Pants.aspx When you click next, it goes to the next product in that category. I understand how pagination works, but am having trouble grasping how this programmer made this work. Any ideas? Thank You, Ray Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 21, 2007 Share Posted February 21, 2007 The buttons don't even do anything in Firefox OR IE... Quote Link to comment Share on other sites More sharing options...
rayfinkel2 Posted February 21, 2007 Author Share Posted February 21, 2007 They may not because I am giving you a direct link to the product. If you go to a category or do a search and then select a product, then they should work. Quote Link to comment Share on other sites More sharing options...
tom100 Posted February 21, 2007 Share Posted February 21, 2007 If you wanted to do what you are saying though, you'd have to send the current product id in the URL via: page?productId=MyID Then do a query like select * from blah where `id` > 'blah' order by id limit 0,1 Quote Link to comment Share on other sites More sharing options...
rayfinkel2 Posted February 21, 2007 Author Share Posted February 21, 2007 Yeah Tom, that makes sense, but the query will change depending on what you searched for or what category you are in. My guess is that when you go to a category or do a search and then choose a product, it pulls in an array of all prod_id's in the category. Then it passes that array to the product page and uses it to determine the next or previous page. Does that sound right? Quote Link to comment Share on other sites More sharing options...
tom100 Posted February 21, 2007 Share Posted February 21, 2007 My post was the simple version. For in depth databases, you will have to carry the search parameters. But that's basically how it works. There are different methods to do that though. Quote Link to comment Share on other sites More sharing options...
rayfinkel2 Posted February 21, 2007 Author Share Posted February 21, 2007 Ok Tom. It took me a little bit, but I think I understand what you are saying. I should pass the prod_id and some part of the query that would recreate it in the products page (maybe the category_id or search term) and then recreate the query with a limit. Makes sense. I will try that, but if anyone else has an easier way, please let me know. Thanks Tom! Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 21, 2007 Share Posted February 21, 2007 Instead of querying the database again, save the product IDs in the session when you do the search, then use them for the next and previous buttons - less database work. Quote Link to comment Share on other sites More sharing options...
rayfinkel2 Posted February 21, 2007 Author Share Posted February 21, 2007 Should I save them as an array? Quote Link to comment Share on other sites More sharing options...
rayfinkel2 Posted February 21, 2007 Author Share Posted February 21, 2007 When I am moving through product pages with the next button, how do I figure out which value I am at within the array? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.