Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default link to category with only one product

    I am trying to link into my shop from another area of the site. I can easily link to a category that has multiple products using a link such as:

    <a href="../shop/index.php?main_page=product_info&cPath=9">CATEGORY</a></li>

    How do I link to a category that only has one product? If I use the link above, or similar, I get a page saying the product was not found.

    I know that I could link directly to the product that is in this category and it would have the same result but the problem with that is that if I or anyone else put another product in the category I have to change all the links to it which is not very elegant.

    thnx

    Nick

  2. #2
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: link to category with only one product

    As the forum hasn't responded with its usual speed I wonder if I just didn't explain myself clearly? Wouldn't be the first time.

    What I am trying to do is create a navigation in the rest of the site that mirrors the navigation in the shop (with a few extra bits). In the shop I have a category list in the left sidebar. So, in the rest of the site outside the zen cart install I have a vertical list of the categories which link into the store.

    In the shop, if I click on a category, say CATEGORY A, that only has one product it diverts me straight to the product page for that product and bypasses the category page.

    And that kind of causes a problem in the links from elsewhere in the site. Because if I click on a link to the category page I end up on a page that says that the product cannot be found rather than being diverted to the product page.

    It would be good if I could find a way in which a link to CATEGORY A in the shop and links to CATEGORY A from outside the shop worked in the same way.

    The problem doesn't arise if there is more than one product in the category so evidently a solution is to always have more than one product per category. Not brilliant though.

    The shape of the links I have used are shown in the previous email.

    Any help gratefully accepted even if it is 'I don't know' or 'you can't do that'.

    Thnks
    Nick

  3. #3
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: link to category with only one product

    Usually, when there are 2 or more Products in a Category and you click on it, you get the Product Listing ...

    When there is 1 Product, you get taken to the product _info when you have the Skip Product Listing for Categories with 1 Product turned on ...

    This setting is in the Configuration ... Layout Settings ...
    Skip 1-prod Categories
    Skip single-product categories
    If this option is set to True, then if the customer clicks on a link to a category which only contains a single item, then Zen Cart will take them directly to that product-page, rather than present them with another link to click in order to see the product.
    Default: True
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  4. #4
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: link to category with only one product

    Thanks Ajeh,

    This is exactly what is happening inside the shop. And it works great and I like the fact that you are taken straight to product_info.

    When I link to the category page from outside the shop this doesn't happen.

    Take for example the address:

    http://www.domain.com/shop/index.php...=index&cPath=1

    This is the address of a category (ProductListing) If it has many products I can type that address into my browser and I get the page I expect, which is the ProductListing page.

    If the category only has one product and I type the address into a browser I do not arrive at the page I expect. I would like to arrive at the product_info of the single product.

    Instead I arrive at a page saying that the product has not been found.

    So, what I am saying is that I want the best of both worlds :-) I want to use 'Skip Product Listing for Categories with 1 Product' but I also want the external link to arrive at the same page.

    Is this possible?

    Not so good solutions would be to turn 'Skip Product Listing for Categories with 1 Product' off or to ensure that every category has more than one product.

  5. #5
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: link to category with only one product

    thanks everyone.

    gjh. yes. i feel a bit dim now. all the other links in the list are category pages this one seems to have slipped through.

    thanks for spotting it.


  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: link to category with only one product

    <a href="../shop/index.php?main_page=product_info&cPath=9">CATEGORY</a></li>

    This is requesting a product info page, not a category (product listing) page. A product info page url needs to add &product_id=69 after what you show. To show the listing page, try

    <a href="../shop/index.php?main_page=index&cPath=9">CATEGORY</a></li>
    Last edited by gjh42; 11 May 2009 at 03:17 PM.

 

 

Similar Threads

  1. Replies: 0
    Last Post: 1 Jul 2009, 05:02 PM
  2. One Product with Quantity Discounts on Only One Attribute
    By blesko in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 19 Jun 2008, 02:52 AM
  3. Show Product listing with only one in the category
    By xuhuamao in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 31 Mar 2007, 12:49 AM
  4. Only one product type in list; only in one category. Why?
    By whitefael in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 7 Jan 2007, 06:13 PM
  5. A store with only one category?
    By WesternStandard in forum General Questions
    Replies: 4
    Last Post: 30 Oct 2006, 11:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg