PDA

View Full Version : intelligent link for product catalog


mr_badger
06-07-2009, 06:15 PM
Hi,
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.

Thanks.

edbr
06-08-2009, 03: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.

mr_badger
06-08-2009, 02: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?

edbr
06-09-2009, 02: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

edbr
06-09-2009, 08: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 :)

mr_badger
06-09-2009, 11: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?

edbr
06-10-2009, 02:06 AM
ok i see now
the array idea might work for getting back to a product type
ie
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>

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