VirtueMart quick tip: show brand/manufacturer logo in product details

I recently had to provide a VirtueMart/Joomla solution for a customer. If you don’t know what VirtueMart is – it’s an open source ecommerce platform and it’s pretty good too.

They wanted a brand logo to be displayed in the product details, along with some other details. 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.

VirtueMart with Manufacturer icon

VirtueMart with Manufacturer icon

The following is tested and works for VirtueMart 1.1.3 and 1.1.4. I haven’t tried it with newer versions.

So, open /administrator/components/com_virtuemart/html/shop.product_details.php

at around line 517, 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";
  $mf_url = $db->f("mf_url");
  if (!empty($mf_desc))  $manufacturer_link = "$mf_desc";

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.

The method worked great and the product pages looked so much better, our client started building custom logos for some of the products that don’t have one using a logo creator.

Just one warning: this is an unsupported hack, so when you upgrade VM, you must reapply it.