X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   One product in category, skip thumbnail page (https://forum.x-cart.com/showthread.php?t=2351)

hzellers 04-18-2003 04:51 AM

One product in category, skip thumbnail page
Hey all! I have a category that just has one product in it. It seems redundant to click on the category link, then, it lists the one product so I have to click it again. Is there any way to have it skip right to the product details page if the category just has one product?



funkydunk 04-18-2003 11:38 PM

How about in subcategories.tpl:

{if $cat eq categorynumberwithoneproduct}
<a href="product.php?productid=yourprodnumb">
<a href="home.php?cat={ $subcategories[cat_num].categoryid }">


hzellers 04-19-2003 04:19 AM

Too cool! I'm going to look like a genius and I have you to thank. Heck, everyone here does!


rgbdna 08-11-2004 09:56 PM

I would like to do this too...

Not working for me..I have this at the head of the subcategories.tpl

{if $cat=251}
<a href="product.php?productid=16134&cat=251&page=1">

<a href="home.php?cat={ $subcategories[cat_num].categoryid }">

My category # is 251 and product # is 16134.

Any thoughts?



B00MER 08-13-2004 08:15 AM

Edit customer/products.php find:


if (count($products) ==0) $products="";

Add the following after it:


if(count($products)==1) {

Tested with 3.5.10 (may work with 4.0.x)

rgbdna 08-13-2004 11:39 AM

Sweeet! It works great!

I am going to donate to you via Paypal right now!



xcell67 10-30-2004 08:00 PM

sadly, this nice mod conflicts with the html catalog.


If you created a category called "Exclusive" and only put one item in it, say "Space Cowboy Knife". When the user clicks on the category, "exclusive", this mod takes them to "Space Cowboy Knife" if the user is in *php mode.

If the user is browsing the html catalog, clicking on the exclusive category will just lead them to a blank page.

Can someone else confirm this or am I a dumbass?

adpboss 10-30-2004 08:12 PM

Maybe you could have the products.php code issue a unique value if productcount = 1.

Then use that unique value in the tpl to trigger a redirect.

Just a suggestion. It may help if you category page is generated with SOME code in it.

By the way, I can confirm that you are not a dumbass. ;)

xcell67 10-31-2004 10:33 AM

thanks for the suggestions adp. But I have no php knowledge at all. ;( What would be the code to redirect if the user is in the HTML catalog?


-Version 3.5.11

adpboss 10-31-2004 10:40 AM

Dunno. I'm not a PHP guy.

That was just a suggestion of how you could put the switch in the tpl. That way the catalog would generate a category page that redirected to the product page. Hiding all of the code in PHP is not giving the catalog a chance to generate the category page.

You gotta bug someone smart to help you implement this. It's outta my field.

All times are GMT -8. The time now is 09:28 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.