1

I have a products section with 5 different product categories and all products are assigned to one category only. The current URLs are like this -->http://site.com/products/category/oral-care/. I would like to remove the "category" segment so the URLs are more like this http://site.com/products/oral-care/.

As weird as this sounds I have done this before on a different site. I used a combo of GWCode Categories and LowSeg2Cat to create my product links based on nested categories and successfully created URL's with this format http://site2.com/products/food/fruits/. In that URL food is a category and fruits is a subcategory. I can't figure out what I did to get this working and can't get it working on the new site. Is there a different method? Thanks for any info.

4

Yup, this is a snap with Low Seg2Cat. Example:

{if segment_2}
    {exp:channel:entries channel="channel" category="{segment_category_ids}"}
    ....
    {/exp:channel:entries}
{/if}

(If you're going to be using other filters, or pagination, in your products/index template, then you need to do more advanced checking in that conditional to determine whether you should add the category="" parameter - in which case I'd suggest using Switchee for that conditional.)

When it comes to creating links to those category URLs, you can't use the {path=""} variables, but instead you need to build the links manually:

{categories backspace="2"}<a href="/products/{category_url_title}">{category_name}</a>, {/categories}
| improve this answer | |
  • Thanks Derek! I was close, but your post got it working. – Mike Lohrman Jan 21 '13 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.