Hello, friens!
Anyone tried to display publisher on category page?
I put the code:
<dd itemtype="http://schema.org/Organization" itemscope itemprop="publisher">
<span class="icon-briefcase"></span> <strong><?php echo JText::_('COM_ABOOK_EDITOR');?>: </strong><span itemprop="name"><?php echo $item->editor_name;?></span>
</dd>
but it doesn't work. Any ideas?
Hi anunja,
editor_name is not included in the $item array.
The code you added in components/com_abook/views/category/tmpl/default_items.php is correct but you have to modify also the queries in components/com_abook/models/category.php (see function getListQuery).
Hello! Thnx!
I tried to, but have got no success. I put this code into components/com_abook/models/category.php:
// Select required fields from the categories.
$query->select($this->getState('list.select', 'a.*'));
$query->from('`#__abbook` AS a');
$query->where('a.access IN ('.$groups.')');
$query->select('loc.name AS location');
$query->leftjoin('#__ablocations AS loc ON loc.id=a.idlocation');
$query->select('e.name AS editor_name');
$query->leftjoin('#__abeditor AS e ON e.id=a.ideditor ');
and in components/com_abook/views/category/tmpl/default_items.php:
<?php if ($this->book->editor_name!='' && $this->params->get('show_editor', 1)){ ?>
<dd itemtype="http://schema.org/Organization" itemscope itemprop="publisher">
<span class="icon-briefcase"></span> <strong><?php echo JText::_('COM_ABOOK_EDITOR');?>: </strong><span itemprop="name"><?php echo $this->book->editor_name;?></span>
</dd>
<?php } ?>
But nothing happens(
$this->book->editor_name is wong, the right code is $item->editor_name
Try to modify you code.