VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: YCWAY on April 11, 2015, 06:33:50 AM

Title: How to display manufacturer name and link on category page with VM3
Post by: YCWAY on April 11, 2015, 06:33:50 AM
Hello,

VM previous version, this code is work


<?php echo $product->mf_name ?>

<?php echo $product->virtuemart_manufacturer_id ?>


But for VM3, manufacturers can be multiple choice, so when a product is a multi-manufacturer, when the above code does not work

How to display manufacturer name and link on category page with VM3 ?

Thanks~

Joomla 3.4.1
VirtueMart 3.0.6.4
Title: Re: How to display manufacturer name and link on category page with VM3
Post by: Studio 42 on April 11, 2015, 15:43:55 PM
Adapt it from productdetails view :
if (VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) {
$manModel = VmModel::getModel('manufacturer');
$mans = array();
// Gebe die Hersteller aus
foreach($this->product->virtuemart_manufacturer_id as $manufacturer_id) {

$mans[] = $manModel->getManufacturer( $manufacturer_id );
}
$this->product->manufacturers = $mans;
Title: Re: How to display manufacturer name and link on category page with VM3
Post by: YCWAY on April 13, 2015, 09:45:03 AM
Hi, Studio 42
Thank you for your reply;
I tried using the code you provided, but an error occurred
Or that I have not clearly described, I hope each product category pages are displayed its manufacturer and links.
So I need to modify the templates/my_template/html/com_virtuemart/sublayouts/products.php file to display the manufacturer of each product.
How should I change?
THX
Title: Re: How to display manufacturer name and link on category page with VM3
Post by: Studio 42 on April 13, 2015, 13:10:29 PM
change
$this->product
to
$product