I need to show manufacturer logo in the product details.
How can I do?
Thanks.
Please, there's no chance of getting the manufacturer's logo?
Thanks
Same problem, any solutions?
Thanks
I'm trying to achieve this too.
Display a small logo instead manufacter name.
Anyone ?
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.
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
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?
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
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...
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 (http://forum.virtuemart.net/index.php?topic=95818.msg333248#msg333248)
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... :-(
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.
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...
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.
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...
I think you don't understand what I mean...
Using the line I posted means that users just have to name the image the same way the manufacturer is named in the backend and upload the image there. NOTHING ELSE. They don't have to change anything afterwards.
thanks
I will continue investigating.
Menace's solution if it worked
thanks
Thanks Ruben V.C.
Quote from: Ruben V.C. 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...
I'm a little refined.
Replacing spaces with "_".
Quote
<?php
$img_format = ".jpg";
$mfname = $this->product->mf_name;
$pattern = "/\s/";
$replacement = "_";
$way = preg_replace($pattern, $replacement, $mfname);
$way = strtolower($way).$img_format;
?>
<img src="/images/stories/virtuemart/manufacturer/<?php echo $way ?>"
Hi guys!
How can i do this?
Picture is in Greek,bold text means manufacturer
I have joomla 2.5.16
virtuemart 2.0.20b
Where is the file who needs edit to showing this?
[attachment cleanup by admin]
nobody?
$db = JFactory::getDBO();
$mid = $this->product->virtuemart_manufacturer_id[0];
$query = "SELECT * FROM xhzt8_virtuemart_manufacturer_medias WHERE virtuemart_manufacturer_id = $mid ;";
$db->setQuery($query);
$mediaid = $db->loadObject();
$vmedia = $mediaid->virtuemart_media_id;
$query2 = "SELECT file_title FROM xhzt8_virtuemart_medias WHERE virtuemart_media_id = $vmedia ;";
$db->setQuery($query2);
$filetitle = $db->loadObject();
$vfiletitle = $filetitle->file_title;
$alt= $this->product->mf_name;
$src = "images/stories/virtuemart/manufacturer/".$vfiletitle;
$text = "<img style='width:50%;' src=\"$src\" alt=\"$alt\" />";
What an crazy old post. And the solution is completly different and a lot easier. There is a layout default_manufacturer.php in the productdetailsview.
You see there
foreach($this->product->virtuemart_manufacturer_id as $manufacturer_id) {
$manufacturers_details = $manModel->getManufacturer($manufacturer_id);
$manufacturers_details is your Manufacturer object. You should always avoid in Virtuemart to write your own mysql. You will most time end up in devils kitchen. Just add to your product the images and use the displayThumb function
foreach($this->product->virtuemart_manufacturer_id as $manufacturer_id) {
$manufacturers_details = $manModel->getManufacturer($manufacturer_id);
$manModel->addImages($manufacturers_details);
echo $$manufacturers_details->images[0]->displayMediaThumb();
But interesting, looking again at the code I noticed it is not good to have the loading of the manufacturer in the layout so I moved that to the view.html.php.
so next versions use
foreach($this->product->manufacturers as $manufacturers_details) {
Just a performance thing. It is BC and the also speeds up the old construction due the cache.
Hi
I am using Milbo-s new code:
foreach($this->product->manufacturers as $manufacturers_details) {
but how now I can show manufacturer logo in the product details?
This is the best solution: 8)
In the components\com_virtuemart\views\productdetails\view.php.html on line 170.
Replace this:
foreach($this->product->virtuemart_manufacturer_id as $manufacturer_id) {
$mans[] = $manModel->getManufacturer( $manufacturer_id );
}
For:
foreach($this->product->virtuemart_manufacturer_id as $manufacturer_id) {
$mans[] = $manModel->getManufacturer( $manufacturer_id );
$manufacturers_details = $manModel->getManufacturer($manufacturer_id);
$manModel->addImages($manufacturers_details);
//echo $manufacturers_details->images[0]->displayMediaThumb();
}
In the components\com_virtuemart\views\productdetails\tmpl\default_manufacturer.php on line 32.
Replace:
$mans[] = '<a class="manuModal" rel="{handler: \'iframe\', size: {x: 700, y: 850}}" href="'.$link .'">'.$name.'</a>';
For:
$miniatura = $manufacturers_details->file_url_thumb;
$mans[] = '<a class="manuModal" rel="{handler: \'iframe\', size: {x: 700, y: 850}}" href="'.$link .'"><img src="'.$miniatura.'"></a>';
I use the Joomla 3.4 and Virtue Mart 3.
Hi Lucascatani, your solution not working for me... surely I'm missing something because instead of the name of the product (or the logo) I have the image for image not found...
First in components\com_virtuemart\views\productdetails\view.php.html (I imagine the file is view.html.php ) on line 170 I have this code and not the you you say:
foreach($this->product->virtuemart_manufacturer_id as $manufacturer_id) {
$manufacturer = $manModel->getManufacturer( $manufacturer_id );
$manModel->addImages($manufacturer, 1);
$mans[]=$manufacturer;
}
and I replaced all with the code you wrote.
Second, in the file /templates/vivid/html/com_virtuemart/productdetails/default.php I have this code for the social buttons:
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<div class="addthis_native_toolbox"> </div>
and with this code I don't see not even the name or the icon of missing image, any suggestion?
Thank you
Giuseppe
P.S. I use VM 3.0.12 and J 3.4.5 and the site is www.mulligan.it
I was forgetting... obviously I modified also components/com_virtuemart/views/productdetails/tmpl/default_manufacturer.php
I solved the problem of the social buttons inserting them later in the page.
Hope to hear you soon, bye.
Giuseppe
I almost solved with the solution in this post: http://forum.virtuemart.net/index.php?topic=95818.0
Hi Geppux,
you only need to do small changes in the default_manufacturer.php file
1) get the image
$image = $manufacturers_details->images[0];
2) replace the name with the image thumb in the link
$mans[] = '<a class="manuModal" rel="{handler: \'iframe\', size: {x: 700, y: 850}}" href="'.$link .'">'.$image->displayMediaThumb("",false).'</a>';
The final code in the default_manufacturer.php should be like this
<div class="manufacturer">
<?php
$i = 1;
$mans = array();
// Gebe die Hersteller aus
foreach($this->product->manufacturers as $manufacturers_details) {
//Link to products
$link = JRoute::_('index.php?option=com_virtuemart&view=manufacturer&virtuemart_manufacturer_id=' . $manufacturers_details->virtuemart_manufacturer_id. '&tmpl=component', FALSE);
$name = $manufacturers_details->mf_name;
$image = $manufacturers_details->images[0];
// Avoid JavaScript on PDF Output
if (!$this->writeJs) {
$mans[] = JHtml::_('link', $link, $name);
} else {
$mans[] = '<a class="manuModal" rel="{handler: \'iframe\', size: {x: 700, y: 850}}" href="'.$link .'">'.$image->displayMediaThumb("",false).'</a>';
}
}
echo implode(', ',$mans);
?>
</div>
Thank you Spyros it works perfectly... but do you have an idea why, if I move the logo from his position after the short description to above the image, the price disappears ???
And do you have a suggestion how to insert the producer logo in the box where are swown the products with the virtuemart products module (the one where you can show latest products or defined categories of products)?
Thank you, bye.
Giuseppe