Results 1 to 3 of 3

Thread: [solved] Catalog list only display a certain taxonomy item?

  1. #1
    User
    Join Date
    08-04-09.
    Posts
    230

    Default [solved] Catalog list only display a certain taxonomy item?

    Example.

    I have a taxonomy item called Sector.
    It contains 3 items:
    -Sector
    - Marine
    - Dredging
    - Offshore

    It is possible with the catalog list module to only display for instance "offshore"?
    I have been looking an fiddling around, but can't seem to find a solution.

    Thanks!

  2. #2
    Experienced user
    Join Date
    08-21-09.
    Posts
    563

    Default Re: Catalog list only display a certain taxonomy item?

    Yes, I believe you can. It's been a while, but I think I've done this before. The secret is the "condition" field when you create the catalog list module.

    There are 3 important things to this:
    1. The "column name" you assigned to the catalog field when you created it -- let's assume you called it "sectors".
    2. How you configured it -- can you choose only one "sector", or can you check multiple "sectors"?
    3. The numeric ID of the taxonomy item you want to list by. You can find this just by hovering over the item's edit icon and noting what the URL says. Let's pretend this numeric ID is "12".

    When you assign "sectors" to a catalog item and save it, it's stored in the database field as either:
    1. The numeric ID if you can only choose one (i.e. "12").
    2. A comma separated list of numeric IDs if you can choose multiple (i.e. "5,12,17,23").

    The "condition" field is just like writing a "WHERE" clause in MySQL. I'm not expert on MySQL queries either, but it doesn't take much to get the hang of it.

    So if you can only choose one sector, it's pretty easy. Your "condition" field would contain something like:
    "sectors=12".

    If you can choose multiple sectors, it's a little more tricky, but not much -- you need to use FIND_IN_SET:
    i.e. "FIND_IN_SET(12, sectors)".

    So this should work (barring some stupid typo or oversight). But of course the annoying thing is having to create a different catalog list module for every sector. No biggie if you have 3 and they aren't going to change much, but if you have a lot or frequently change the list, it's not the best solution.

    One easy fix for this is to install the "inputvar" extension. This lets you put insert tags in the back-end for GET and POST variables.

    Let's say you want to link to a page with a catalog list of only one sector. Your link would look something like...
    "my-listing-page.html?sectors=12". The "sectors=12" part is just a GET parameter (forgive me if you know all this already).

    Then your "condition" field could be changed to the following:
    "sectors={{get::sectors}}" OR "FIND_IN_SET({{get::sectors}}, sectors)"

    Now, you can reuse the same catalog list module for ALL of your sectors.

    Hope this helps.
    Brian

  3. #3
    User
    Join Date
    08-04-09.
    Posts
    230

    Default Re: Catalog list only display a certain taxonomy item?

    Brian!

    How many times have I told you you are fantastic? Thank you so much.
    Quit a simple solution. You saved me a lot of work.

    Simple entry in the condition field did the trick. (sector=25)
    Thank you (again) for investing some time to look at and answer my post!

Bookmarks

Posting Permissions

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