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)
-   -   Redirect to Product Page when only One product in category (https://forum.x-cart.com/showthread.php?t=23339)

moneysaver67 07-31-2006 08:34 AM

Quote:

Originally Posted by darrenkierman
One small bug .... lets say you have one product and 5 subcategories, it will not show the subcategories because it automatically jumps to the one product. To fix it :

Code:

{if $products|@count eq 1}
{if $subcategories}{else}
  {assign var="prodURL" value="product.php?productid=`$products.0.productid`&cat=$cat&page=1"}
  {php}
      header( "Location: " . $GLOBALS[smarty]->_tpl_vars[prodURL] );
  {/php}
{/if}
{/if}



@darren, good find.

@carpeperdiem, good point.

I think the key here is to realize that different shops are obviously set up to operate and navigate in different manners. Per darren's piont, I can understand having a top-level category with three sub-cats, but wanting the users to see the subcats before being taken to the product page. In this case, I would modify the code so that drilling into the subcat itself would take you to the product page?

Either way, good posts on use of the code. I also enjoy the search result hook. :) Keep 'em coming!

ecommerce 08-05-2006 07:21 AM

"Rock on" ! LOL moneysaver, i hadnt heard that since wayne's world! LOLOLOLOL

good mod by the way.

and i do think that if the category has 1 procut and subcategories,

then it should present the subs adn the procuct. NOT go to the product directly. If you go to the product directly.

i understand carpes point, but he's using a 3 level flyout, so his mindset is a little different. Others are just using the default xcart menu.

Acquamarina 09-19-2006 06:47 AM

Re: Redirect to Product Page when only One product in category
 
Carperdiem,

I just visited the Mommymakeup.com site and it looks great! I a, wondering if you used a mod for Debbie's favorites and would you mind sharing which one? I would like to do that on my site. Thanks!

Vera

carpeperdiem 09-19-2006 07:33 AM

Re: Redirect to Product Page when only One product in category
 
Quote:

Originally Posted by Acquamarina
Carperdiem,

I just visited the Mommymakeup.com site and it looks great! I a, wondering if you used a mod for Debbie's favorites and would you mind sharing which one? I would like to do that on my site. Thanks!

Vera


Here ya go...

http://forum.x-cart.com/showthread.php?t=24671

Acquamarina 09-19-2006 09:15 AM

Re: Redirect to Product Page when only One product in category
 
Thanks!

Vera

Jon 09-19-2006 01:34 PM

Re: Redirect to Product Page when only One product in category
 
Just a note, if your using CDSEO then:

Replace:

Code:

{assign var="prodURL" value="product.php?productid=`$products.0.productid`&cat=$cat&page=1"}

with:

Code:

{assign var="prodURL" value="`$http_location`/`$cdseo_prod`/`$products.0.cdseo_url`"}

ryan c. 12-01-2006 04:18 PM

Re: Redirect to Product Page when only One product in category
 
works great!

gastu 12-01-2006 07:42 PM

Re: Redirect to Product Page when only One product in category
 
and when have only one product in manufacter?

jeanne 12-18-2006 09:47 AM

Re: Redirect to Product Page when only One product in category
 
Does anyone have it working with the SAFETYNET DSEFU MOD?

Jeanne
Gold 4.0.17

alreadyregistered 10-10-2007 06:21 AM

Re: Redirect to Product Page when only One product in category
 
I could kiss you on the lips for this mod. Just what I needed. Merci beaucoup.

:D/

Tyme


All times are GMT -8. The time now is 04:53 AM.

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