News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Show manufacturer logo in the product details

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

Previous topic - Next topic

Menace

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

thanks
I will continue investigating.
Menace's solution if it worked
thanks

dze

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



grid

#18
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]


web4mission

$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

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

axxo

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

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.


Geppux

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

Geppux

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


Spiros Petrakis

#27
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>
Joomla templates and extensions development
https://www.yourgeek.gr

Geppux

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