News:

Support the VirtueMart project and become a member

Main Menu

Add manufacturer image in manufacturere product selection

Started by Vincenzo77, May 12, 2018, 12:15:52 PM

Previous topic - Next topic

Vincenzo77

Good evening,
in the file "category / default.php" I entered the following code, but I can not make the producer's image look. You can help me?


<?php if ($this->categoryId !== '0') {

  
$model VmModel::getModel('Manufacturer');
  
$manufacturers $model->getManufacturers(truetrue,true);
  foreach (
$manufacturers as $manufacturer) {
    if (
$manufacturer->mf_name == $this->category->category_name ) {
echo '<h1>' $manufacturer->mf_desc '</h1>';
// echo '<h1>' .$manufacturer->virtuemart_media_id. '</h1>';
    
}
  }

?>



Thank

Virtuemart 3.2.14
Joomla 3.8.7
PHP 5.6.36

Studio 42

Your code is strange, you want display all manufacturers in shop ?
But to add images, based from your code

<?php 
$model 
VmModel::getModel('Manufacturer');
 
$manufacturers $model->getManufacturers(truetrue,true);
// add the images to manufacturers 
 
$model->addImages($manufacturers ,1);// 1 to only add 1 image per manufacturer
  
foreach ($manufacturers as $manufacturer) {
    if (
$manufacturer->mf_name == $this->category->category_name ) {
echo '<h1>' $manufacturer->mf_desc '</h1>';
// echo '<h1>' .$manufacturer->virtuemart_media_id. '</h1>';
    
}
  }
?>