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

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

at around line 517, it looks like this:

517
518
519
520
521
522
523
524
525
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:

517
518
519
520
521
522
523
524
525
526
527
528
529
530
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";
}

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.

28 replies
  1. Osiris
    Osiris says:

    Hello Armand:
    Thanks for the tutorial!
    I did all your parameters, but is not working for me. Could you help me with that?

    Thanks!

    Osiris

    • Armand Niculescu
      Armand Niculescu says:

      Hmm, what happens?
      Does the manufacturer link appear at all? By default it looks like this:
      ( Manufacturer Name )
      and when you click on it, a window pops up.

      If you don’t see a link at all — are you using the default template or something custom?

    • Armand Niculescu
      Armand Niculescu says:

      OK, that explains it. Fortunately I tested the change on Mynxx so I know it works.

      Edit the file /components/com_virtuemart/themes/vm_mynxx/theme.config.php and locate the line that says showManufacturerLink=0, change it to showManufacturerLink=1. Save it and it should work now.

      Additionally, if you want to change where the link is placed in the product description, edit /components/com_virtuemart/themes/vm_mynxx/templates/product_details/flypage.tpl.php. You will see some code like this:

      < ?php  if( $this->get_cfg('showManufacturerLink') ) 
      {
          echo "<div class="manufacturerbox">$manufacturer_link</div>";
      }?>
      

      You can move it for example above the product description or something.

      Good luck!

  2. Dimitri
    Dimitri says:

    Hello,

    BIG THANK for the help about the logo. Do someone knows how I can add the manufacturerlogos by the browsepage? For the examle:

    The buyer list the categori TV and see many Tv like Sony Smasung Philips etc. and I want to display under each product the small logo because it is difficulty ti read what is is for the each product, but with small logo its is ok.

    Please help me if You can.

    Best regards

  3. Keith
    Keith says:

    This is a great hack but i can’t get it to work in version 1.5.10 with Mynxx there is no line 517! Any help to get this to work in the newer version of VM would be great!

    • Armand Niculescu
      Armand Niculescu says:

      1.5.10 is Joomla version number, Virtuemart component is still at 1.1.4 and I tested with the Mynxx theme.

      Please make sure you are editing the right file (/administrator/components/com_virtuemart/html/shop.product_details.php)

      If you still can’t find the code, contact me privately.

  4. Alexandre From France
    Alexandre From France says:

    Hi there,

    First of all, I’d like to thank you for your work, it’s very instructive!

    I changed the code by following your advices and the correct files but it’s not working, nothing is showing up now. It used to show the manufacturer’s link but since the changes, nothing’s showing up.

    I worked on both shop.product_details.php and theme.config.php.
    In the backend, I also activated “show manufacturer link”.

    Any Idea ? you can have a look at this page : http://www.lacompagniedudestockage.fr/index.php?page=shop.product_details&product_id=30&flypage=flypage.tpl&pop=0&option=com_virtuemart&Itemid=278

    Thanks by advance Armand!

    Regards,

    Alexandre

    • Armand Niculescu
      Armand Niculescu says:

      If you get a blank page, it’s most likely a PHP error. You must either enable display of PHP errors or look in the PHP error log (I can’t help you with the exact steps you need to take to do that since it differs from post to post).

      After you manage to do that, please contact me privately.

  5. Leon
    Leon says:

    Hello, first of all thank you for the great hack, but I have one problem, after I did the modification only the image from the description shows up but it is not clickable and now does not open the good old and ugly pop up box with manufacturer details. I want it to work exactly as before but instead of (text) to show the manufacturer logo and when clicked to open the pop up box.

    • Armand Niculescu
      Armand Niculescu says:

      You put in the image and make it a link from the editor. Basically, whatever you put in the manufacturer description gets displayed in the product page. I used it to show just an image, you you can put a link on the image or even add text.

  6. Otto
    Otto says:

    Curious, line 460 is the last one in my shop.product_details.php
    VM = 1.1.4
    Joomla = 1.5.17
    Suggestions?

    It looks like a great hack….Just what I’m looking for!

  7. Vms
    Vms says:

    This solution is great, but I still need the manufacturer name on same other place on the flypage:

    E.G.:

    Product Name
    Brand: Manufacturer Name

    –> On the right: Your solution, the Logo showing.

    Basically I change this code:

    $text = ‘( ‘.$manufacturer_name.’ )';
    $manufacturer_link .= vmPopupLink( $link, $text );

    To following code, so that the Manufacturer is shown as text only without ():

    $text = ‘ ‘.$manufacturer_name.’ ‘;
    $manufacturer_link .= ($text );

    This is how it works currently. Now I want to implement your logo solution but do not want to remove the Manufacturer as Text below the product name. How to get it done? To display both on one flypage the same time.

  8. jacques from france
    jacques from france says:

    “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.”
    So please can you tell me how to make a conbination ?
    Thanks in advance and Thank you so much for your solution

  9. jlehonsec
    jlehonsec says:

    In fact, your pach works perfectky the only ” annoying thing is that the link to any URL is texte only and not “clikable”.
    ANy clue for that ?

    TIA

    Jacques

  10. Björn
    Björn says:

    Hi! I´v read about your hack and it´s a very good idea, but I´ve already used the manufacturer desc for something other. So for me it´s not suitable. But there´s another question. I´d like to link the manufacturer not to this popup but to the mf_url so that the website of the manufacturer opens when I click on the manufacturer. Is this possible with some small coding?

    // LINK TO MANUFACTURER POP-UP
    $manufacturer_id = $ps_product->get_manufacturer_id($product_id);
    $manufacturer_name = $ps_product->get_mf_name($product_id);
    $manufacturer_link = “”;
    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 = “$text“;
    }

Comments are closed.