Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Link to first product in category, NOT listing

Link to first product in category, NOT listing

Locked

Views: 1,170

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
27 May 2008, 11:01 AM
#1
thomasharding avatar

thomasharding

Zen Follower

Join Date:
Sep 2007
Location:
Manchester, England
Posts:
168
Plugin Contributions:
0

Link to first product in category, NOT listing

Hey Guys,

This might be a simple question which could have just gone right over my head, or it could be dead complex, I just dont know.

Is there a way in the ZC admin area to completely turn off the product listing, so you can just directly link to the first product in the category?

We have a really, really awkward layout developed for a client and they don't want products in a list, they just want it so each product is accessible using the Prev/Next buttons.

Stupid, I know. But hey.

I tried fudging it so the link goes straight to product x, but in the long run, they will have no idea whats happened if they remove that product, linking to an error page, which will really put us in the shizzle.

thanks in advance.

27 May 2008, 1:57 PM
#2
thomasharding avatar

thomasharding

Zen Follower

Join Date:
Sep 2007
Location:
Manchester, England
Posts:
168
Plugin Contributions:
0

Re: Link to first product in category, NOT listing

OK, with a bit of luck and SQL I've managed it!

Say the category you want to work with is '13'

  //Select the first product in the jeans category and get the ID.
  	$select = "select products_id from " . TABLE_PRODUCTS . " WHERE master_categories_id = '13' LIMIT 1";

	$result = mysql_query($select) or 
							   die ("Couldn't Execute Query");
	$prod_id =  mysql_fetch_assoc($result);	   

and then in the link, you simply have to write something like:

<a href="index.php?main_page=product_info&cPath=13&products_id=<?php echo $prod_id['products_id']; ?>">Product Link</a>