Author Topic: Show manufacturer logo in the product details  (Read 13328 times)

mrmagoo

  • Beginner
  • *
  • Posts: 14
Show manufacturer logo in the product details
« on: March 20, 2012, 17:37:15 pm »
I need to show manufacturer logo in the product details.

How can I do?

Thanks.

mrmagoo

  • Beginner
  • *
  • Posts: 14
Re: Show manufacturer logo in the product details
« Reply #1 on: March 26, 2012, 23:10:19 pm »
Please, there's no chance of getting the manufacturer's logo?

Thanks

neviomaria

  • Beginner
  • *
  • Posts: 4
Re: Show manufacturer logo in the product details
« Reply #2 on: March 28, 2012, 14:26:55 pm »
Same problem, any solutions?

Thanks

plastique

  • Beginner
  • *
  • Posts: 28
Re: Show manufacturer logo in the product details
« Reply #3 on: May 23, 2012, 19:08:46 pm »
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.

  • Beginner
  • *
  • Posts: 6
Re: Show manufacturer logo in the product details
« Reply #4 on: August 14, 2012, 00:26:16 am »
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:
Code: [Select]
$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

  • Beginner
  • *
  • Posts: 20
Re: Show manufacturer logo in the product details
« Reply #5 on: August 17, 2012, 17:28:10 pm »
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.

  • Beginner
  • *
  • Posts: 6
Re: Show manufacturer logo in the product details
« Reply #6 on: August 17, 2012, 19:13:45 pm »
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

  • Beginner
  • *
  • Posts: 20
Re: Show manufacturer logo in the product details
« Reply #7 on: August 17, 2012, 19:40:24 pm »
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.

  • Beginner
  • *
  • Posts: 6
Re: Show manufacturer logo in the product details
« Reply #8 on: August 17, 2012, 20:13:46 pm »
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

  • Jr. Member
  • **
  • Posts: 53
Re: Show manufacturer logo in the product details
« Reply #9 on: August 17, 2012, 20:24:38 pm »
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.

Code: [Select]
<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.

  • Beginner
  • *
  • Posts: 6
Re: Show manufacturer logo in the product details
« Reply #10 on: August 17, 2012, 20:35:29 pm »
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

  • Jr. Member
  • **
  • Posts: 53
Re: Show manufacturer logo in the product details
« Reply #11 on: August 17, 2012, 20:43:35 pm »
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.

  • Beginner
  • *
  • Posts: 6
Re: Show manufacturer logo in the product details
« Reply #12 on: August 17, 2012, 20:52:58 pm »
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

  • Jr. Member
  • **
  • Posts: 53
Re: Show manufacturer logo in the product details
« Reply #13 on: August 17, 2012, 20:59:34 pm »
How does this access the db more then directly calling the manufacturer image? To make it more "userfriendly" you can also use

Code: [Select]
<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.

  • Beginner
  • *
  • Posts: 6
Re: Show manufacturer logo in the product details
« Reply #14 on: August 17, 2012, 21:11:01 pm »
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...