<div class="cat-manufacture">
<?php
$app = \Joomla\CMS\Factory::getApplication();
$db = \Joomla\CMS\Factory::getDbo();
$lang = JSFactory::getLang();
$category_id = $app->input->get('category_id' , false , 'INT') ;
$Query = $db->getQuery(true);
$select = [
$db->quoteName( 'cat_map.product_id'),
$db->quoteName( 'p.product_manufacturer_id'),
$db->quoteName( 'm.manufacturer_id'),
$db->quoteName( 'm.manufacturer_logo'),
'm.' . $db->quoteName( $lang->get('name') ),
] ;
$Query->select($select);
$Query->from($db->quoteName( '#__jshopping_products_to_categories' , 'cat_map' ));
$Query->leftJoin( $db->quoteName( '#__jshopping_products' , 'p' ). ' ON ' . $db->quoteName( 'cat_map.product_id').'='. $db->quoteName( 'p.product_id') );
$Query->leftJoin( $db->quoteName( '#__jshopping_manufacturers' , 'm' ). ' ON ' . $db->quoteName( 'p.product_manufacturer_id').'='. $db->quoteName( 'm.manufacturer_id') );
$whereArr = [
$db->quoteName('category_id'). '='. $category_id ,
];
$Query->where($whereArr);
$Query->group( $db->quoteName( 'm.manufacturer_id') ) ;
$db->setQuery($Query);
$res = $db->loadObjectList();
foreach ( $res as $i => $row ) {
$href = SEFLink('index.php?option=com_jshopping&controller=manufacturer&task=view&manufacturer_id=' . $row->product_manufacturer_id ); ?>
<div class="cat-manufacture-item">
<a href="/<?= $href ?>">
<img src="/components/com_jshopping/files/img_manufs/<?= $row->manufacturer_logo?>" alt="<?= $row->{ $lang->get('name') } ?> фото">
</a>
<p><?= $row->{ $lang->get('name') } ?></p>
</div>
<?php } ?>
</div>