I want to show publisher on category page

Started by anunja, 20 July 2017, 11:37:44

Previous topic - Next topic
A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

anunja

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?

A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

federica

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).
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
Informatizzati [url="https://informatizzati.org"]https://informatizzati.org[/url]
Stacca la spina [url="https://disconnessi.org"]https://disconnessi.org[/url]

anunja

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(

federica

$this->book->editor_name is wong, the right code is $item->editor_name
Try to modify you code.
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
Informatizzati [url="https://informatizzati.org"]https://informatizzati.org[/url]
Stacca la spina [url="https://disconnessi.org"]https://disconnessi.org[/url]

A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9