Page 1 of 1

LISE Category not showing associated Items

Posted: Wed Oct 23, 2019 1:57 pm
by blackrain
I am trying to get the LISE module to show a list of Categories and the nested items associated. ie.

Category 1
Item 1
Item 3

Category 2
Item 2
Item 3

As you can see Items can belong to multiple Categories.

I have looked at a couple of posts that JoMorg has commented on but when I try the code suggested I can't seem to render the Item details but, I can see that the iterations are working as the print_r is returning data and if I add a character it will returns it the same amount of times as the items associated with each category.

I am wondering if the problem is that each item belongs to multiple categories. But again I have tested this theory and it still doesn't work as expected.

I have included the code below

Code: Select all

{foreach from=$categories item=category}
{if isset($category->category_id) && $category->items|count > 0}
<h4>{$category->name}</h4>
{foreach from=$category->items item=item}
{LISELoader item='item' identifier='item_id' force_array=1 instance='LISEproducts' value={$item.value} assign='product'}
{$product->title}
{/foreach}
{/if}
{/foreach}

Re: LISE Category not showing associated Items

Posted: Thu Oct 24, 2019 7:14 pm
by velden
{$item.value} doesn't need the {} but that probably isn't the reason.
I think it should be $item->value btw.

Further: force_array=1 but you should not reference an array item with -> but with either a dot or square brackets.

{$product['title']} or {$product.title}

Not sure what you have printed with print_r but I'd have tried {$item|print_r} and {$product|print_r} for troubleshooting.

Disclaimer: I didn't test any of the above so I'm not 100% sure about the array thing in this context.

Re: LISE Category not showing associated Items

Posted: Thu Oct 24, 2019 9:40 pm
by blackrain
@velden, Thanks for the reply.

I have made the changes but still the items do not display. I tried using the

Code: Select all

{$product->title|print_r}
on the product variable and it looks like the iteration is working even though no item details are displayed only 1s where the iterator has caught an item in the category.

So that leaves the mystery as to why the item details are not displaying even though they are clearly being counted.

i also tried $item->value but this broke it.

I am at a loss on this one

cheers

Re: LISE Category not showing associated Items

Posted: Thu Oct 31, 2019 7:01 pm
by velden
Any chance you should just use value=$item ?

$item->value probably breaks the thing because $item is not an object but just an integer value.