I’m using Joomla! 3.10.6 and Virtuemart 3.8.9 with PHP 7.4.27.
In product details page I linked the manufacturer logo to the manufacturer products page, but the link Itemid is wrong.
Here is the code I implemented:
<?php
if (VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) {
JRequest::setVar('virtuemart_manufacturer_id',$this->product->virtuemart_manufacturer_id,'GET');
$model = VmModel::getModel('manufacturer');
if ($this->product->virtuemart_manufacturer_id !=0 ) {
$manufacturer = $model->getManufacturer();
$model->addImages($manufacturer, 1);
$manlink = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=0&virtuemart_manufacturer_id='.$manufacturer->virtuemart_manufacturer_id, FALSE);
if (substr($manufacturer->images[0]->file_url, -1) !='/') {
$this->manufacturerImage = $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image"', false);
?>
<a class="manufacturer" href = "<?php echo $manlink; ?>"><?php echo $this->manufacturerImage; ?></a>
<?php
}
}
}
?>
Like this the link Itemid is the same as the one in the product page. So it isn’t the manufacturer menu Itemid.
Could you help me to create a code to auto assign the correct Itemid for the manufacturer menu? Thank you!