VirtueMart supports Manufacturer details but by default it just shows the manufacturer’s name in brackets, with a javascript pop-up window, that looks pretty ugly.
Fortunately we can add the logo by using the description field of the Manufacturers details and by hacking one file.
The following is tested and works for VirtueMart 1.1.3 and 1.1.4
So, open /administrator/components/com_virtuemart/html/shop.product_details.php
at around line 259, it looks like this:
if( $manufacturer_id && !empty($manufacturer_name) ) {
$link = “$mosConfig_live_site/index2.php?page=shop.manufacturer_page&manufacturer_id=$manufacturer_id&output=lite&option=com_virtuemart&Itemid=”.$Itemid;
$text = $manufacturer_name;
$manufacturer_link .= vmPopupLink( $link, $text );// Avoid JavaScript on PDF Output
if( @$_REQUEST[‘output’] == “pdf” )
$manufacturer_link = “<a href=\”$link\” target=\”_blank\” title=\”$text\”>$text</a>”;
}
replace it with:
if( $manufacturer_id && !empty($manufacturer_name) ) {
$manufacturer_link = $manufacturer_name;
$q = “SELECT `manufacturer_id`,`mf_name`,`mf_email`,`mf_desc`,`mf_url` FROM `#__{vm}_manufacturer` WHERE “;
$q .= “`manufacturer_id`=$manufacturer_id”;
$db->query($q);
if($db->next_record())
{
$mf_name=$db->f(“mf_name”);
$mf_email=$db->f(“mf_email”);
$mf_desc=$db->f(“mf_desc”);
$mf_url = $db->f(“mf_url”);
}
if (!empty($mf_desc)) $manufacturer_link = “$mf_desc”;
}
Product page showing the brand (manufacturer) logo
In the example above I’m using just the description (to show the logo) but you can use it to show other fields, just replace $mf_desc
with $mf_name
, $mf_email
, $mf_url
or a combination.
Just one warning: this is an unsupported hack, so when you upgrade VM, you must reapply it.
Original publication by Armand Niculescu: http://www.richnetapps.com/virtuemart-show-manufacturer-logo-in-product-details/