Keyword

[SOLVED] Add extra fields in category_item.php

More
13 years 9 months ago #91378 by Anddy
Hi, I'd like to view extra fileds in category_item.php view, so I copied from item.php the part of code of extra fields and pasted it in category_item.php. When I run that page it says "Invalid argument supplied for foreach". The part of code I copied is this one:<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>      <!-- Item extra fields -->        <div class="itemExtraFields">          <h3><?php echo JText::_('Additional Info'); ?></h3>          <ul>            <?php foreach ($this->item->extra_fields as $key=>$extraField):?>            <li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">                <span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>                <span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>                <br class="clr" />                        </li>            <?php endforeach; ?>            </ul>        <div class="clr"></div>      </div>      <?php endif; ?>Why I get that error? What am I doing wrong?Thanks in advance.

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago #91379 by william white
Replied by william white on topic [SOLVED] Add extra fields in category_item.php
Try going to the category in question or the one it inherits from, and go to Item View Options in Category Listings and set extra fields to "show"
that will show all the extra fields in the category view without coding

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago #91380 by Anddy
Thanks William! In the huge number of options I didn't find it!!

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum