Listit2 - Can detail template display sibling items?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
JM6891
Forum Members
Forum Members
Posts: 150
Joined: Thu Mar 18, 2010 2:35 pm

Listit2 - Can detail template display sibling items?

Post by JM6891 »

Hi there,

I'm using the Listit2 module and was wondering if there was a way to display 3 x random sibling items?

When I say sibling items, I have various categories which my items are in. At the bottom of the detail page I'd like to display 3 random items from within the same category as the current detail page item. Does this make sense and is this possible?

Thanks in advance
zaidcrowe
Forum Members
Forum Members
Posts: 109
Joined: Wed Jun 10, 2009 3:43 pm

Re: Listit2 - Can detail template display sibling items?

Post by zaidcrowe »

I think it would - I don't have the cms in front of me atm - but the detail template should be able to tell you which cateogry that item is in.

You then call a summary template using Listit2 as normal specifiying this category, this template should utilize something like this: http://www.i-do-this.com/snippets/Show- ... -arrays/56

Which will randomise the items, then all you have to do is loop through the newly created array, with a limit of 3 for loop :)
JM6891
Forum Members
Forum Members
Posts: 150
Joined: Thu Mar 18, 2010 2:35 pm

Re: Listit2 - Can detail template display sibling items?

Post by JM6891 »

Hi, thank you very much for your reply.

I will have a play and see what I come up with. Thank you for your help!
zaidcrowe
Forum Members
Forum Members
Posts: 109
Joined: Wed Jun 10, 2009 3:43 pm

Re: Listit2 - Can detail template display sibling items?

Post by zaidcrowe »

Pleasure :)
Stikki

Re: Listit2 - Can detail template display sibling items?

Post by Stikki »

Howdy,

If you navigated into item from category URL, then variable: $category is assigned by default. This applies to all frontend actions.

This means you can call something like this inside your detail template:

{ListIt2Instance category=$category->category_alias pagelimit=3 orderby='rand'}

This way everything is DB driven and you wont cause extra load time with Smarty.

If you didn't navigate into item using category links, then current category object ain't available and you have to use {ListIt2Loader} to load category data into variable and then use that data.

This works with ListItExtended 1.4.1 +
zaidcrowe
Forum Members
Forum Members
Posts: 109
Joined: Wed Jun 10, 2009 3:43 pm

Re: Listit2 - Can detail template display sibling items?

Post by zaidcrowe »

Way more elegant, I've never done this with listit before so didn't realise it was baked in!
Post Reply

Return to “Modules/Add-Ons”