Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 3 of 3

Thread: If only one product in category, go to Product page instead of Category page??

  1. #1
    steven is offline Junior Member
    Join Date
    Jan 2011
    Posts
    14

    Default If only one product in category, go to Product page instead of Category page??

    On my vertical side menu, when clicking on the Parent category, if there is only one product in that category, I'd like to go directly to the product page instead of to the category page.

    (Obviously, there is no need to view a category page if there is only one product. It would be much smarter to go directly to the product page.)

    Any suggestions?

  2. #2
    webopius is offline Senior Member
    Join Date
    Nov 2008
    Location
    London, UK
    Posts
    440

    Default

    Hi

    If you use (or are using) an XMLPackage to generate your left menu, then it would be relatively straightforward to enhance the XML to return a count of the number of published products per category along with each menu category.

    If the count is 1, then you'd probably need an XSLTExtension that took the category ID as a parameter and returned a link to the first/only product within that category.

    I'm sure your next question would be "OK, so what does the code look like". Well, I've not written this specific change for anyone before so have nothing to paste here as an example I'm afraid!

  3. #3
    mmcgeachy is offline Senior Member
    Join Date
    Sep 2008
    Posts
    174

    Default

    This is just a suggestion but how about instead of making the navigation go to a product page just make category function as the product page would? It just a matter of making the xmlpackage show product information. This is currently what we do when we have only one product for a category and it has worked well for us. About the only risk I can think of is a small chance of being flagged as duplicate content SEO wise due the product page still being there. I haven't seen that be case though.