News:

Looking for documentation? Take a look on our wiki

Main Menu

Show manufacturer logo in the product details

Started by mrmagoo, March 20, 2012, 17:37:15 PM

Previous topic - Next topic

mrmagoo

I need to show manufacturer logo in the product details.

How can I do?

Thanks.

mrmagoo

Please, there's no chance of getting the manufacturer's logo?

Thanks

neviomaria


plastique

I'm trying to achieve this too.

Display a small logo instead manufacter name.

Anyone ?
Joomla 2.5.4
Virtuemart 2.0.6

Ruben V.C.

Hi,

I don't know if its correct to do that, but it works form me...

I change de value for $text in components/com_virtuemart/views/productdetails/tmpl/default_manufacturer.php

by:
$db = JFactory::getDBO();
$mid = $this->product->virtuemart_manufacturer_id;
$query = "SELECT virtuemart_media_id FROM XXX_virtuemart_manufacturer_medias WHERE virtuemart_manufacturer_id = $mid ;";
$db->setQuery($query);
$column= $db->loadResultArray();
$mediaid = $column[0];
$query = "SELECT file_url_thumb FROM XXX_virtuemart_medias WHERE virtuemart_media_id = $mediaid ;";
$db->setQuery($query);
$column= $db->loadResultArray();
$alt= $this->product->mf_name;
$src = "/".$column[0]; 
$text = "<img src=\"$src\" alt=\"$alt\"  />";


NOTE: Change "XXX_" with your joomla dbprefix.

Hope it helps.

cherokee

hello.
Sorry for my English.
I can not display the manufacturer's logo on the product page.
the prefix is correct.
this is my default_manufacturer
defined('_JEXEC') or die('Restricted access');
?>
<div class="manufacturer">
    <?php
    $link = JRoute::_('index.php?option=com_virtuemart&view=manufacturer&virtuemart_manufacturer_id=' . $this->product->virtuemart_manufacturer_id . '&tmpl=component');
    $db = JFactory::getDBO();
$mid = $this->product->virtuemart_manufacturer_id;
$query = "SELECT virtuemart_media_id FROM zb94f_virtuemart_manufacturer_medias WHERE virtuemart_manufacturer_id = $mid ;";
$db->setQuery($query);
$column= $db->loadResultArray();
$mediaid = $column[0];
$query = "SELECT file_url_thumb FROM zb94f_virtuemart_medias WHERE virtuemart_media_id = $mediaid ;";
$db->setQuery($query);
$column= $db->loadResultArray();
$alt= $this->product->mf_name;
$src = "/".$column[0]; 
$text = "<img src=\"$src\" alt=\"$alt\"  />";

    /* Avoid JavaScript on PDF Output */
    if (strtolower(JRequest::getWord('output')) == "pdf") {
   echo JHTML::_('link', $link, $text);
    } else {
   ?>
        <span class="bold"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DETAILS_MANUFACTURER_LBL') ?></span><a class="modal" rel="{handler: 'iframe', size: {x: 700, y: 550}}" href="<?php echo $link ?>"><?php echo $text ?></a>
    <?PHP } ?>
</div>

and here on the product page:

<?php
      // Manufacturer of the Product
      if (VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) {
          echo $this->loadTemplate('manufacturer');
      }
      ?>


Any ideas?
thanks

Ruben V.C.

Hi Cherokee,

Just like this it works for me. I'm using Virtuemart 2.0.8 and Joomla 2.5.

Any error? You can activate debug messages in Virtuemart->Configuration->Shop

Did you check "Show manufacturers" in Virtuemart->Configuration->Templates?

cherokee

Thanks for responding, Ruben.
I have enabled the display of the manufacturer (see the link normally)
It gives me an error
VM 2.0.6
a greeting
Gracias por responder, Rubén.
Tengo activada la visualización del fabricante, de hecho aparece el enlace a sus datos, pero en texto.
No me aparece ningún error.
La versión de VM es la 2.0.6
Un saludo

Ruben V.C.

Maybe you can change the query and do a couple of prints in the code like this:


$this->product->virtuemart_manufacturer_id . '&tmpl=component');
$db = JFactory::getDBO();
$mid = $this->product->virtuemart_manufacturer_id;
$query = "SELECT * FROM zb94f_virtuemart_manufacturer_medias WHERE virtuemart_manufacturer_id = $mid ;";
$db->setQuery($query);
$column= $db->loadResultArray();
echo "INI FirstQ: <br/>";
print_r($column);
echo "FI FirstQ: <br/>";

$mediaid = $column[0];
$query = "SELECT * FROM zb94f_virtuemart_medias WHERE virtuemart_media_id = $mediaid ;";
$db->setQuery($query);
$column= $db->loadResultArray();
echo "INI SecondQ: <br/>";
print_r($column);
echo "FI SecondQ: <br/>";

$alt= $this->product->mf_name;
$src = "/".$column[0];
$text = "<img src=\"$src\" alt=\"$alt\"  />";


And let's see what it says...

Menace

If you don't wonna do major hacks on this, you can use something like this. At least this is what I do and it works pretty well for me.

<img src="folder/<?php echo $this->product->virtuemart_manufacturer_id ?>.jpg ">


Just give the logos the manufacturers id as name. I took this from here: http://forum.virtuemart.net/index.php?topic=95818.msg333248#msg333248

Ruben V.C.

Menace,

Don't know wich version of VM you're using, but in 2.0.8 the images are saved with the "original" file name, i.e. something like "logo_kawasaky.jpg" or whatever. And the only place where I've found the file name is in the table virtuemart_medias...

I wish your solution works for me, but it dont... :-(

Menace

Ruben:
I use VM 2.0.8e
You had to upload the image once you created the manufacturer. So the name of the image is your choice. You can rename the image on your ftp or even upload another image. Just make sure the images name is exactly the id of the corresponding manufacturer.

Ruben V.C.

Menace, first of all thaks for the respononse,

If it was a site that I will manage for shure I would use your solution... One reason is that I don't like so much (in my solution) to access db this way for every product view...

But the site will be managed by "non-expert" (I mean user-level) people, so I want to make the job for they as easyer as I can.

The other thing I was thinking about is modifiing something that forces the manufacturer image to be named with manufacturer_id... Cold be more polite...

Menace

How does this access the db more then directly calling the manufacturer image? To make it more "userfriendly" you can also use

<img src="/images/stories/virtuemart/manufacturer/<?php echo $this->product->mf_name ?>.jpg ">

So users would just have to name the image exactly like the manufacturer in the backend.

In your case this would work for an image called "kawasaki.jpg" instead of "logo_kawasaki.jpg"
Not really hard to understand and do for users even.

And it can be just uploaded in the backend without making changes in any other place.


Ruben V.C.

In my case "userfriendly" means user don't need to rename the image... just have to upload it.

I repeat that mine is not the best solution, but if I have time I will do what I said before: when you save a manufacturer image, force it to be renamed with manufacturers id name... Still have to think on how to solve de extension (.jpg or .png or whatever) stuff...