[Solved]Products module detail template {if}{/if} question

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
jasnick
Power Poster
Power Poster
Posts: 695
Joined: Sat Jan 15, 2011 8:36 am

[Solved]Products module detail template {if}{/if} question

Post by jasnick »

Using 1.11.7 and up to date modules

In detail template:

Code: Select all

<div id="imagebox">
 <ul class="img">
 <li><div>
<a href="{$entry->file_location}/{$entry->fields.photo1->value}" ><img src="{$entry->file_location}/{$entry->fields.photo1->thumbnail}"></a></div></li>
... through to 
<li><div>
<a href="{$entry->file_location}/{$entry->fields.photo10->value}"><img src="{$entry->file_location}/{$entry->fields.photo10->thumbnail}"></a></div></li>
</ul>
</div>
If a product has only 8 images, how do I make sure only 8 are shown and not the 2 empty boxes as well? I used {if}{/if} on another site to show only available contentblocks but not sure how to implement that here.

Would appreciate some advice.

Thanks

I've experimented with :

Code: Select all

{if $entry->fields.photo10->value}<li><div>
<a href="{$entry->file_location}/{$entry->fields.photo10->value}"><img src="{$entry->file_location}/{$entry->fields.photo10->thumbnail}"></a></div></li>{/if}
and this seems to work. Is it correct syntax?

Thanks
Last edited by jasnick on Tue Aug 20, 2013 7:27 am, edited 1 time in total.
uniqu3

Re: Products module detail template {if}{/if} question

Post by uniqu3 »

Your experiment seems ok. ;)
jasnick
Power Poster
Power Poster
Posts: 695
Joined: Sat Jan 15, 2011 8:36 am

Re: Products module detail template {if}{/if} question

Post by jasnick »

Thanks! Its the first bit of $Smarty I have done on my own! ;D
Post Reply

Return to “Modules/Add-Ons”