View Full Version : intelligent link for product catalog

06-07-2009, 05:15 PM
I have a very basic product catalog with a recordset paging navigation bar. What I want is to know is when I click on a product and go to the product detail page how to get back to the right product listing page from the 'back link' as I may be on page 22 and dont want to go back to page 1.

All I'm doing at the moment is this a basic link <td><a href="products.php">Back to products.</a></td>

I know this can be done but need help.


06-08-2009, 02:04 AM
have to guess a bit here , the product is probably selected by a $_GET, if this is collected you could use <a href="products.php?<?php echo $_GET['product'] ;?> changing product for whatever you are using.

06-08-2009, 01:40 PM
would this get me back to to the right product page? Let's say i'm on page 2 of the product listing, this url is in the address bar products.php?pageNum_products=1&totalRows_products=15 so what do I need to do for me to get back to the right product listing page from the product detail page?

06-09-2009, 01:20 AM
no, i over simplified. so you need to get back to products.php?pageNum_products=1 then presumably. sorry not sure about that. personally i would think about using breadcrumbs as an alternative, this is often done with catalogues

06-09-2009, 07:50 AM
i was thinking about this if you exploded as an array using as the delimiter it should (might) work if you then call the 0 part of the array :)

06-09-2009, 10:12 AM
I dont think it's a breadcrumb I'm after, lets say I'm on page 4 of the product catalog and I click a product on page 4 and it takes to the product detail page, I then click 'back to products' link from that product detail page, I want to be able to go back to the page 4 of the product catalog, not back to page 1 which is what is currently happening.

I dont understand how to do this?

06-10-2009, 01:06 AM
ok i see now
the array idea might work for getting back to a product type
if product.php?product=1 is chuckle boxes
product.php?product=2 is laughing shafts
product.php?product=3 is giggle pins
it will capture up to this

from a detail page i would use a javasript history to go back 1 page
<a href='javascript:history.back(1);'>Back</a>

06-10-2009, 08:08 PM
thankyou, that's what I wanted.