ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Link entry from landing page to product page

October 14, 2010 2:44pm

Subscribe [3]
  • #1 / Oct 14, 2010 2:44pm

    Chris Arnold

    201 posts

    I can’t seem to search for the right thing on this topic, because nothing’s coming up for what I think must be a common question.

    I have a products weblog that goes 3 levels deep (much like the great Custom Category article here), but my first /shop/ page shows all categories AND a single, random product to entice visitors.

    I’m not sure how to link this without it knowing what category it belongs to. So basically I want a product living at

    /products/

    to link to its product page at

    /products/category/url-title/

    But it’s not already being nested in it’s category segment, though. How can I make this happen?

    Edited for clarity, hopefully.

  • #2 / Oct 14, 2010 5:16pm

    Rob Allen

    3105 posts

    It looks like you might need to format the product link something like this

    <a href="http://{url_title_path=products/category}">{title}</a>
  • #3 / Oct 14, 2010 5:56pm

    Chris Arnold

    201 posts

    Well, I don’t know what the category is going to be, though. The product that pops up randomly on the main /products/ page could be from 1 of 5 different categories, so I need the link to “know” this. Meaning the link could end up being:

    /products/widgets/smart-widget/

    or

    /products/hats/red-hat/

    or even

    /products/cups/comfy-mug/

    It will just depend on the category the product is a part of. Category as you have it doesn’t know what that product’s category is.

  • #4 / Oct 14, 2010 6:08pm

    Rob Sanchez

    335 posts

    Assuming you use one category per product.

    <a href="http://{url_title_path=products/{categories}{category_url_title}{/categories}}">{title}</a>
  • #5 / Oct 14, 2010 6:43pm

    Chris Arnold

    201 posts

    That didn’t quite work, but I finally got this to work. Makes sense to me now.

    <a href="http://{categories}{category_url_title}{/categories}/{url_title}/">{title}</a>

    Earlier in the day I had the following, which doesn’t work. Obviously using the pairing tags within the href and immediately closing it did the trick above.

    {categories}
    <a href="http://{category_url_title}/{url_title}/">{title}</a>
    {/categories}
  • #6 / Oct 14, 2010 11:28pm

    Sue Crocker

    26054 posts

    Glad you found a work around. Don’t hesitate to post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases