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

Menace

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

cherokee

  • Beginner
  • *
  • Posts: 20
Re: Show manufacturer logo in the product details
« Reply #16 on: August 17, 2012, 21:49:39 pm »
thanks
I will continue investigating.
Menace's solution if it worked
thanks

dze

  • Beginner
  • *
  • Posts: 1
Re: Show manufacturer logo in the product details
« Reply #17 on: November 12, 2012, 16:31:54 pm »
Thanks 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...





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 ?>"



grid

  • Beginner
  • *
  • Posts: 6
Re: Show manufacturer logo in the product details
« Reply #18 on: November 16, 2013, 14:17:32 pm »
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]

grid

  • Beginner
  • *
  • Posts: 6
Re: Show manufacturer logo in the product details
« Reply #19 on: December 30, 2013, 14:55:13 pm »
nobody?

web4mission

  • Beginner
  • *
  • Posts: 1
    • web4mission
  • Skype Name: web4mission
  • VirtueMart Version: 3.x
Re: Show manufacturer logo in the product details
« Reply #20 on: February 03, 2015, 00:03:23 am »
$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\"  />";

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10018
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Show manufacturer logo in the product details
« Reply #21 on: February 03, 2015, 18:46:08 pm »
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 
Code: [Select]
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

Code: [Select]
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
Code: [Select]
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.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

axxo

  • Beginner
  • *
  • Posts: 1
Re: Show manufacturer logo in the product details
« Reply #22 on: February 08, 2015, 10:16:29 am »
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?

lucascatani

  • Beginner
  • *
  • Posts: 6
  • A beginner
  • Skype Name: lucas_catani
Re: Show manufacturer logo in the product details
« Reply #23 on: August 27, 2015, 15:49:14 pm »
This is the best solution: 8)

In the components\com_virtuemart\views\productdetails\view.php.html on line 170.

Replace this:
Code: [Select]
foreach($this->product->virtuemart_manufacturer_id as $manufacturer_id) {

$mans[] = $manModel->getManufacturer( $manufacturer_id );
}
For:
Code: [Select]
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:
Code: [Select]
$mans[] = '<a class="manuModal" rel="{handler: \'iframe\', size: {x: 700, y: 850}}" href="'.$link .'">'.$name.'</a>';
For:
Code: [Select]
$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.


Geppux

  • Jr. Member
  • **
  • Posts: 173
Re: Show manufacturer logo in the product details
« Reply #24 on: December 07, 2015, 18:38:45 pm »
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:
Code: [Select]
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:
Code: [Select]
<!-- 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

Geppux

  • Jr. Member
  • **
  • Posts: 173
Re: Show manufacturer logo in the product details
« Reply #25 on: December 07, 2015, 19:11:13 pm »
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

Geppux

  • Jr. Member
  • **
  • Posts: 173
Re: Show manufacturer logo in the product details
« Reply #26 on: December 10, 2015, 11:17:35 am »
I almost solved with the solution in this post: http://forum.virtuemart.net/index.php?topic=95818.0

Spyros Petrakis

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 102
    • OlympianThemes
  • VirtueMart Version: Always latest Stable
Re: Show manufacturer logo in the product details
« Reply #27 on: December 12, 2015, 19:30:26 pm »
Hi Geppux,

you only need to do small changes in the default_manufacturer.php file

1) get the image
Code: [Select]
$image = $manufacturers_details->images[0];
2) replace the name with the image thumb in the link
Code: [Select]
$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
Code: [Select]
<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>
Fast and simple to use templates with fanatical support
https://www.olympianthemes.com

Geppux

  • Jr. Member
  • **
  • Posts: 173
Re: Show manufacturer logo in the product details
« Reply #28 on: December 14, 2015, 19:25:04 pm »
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