Author Topic: Add manufacturer image in manufacturere product selection  (Read 255 times)

Vincenzo77

  • Beginner
  • *
  • Posts: 4
  • A beginner
  • Skype Name: vincenzo.perna29
  • VirtueMart Version: 3.2.14
Add manufacturer image in manufacturere product selection
« on: May 12, 2018, 12:15:52 pm »
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?

Code: [Select]
<?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

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3241
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 &amp; 3.0.x.y
Re: Add manufacturer image in manufacturere product selection
« Reply #1 on: May 12, 2018, 19:21:36 pm »
Your code is strange, you want display all manufacturers in shop ?
But to add images, based from your code
Code: [Select]
<?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>';
    
}
  }
?>