News:

Support the VirtueMart project and become a member

Main Menu

Show all manufacturers on category view

Started by webmanwebdesign, February 14, 2024, 08:36:56 AM

Previous topic - Next topic

webmanwebdesign

Hi there,

is there an option to get all manufacturer names of a product in the category view?
For now I am using $product->mf_name, but this only gives me the first manufacturer selected. The second one is not shown at all.

Kind regards
Tanja

Jumbo!

You can print all the manufacturer names assigned to a product using the following codes.

<?php

$manufacturerModel 
VmModel::getModel('manufacturer');

if (
is_array($product->virtuemart_manufacturer_id) && count($product->virtuemart_manufacturer_id) > 1) {
  foreach (
$product->virtuemart_manufacturer_id as $manufacturerId) {
    
$manufacturer $manufacturerModel->getManufacturer($manufacturerId);

    echo 
$manufacturer->mf_name;
  }
} elseif (!empty(
$product->mf_name)) {
  echo 
$product->mf_name;
}

webmanwebdesign