VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: tobisagt on January 04, 2012, 00:44:16 AM

Title: Show Manufacturers information on "productdetails page"
Post by: tobisagt on January 04, 2012, 00:44:16 AM
Hi there,

i've made some tabs to switch between "description, reviews and manufactures information". But how to display the last one?

And the second: Is it possible to show one or more products of the manufacture without click on "show all products of..." button in the lightbox?

Thanks
-Tobi
Title: Re: Show Manufacturers information on "productdetails page"
Post by: tobisagt on January 05, 2012, 00:27:34 AM
Does noone know if that is possible?  :-\
Title: Re: Show Manufacturers information on "productdetails page"
Post by: JtouchMobile.com on January 05, 2012, 04:07:01 AM
@tobsagt:

#1: Open /components/com_virtuemart/views/productdetails/tmpl/default.php

Find this code:
if(VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) { ?>

Move its view section to any place (in the file) you refer to

#2: Hack to the view of manufacture, you can find all at /views/manufacturer

But in top of the answers, I think you should take a time on understanding what M-V-C of Joomla do. Then it is very very easy for you to do any custom on VM ;)

Cheers,
Title: Re: Show Manufacturers information on "productdetails page"
Post by: tobisagt on January 05, 2012, 23:58:36 PM
Thanks for your post.

Quote from: MobileMeWs on January 05, 2012, 04:07:01 AM
I think you should take a time on understanding what M-V-C of Joomla do. Then it is very very easy for you to do any custom on VM ;)

Thats what i lovley want to do, but i dont have the time yet, to set my focus on that.

I found the code, but this is just to open manufacturers into a lightbox?!

What i want is not to open it. I want the manufacturers properties right in the product detail page.
Title: Re: Show Manufacturers information on "productdetails page"
Post by: tobisagt on January 09, 2012, 11:17:35 AM
ok.

What i get to work is:

Manufacturer Name:

$this->product->mf_name

Manufacturer Description:

$this->product->mf_desc

But Manufacturer Image wont work. Anyone can help?

it tried this:

$this->product->manufacturerImage
$this->manufacturerImage
Title: Re: Show Manufacturers information on "productdetails page"
Post by: JtouchMobile.com on January 10, 2012, 05:49:24 AM
<?php // Manufacturer Image
   if (!empty($this->manufacturerImage)) { ?>
      <div class="manufacturer-image">
      <?php echo $this->manufacturerImage; ?>
      </div>
   <?php } ?>

;)

P/S: A VM 2.0.0 tiny bug
if (!empty($manufacturerImage)) { ?>
Title: Re: Show Manufacturers information on "productdetails page"
Post by: tobisagt on January 10, 2012, 10:08:09 AM
Quote from: MobileMeWs on January 10, 2012, 05:49:24 AM
<?php // Manufacturer Image
   if (!empty($this->manufacturerImage)) { ?>
      <div class="manufacturer-image">
      <?php echo $this->manufacturerImage; ?>
      </div>
   <?php } ?>

;)

P/S: A VM 2.0.0 tiny bug
if (!empty($manufacturerImage)) { ?>

Thx for bugfix! It works now in the lightbox. But still cant get it to work right in the product details.  :-\

Everything was easy:

In manufacturer it looks like:
<?php echo $this->manufacturer->mf_desc ?>

and in the product details:
<?php echo $this->product->mf_desc ?>

But manufacturerImage is different!
It looks:
<?php echo $this->manufacturerImage; ?>

I need the code to show the image right in the product details, not the lightbox. Any ideas?
Title: Re: Show Manufacturers information on "productdetails page"
Post by: tobisagt on January 13, 2012, 15:11:51 PM
is there no way to show to "manufacturer image" in the product details?  ???
Title: Re: Show Manufacturers information on "productdetails page"
Post by: tobisagt on January 19, 2012, 14:05:53 PM
Noone knows?  :(
Title: Re: Show Manufacturers information on "productdetails page"
Post by: PRO on January 19, 2012, 15:06:13 PM
on product page $this->    MEANS the product


on category page $this-> MEANS the current category

ON manufacturer page $this-> means current manufacturer


SO, if you notice on the category page, when calling specific product variables it uses
$product->product_name

then on product page $this->product_name


So, now you know what you can play around with to get the images
this will never work on the product page
<?php echo $this->manufacturerImage; ?>
Title: Re: Show Manufacturers information on "productdetails page"
Post by: tobisagt on January 19, 2012, 15:15:32 PM
thx for your reply!

So, pls tell me how it should looks like...

$manufacturer->manufacturerImage; and
$manufacturerImage;

also dont work.
Title: Re: Show Manufacturers information on "productdetails page"
Post by: PRO on January 19, 2012, 15:43:14 PM
Quote from: tobisagt on January 19, 2012, 15:15:32 PM
thx for your reply!

So, pls tell me how it should looks like...

$manufacturer->manufacturerImage; and
$manufacturerImage;

also dont work.

I dont know, because Im not gonna take the time to try it, BUT will point out how this works

(current object)      (what you are looking for)
       $this->          product->mf_desc


Title: Re: Show Manufacturers information on "productdetails page"
Post by: tobisagt on January 19, 2012, 15:48:37 PM
yes,

that how i get it to work for

description:
$this->product->mf_desc

name:
$this->product->mf_name

etc....


but this dont work for manufacturer image :(
Title: Re: Show Manufacturers information on "productdetails page"
Post by: PRO on January 19, 2012, 15:53:01 PM
have you tried

$this->product->manufacturer->manufacturerImage
Title: Re: Show Manufacturers information on "productdetails page"
Post by: tobisagt on January 19, 2012, 16:40:33 PM
Quote from: BanquetTables.pro on January 19, 2012, 15:53:01 PM
have you tried

$this->product->manufacturer->manufacturerImage

yes, dont work for me.
Title: Re: Show Manufacturers information on "productdetails page"
Post by: rottenberg on January 19, 2012, 21:16:38 PM
Hi

I'm looking for the same thing.

I have done a print_r($this->product)
For the manufactuer I've found :

but nothing about manufacturerImage


Could the SQL giving those manufacturer info be modified for adding the manufactuerImage Url ?
Title: Re: Show Manufacturers information on "productdetails page"
Post by: levardar on January 29, 2012, 13:55:10 PM
I am looking for this problem form 4 days and I couldn't manage how to do it.

$this->product->virtuemart_manufacturer_id

with this we get the Manufacturer ID  But next????
Title: Re: Show Manufacturers information on "productdetails page"
Post by: tobisagt on February 06, 2012, 23:59:05 PM
I dont have installed the new VM upgrades, because i wait for stable.

Does anyone know if this is fixed in 2.01x ?
Title: Re: Show Manufacturers information on "productdetails page"
Post by: mygbn on February 14, 2012, 00:28:37 AM
No this problem is not fix in the latest version of virtuemart 2 is there any one that can figure this out as showing the manufactures image on product page would be far much better than have just the manufactures name.
Title: Re: Show Manufacturers information on "productdetails page"
Post by: rottenberg on February 14, 2012, 14:37:47 PM
The manufacturer logo may be important.
An image as a greater effect than a text.
Title: Re: Show Manufacturers information on "productdetails page"
Post by: lipes on April 02, 2012, 20:12:41 PM
<?php if ($manufacturer->images && ($show == 'image' or $show == 'all' )) { ?>
<?php echo $manufacturer->images[0]->displayMediaThumb('',false);?>
.........................................
<?php // Manufacturer of the Product
if (VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) {
echo $this->loadTemplate('manufacturer'); } ?>
.........................................
$manufacturerImage = $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image"',false);
$this->assignRef('manufacturerImage', $manufacturerImage);
...
[virtuemart_manufacturer_id]  [mf_name]  [slug] [mf_email]  [mf_desc]  [virtuemart_manufacturercategories_id]  [mf_url]  [published]  [_pkey:protected]  [_pkeyForm:protected]  [_obkeys:protected]  [product_name]  [_unique:protected]  [_unique_name:protected]   [_orderingKey:protected]  [_slugAutoName:protected]  [_slugName:protected]  [_loggable:protected]  [_xParams:protected]  [_varsToPushParam:protected]  [min_order_level]  [max_order_level]   [_translatable]  [_translatableFields:protected]  [_tablePreFix]  [created_on]  [created_by]  [modified_on]  [modified_by]  [hits]  [virtuemart_product_price_id]  [virtuemart_product_id]  [virtuemart_shoppergroup_id]  [product_price]  [override]  [product_override_price]  [product_tax_id]  [product_discount_id]  [product_currency]  [product_price_vdate]  [product_price_edate]  [price_quantity_start]  [price_quantity_end]  [virtuemart_vendor_id]  [product_parent_id]  [product_sku]  [product_s_desc]  [product_desc]  [product_weight]  [product_weight_uom]  [product_length]  [product_width]  [product_height]  [product_lwh_uom]  [product_url]  [product_in_stock]  [product_ordered]  [low_stock_notification] [product_available_date]  [product_availability]  [product_special]  [product_sales]  [product_unit]  [product_packaging]  [product_params]  [intnotes]  [customtitle]  [metadesc]  [metakey]  [metarobot]  [metaauthor]  [layout]  [min_order_level]  [max_order_level]  [virtuemart_media_id]  [shoppergroups]  [categories]  [virtuemart_category_id]  [canonical]  [packaging]  [prices]  [costPrice]  [basePrice]  [basePriceVariant]  [basePriceWithTax]  [discountedPriceWithoutTax]  [priceBeforeTax]  [salesPrice]  [taxAmount]  [salesPriceWithDiscount]  [salesPriceTemp]  [discountAmount]  [priceWithoutTax]  [variantModification]  [DBTax]  [Tax]  [DATax]  [product_template]  [event]  [afterDisplayTitle]  [beforeDisplayContent]  [afterDisplayContent]  [images]   [media_attributes]  [setRole]  [_foldersToTest:VmMediaHandler:private]  [_actions:VmMediaHandler:private]   [_mLocation:VmMediaHandler:private]  [_hidden:VmMediaHandler:private]  [virtuemart_media_id]  [theme_url]  [virtuemart_vendor_id]  [file_title]  [file_description]  [file_meta]  [file_mimetype]   [file_type]  [file_url]  [file_url_thumb]    [file_is_forSale]  [file_is_product_image]   [shared]  [file_params]  [_translatable]  [_tablePreFix]  [created_on]  [file_url_folder]  [file_path_folder]  [file_name]  [file_extension]  [neighbours]  [previous]  [virtuemart_product_id] [next]
......................................................

So... we must start by:
<?php   // Manufacturer Image
echo $this->

?>

...............
Related in vm1:
http://forum.virtuemart.net/index.php?topic=45779.90 (Read 43687 times)
http://forum.virtuemart.net/index.php?topic=77894.0
http://www.richnetapps.com/virtuemart-show-manufacturer-logo-in-product-details/
http://www.kavdesign.net/blog/coding/virtuemart-how-to-show-manufacturer-logo-in-product-details/
.................
Quote from: slmandle on April 02, 2012, 20:29:10 PM
if you do print_r($this->product); you can call about your product you want to use "mf_name" echo $this->product->mf_name;
Title: Re: Show Manufacturers information on "productdetails page"
Post by: lipes on April 04, 2012, 16:40:10 PM
Found a solution... its not the better way to do this but i cant do in other way (i'm not a developer/codder/master programmer) :(

I've been searching and thinking for some days in this situation and my solution for this it's:
1 - calling the Image, from the Manufacturer folders that VM manufacturer Brand that you want;
2 - add that image in the description;  You will need to do that in every Brand Manufacturer (lots of work...)
3 - you can call that 'mf_desc' in your product template by typing this: <?php echo $this->product->mf_desc; ?>

If someone could help us in do this by better way..  :-\ without we need to add all images in all manufacturer descriptions we will be eternally grateful.
Title: Re: Show Manufacturers information on "productdetails page"
Post by: PRO on April 04, 2012, 19:52:57 PM
Quote from: lipes on April 04, 2012, 16:40:10 PM
Found a solution... its not the better way to do this but i cant do in other way (i'm not a developer/codder/master programmer) :(

I've been searching and thinking for some days in this situation and my solution for this it's:
1 - calling the Image, from the Manufacturer folders that VM manufacturer Brand that you want;
2 - add that image in the description;  You will need to do that in every Brand Manufacturer (lots of work...)
3 - you can call that 'mf_desc' in your product template by typing this: <?php echo $this->product->mf_desc; ?>

If someone could help us in do this by better way..  :-\ without we need to add all images in all manufacturer descriptions we will be eternally grateful.


You could always use the ID as the image name, and place them in a folder yourself.

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

OR:
Use a string custom field to display the image
http://forum.virtuemart.net/index.php?topic=99225.msg327877#msg327877

AND: YOU can EASILY set the "is a list" to make applying them easier.
Title: Re: Show Manufacturers information on "productdetails page"
Post by: lipes on April 04, 2012, 20:57:08 PM
Tks Banquet  ;D

i use this code
<img src="<?php echo $this->baseurl ?>/images/stories/virtuemart/manufacturer/<?php echo $this->product->mf_name ?>.jpg ">
because my logos have the name of the brand..

but maybe is why i now have this problem: In some Manufacturer brands in image i have only the name like "Varta".jpg and the Brand name is the same .. but for others i have the sonyericsson.jpg but the name is sony ericsson .. and the images misses because we calls the sony%20ericsson.jpg

so.... the solution will be to change all Brand Manufacturer names in VM Backend ... and all images in folder and remove the text name and put numbers ?
Title: Re: Show Manufacturers information on "productdetails page"
Post by: PRO on April 04, 2012, 21:01:03 PM
Quote from: lipes on April 04, 2012, 20:57:08 PM
Tks Banquet  ;D

i use this code
<img src="<?php echo $this->baseurl ?>/images/stories/virtuemart/manufacturer/<?php echo $this->product->mf_name ?>.jpg ">
because my logos have the name of the brand..

but maybe is why i now have this problem: In some Manufacturer brands in image i have only the name like "Varta".jpg and the Brand name is the same .. but for others i have the sonyericsson.jpg but the name is sony ericsson .. and the images misses because we calls the sony%20ericsson.jpg

so.... the solution will be to change all Brand Manufacturer names in VM Backend ... and all images in folder and remove the text name and put numbers ?

u do not need this

<?php echo $this->baseurl ?>

It will be a relative image url, and not an absolute.

Its however you want to do it
Title: Re: Show Manufacturers information on "productdetails page"
Post by: lipes on April 04, 2012, 21:14:13 PM
humm.. if i dont use <?php echo $this->baseurl ?>
the image displayed is broken/not found 'http://localhost/images/stories/virtuemart/manufacturer/Varta.jpg'

Title: Re: Show Manufacturers information on "productdetails page"
Post by: PRO on April 04, 2012, 21:19:00 PM
Quote from: lipes on April 04, 2012, 21:14:13 PM
humm.. if i dont use <?php echo $this->baseurl ?>
the image displayed is broken/not found 'http://localhost/images/stories/virtuemart/manufacturer/Varta.jpg'




IF you are local, you can remove the /   at the begging

src="images"
Title: Re: Show Manufacturers information on "productdetails page"
Post by: lipes on April 04, 2012, 21:50:59 PM
damm.. lol work if i remove that "/" like you said... and i've started to change some brand manufacturer names to numbers.... argh....  ::)
now i need to go back again..
Tks for all! :)
Title: Re: Show Manufacturers information on "productdetails page"
Post by: ironlion37 on April 18, 2012, 23:36:53 PM
Quote from: lipes on April 04, 2012, 16:40:10 PM
Found a solution... its not the better way to do this but i cant do in other way (i'm not a developer/codder/master programmer) :(

I've been searching and thinking for some days in this situation and my solution for this it's:
1 - calling the Image, from the Manufacturer folders that VM manufacturer Brand that you want;
2 - add that image in the description;  You will need to do that in every Brand Manufacturer (lots of work...)
3 - you can call that 'mf_desc' in your product template by typing this: <?php echo $this->product->mf_desc; ?>

If someone could help us in do this by better way..  :-\ without we need to add all images in all manufacturer descriptions we will be eternally grateful.

This would be good enough for me, but when I add <?php echo $this->product->mf_desc; ?> to flypage.tpl.php, it doesn't work in V 1.1.9. Any thoughts are much appreciated.
Title: Re: Show Manufacturers information on "productdetails page"
Post by: raheel on April 28, 2012, 10:53:00 AM
EUR is set as default currency in virtuemart 2. But when I import products using CSVI and set the currency to USD it still shows currency in EUR. I just want to change the currency fro EUR to USD for everything in my virtuemart 2 store.

How can i change the currency from eur to usd for all products in store.
thanks
Raheel
Title: Re: Show Manufacturers information on "productdetails page"
Post by: slammy on May 10, 2012, 14:25:17 PM
Quote from: lipes on April 04, 2012, 20:57:08 PM
Tks Banquet  ;D

i use this code
<img src="<?php echo $this->baseurl ?>/images/stories/virtuemart/manufacturer/<?php echo $this->product->mf_name ?>.jpg ">
because my logos have the name of the brand..

but maybe is why i now have this problem: In some Manufacturer brands in image i have only the name like "Varta".jpg and the Brand name is the same .. but for others i have the sonyericsson.jpg but the name is sony ericsson .. and the images misses because we calls the sony%20ericsson.jpg

so.... the solution will be to change all Brand Manufacturer names in VM Backend ... and all images in folder and remove the text name and put numbers ?

use str_replace
For Example: If you have a manufacturer name like sony ericsson with a blank inside and the picture is named sonyericsson.jpg do the following to replace a blank or any other character you want:

$my_needed_imagename=str_replace(' ','', $this->product->mf_name); // first is the character you are searching for, second is the replacement, third the subject_string)

then $my_needed_imagename is sonyericsson.jpg
regards slam
Title: Re: Show Manufacturers information on "productdetails page"
Post by: Doomas on October 09, 2012, 02:41:21 AM
Here is my solution to display the manufacturer image. In Virtuemart 2.0.12

Replace the following code (arround line 748) in the file /administrator/components/com_virtuemart/models/product.php


if (!empty($product->virtuemart_manufacturer_id)) {
$mfTable = $this->getTable ('manufacturers');
$mfTable->load ((int)$product->virtuemart_manufacturer_id);
$product = (object)array_merge ((array)$mfTable, (array)$product);
}


with


if (!empty($product->virtuemart_manufacturer_id)) {
$mfTable = $this->getTable ('manufacturers');
$mfTable->load ((int)$product->virtuemart_manufacturer_id);
$xrefTable = $this->getTable('manufacturer_medias');
$mfImages = $xrefTable->load($product->virtuemart_manufacturer_id);
if(!empty($mfImages)) {$mfTable->mf_image_id = $mfImages[0];
$mediaModel = VmModel::getModel('Media');
$product->mf_images = $mediaModel->createMediaByIds($mfImages[0],'','image');
}
$product = (object)array_merge ((array)$mfTable, (array)$product);
}


With this change you can use following variables in your template overrides:


$this->product->mf_images[0]->file_url //url to the manufacturere image
$this->product->mf_images[0]->file_url_thumb //url to the manufacturer image thumb


Title: Re: Show Manufacturers information on "productdetails page"
Post by: mikidg1984 on December 14, 2012, 17:04:25 PM
My solution....

Put this code

        JRequest::setVar('virtuemart_manufacturer_id',$product->virtuemart_manufacturer_id,'GET');
        $model = VmModel::getModel('manufacturer');
if ($product->virtuemart_manufacturer_id !=0 ) {

$manufacturer = $model->getManufacturer();
$model->addImages($manufacturer,1);

$product->manufacturerImage = $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image"',false);
                }


between line 147-146 in product view ----->file components/com_virtuemart/views/productdetails/view.html.php

This add the manufacturerImage  fields to the template product object  ($this->product) in the view productdetails.
So you can display the  $this->product->manufacturerImage var  in the

templates/your_template/html/com_virtuemart/productdetails/default.php
or in
templates/your_template/html/com_virtuemart/productdetails/default_manufacturer.php

I hope it will be useful....
Bye......
Title: Re: Show Manufacturers information on "productdetails page"
Post by: dorex on January 03, 2013, 20:05:18 PM
Hi,
I've tried your solutions, but it doesn't work out for me. I even tried out the last two instructions ( from users: Doomas and mikidg1984) and it didn't work ( The last two solutions don't seem to be permanent, but overwritten at the first upgrade.).

First I tried what I understood from the discussion of Banquet and Lipes, and I've inserted the following codes (one at a time) to the product details default.php (public_html/templates/MY_TEMPLATE/html/com_virtuemart/productdetails/default.php):

1. Didn't work:   <img src="/public_html/images/stories/virtuemart/manufacturer/<?php echo $this->product->mf_name ?>.jpg ">
2. Didn't work:   <?php echo <img src="/public_html/images/stories/virtuemart/manufacturer/<?php echo $this->product->mf_name ?>.jpg "> ?>

All the manufacturer images are in manufacturer folder ( /public_html/images/stories/virtuemart/manufacturer/ ), all images are named with the MANUFACTURER_NAME.jpg, and none of them has spaces/blanks inside their names ... images are named exactly as the Manufacturers.

Did I do something wrong, or is there anything else to be done/written in code, in order to display the manufacturer images? If anyone managed to make it work (as Lipes did), please provide an example with this code inserted.

Also, this post is very ambiguous. Can someone explain clearly what is to be done in order to show up a manufacturer image on the "Product Details" page?

Thank you.
Title: Re: Show Manufacturers information on "productdetails page"
Post by: PRO on January 03, 2013, 22:51:09 PM
Quote from: dorex on January 03, 2013, 20:05:18 PM
Hi,
I've tried your solutions, but it doesn't work out for me. I even tried out the last two instructions ( from users: Doomas and mikidg1984) and it didn't work ( The last two solutions don't seem to be permanent, but overwritten at the first upgrade.).

First I tried what I understood from the discussion of Banquet and Lipes, and I've inserted the following codes (one at a time) to the product details default.php (public_html/templates/MY_TEMPLATE/html/com_virtuemart/productdetails/default.php):

1. Didn't work:   <img src="/public_html/images/stories/virtuemart/manufacturer/<?php echo $this->product->virtuemart_manufacturer_id ?>.jpg ">
2. Didn't work:   <?php echo <img src="/public_html/images/stories/virtuemart/manufacturer/<?php echo $this->product->virtuemart_manufacturer_id ?>.jpg "> ?>

All the manufacturer images are in manufacturer folder ( /public_html/images/stories/virtuemart/manufacturer/ ), all images are named with the MANUFACTURER_NAME.jpg, and none of them has spaces/blanks inside their names ... images are named exactly as the Manufacturers.

Did I do something wrong, or is there anything else to be done/written in code, in order to display the manufacturer images? If anyone managed to make it work (as Lipes did), please provide an example with this code inserted.

Also, this post is very ambiguous. Can someone explain clearly what is to be done in order to show up a manufacturer image on the "Product Details" page?

Thank you.

this code will not work, the syntax is wrong (dont have time to re-write it)
2. Didn't work:   <?php echo <img src="/public_html/images/stories/virtuemart/manufacturer/<?php echo $this->product->virtuemart_manufacturer_id ?>.jpg "> ?>


THIS CODE USES THE manufacturer ID , NOT the name

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

look here
http://forum.virtuemart.net/index.php?topic=95818.msg333248#msg333248


Title: Re: Show Manufacturers information on "productdetails page"
Post by: dorex on January 03, 2013, 23:17:45 PM
Sorry, It's late and I'm tired. I pasted the wrong code in my previous reply, now it's corrected. I edited my previous reply while you were responding.
Thank you for pointing this topic, but unfortunately I have read this post (http://forum.virtuemart.net/index.php?topic=95818.msg333248#msg333248) 5 times now ... copied and pasted code ... but nothing works.

Here it is what I tried out and didn't worked:

First tried solution:

I named all the manufacturer images like this: ManufacturerName.jpg (except one of them, all my manufacturer names are one word only, so there's no blanks/spaces or other characters in the image file names).
I went to:     /public_html/templates/MY_TEMPLATE/html/com_virtuemart/productdetails/default.php
and I inserted the following code:
Code: [Select]

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

right above these lines:
      <?php
      if ($this->showRating) {
          $maxrating = VmConfig::get('vm_maximum_rating_scale', 5);

          if (empty($this->rating)) {
         ?>


Second tried solution:

I've created a folder ( /images/stories/virtuemart/custom_folder/ ) where I uploaded all the manufacturer images, each one named with the manufacturer ID (1.jpg, 2.jpg, 3.jpg, 4.jpg, etc.).
I went to:     /public_html/templates/MY_TEMPLATE/html/com_virtuemart/productdetails/default.php
and I inserted the following code:
Code: [Select]

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

right above these lines:
      <?php
      if ($this->showRating) {
          $maxrating = VmConfig::get('vm_maximum_rating_scale', 5);

          if (empty($this->rating)) {
         ?>

The result in both cases is a blank page, with no errors on it. Thank you for your help.
Title: Re: Show Manufacturers information on "productdetails page"
Post by: PRO on January 03, 2013, 23:38:15 PM
its the wrong syntax
to echo "text' it has to be  in   'quotes single'

Try this
<img src="/images/stories/virtuemart/custom_folder/<?php echo $this->product->virtuemart_manufacturer_id ?>.jpg" >
Title: Re: Show Manufacturers information on "productdetails page"
Post by: dorex on January 04, 2013, 00:22:10 AM
Quote from: PRO on January 03, 2013, 23:38:15 PM
its the wrong syntax
to echo "text' it has to be  in   'quotes single'

Try this
<img src="/images/stories/virtuemart/custom_folder/<?php echo $this->product->virtuemart_manufacturer_id ?>.jpg" >

Thank you, Banquet! This worked like a charm.

I will also try this solution for displaying the Manufacturer image in the CATEGORY View.  Hope it will work there, too.

Thanks again.
Title: Re: Show Manufacturers information on "productdetails page"
Post by: JamesSVk on February 03, 2013, 18:30:59 PM
I got solution, try this directly on your view site (/productdetails/tmpl/default.php or in template /html/com_virtuemart/productdetails/default.php):

<?
   JRequest::setVar('virtuemart_manufacturer_id',$this->product->virtuemart_manufacturer_id,'GET');
        $model = VmModel::getModel('manufacturer');
        if ($this->product->virtuemart_manufacturer_id !=0 ) {
$manufacturer = $model->getManufacturer();
$model->addImages($manufacturer,1);
$this->manufacturerImage = $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image"',false);
                }
              echo $this->manufacturerImage;
  ?>
Title: Re: Show Manufacturers information on "productdetails page"
Post by: AbsoluteVM on February 12, 2013, 17:03:50 PM
Quote from: JamesSVk on February 03, 2013, 18:30:59 PM
I got solution, try this directly on your view site (/productdetails/tmpl/default.php or in template /html/com_virtuemart/productdetails/default.php):

<?
   JRequest::setVar('virtuemart_manufacturer_id',$this->product->virtuemart_manufacturer_id,'GET');
        $model = VmModel::getModel('manufacturer');
        if ($this->product->virtuemart_manufacturer_id !=0 ) {
$manufacturer = $model->getManufacturer();
$model->addImages($manufacturer,1);
$this->manufacturerImage = $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image"',false);
                }
              echo $this->manufacturerImage;
  ?>


+1 this works to show the manufacturer image on the product detail page.

Title: Re: Show Manufacturers information on "productdetails page"
Post by: bdimov on April 06, 2013, 10:12:31 AM
So any test some code for manufacturer image and work? Because I read this topic and test some codes but still not working for me...
Title: Re: Show Manufacturers information on "productdetails page"
Post by: guardiano78 on May 09, 2013, 16:07:00 PM
hi,

this is for the name:
<?php echo $product->mf_name?>
this for description:
<?php echo $product->mf_desc?>

They work!!!
But for the image?????
Title: Re: Show Manufacturers information on "productdetails page"
Post by: Snake 60 on August 18, 2013, 09:59:26 AM
Quote from: mikidg1984 on December 14, 2012, 17:04:25 PM
My solution....

Put this code

        JRequest::setVar('virtuemart_manufacturer_id',$product->virtuemart_manufacturer_id,'GET');
        $model = VmModel::getModel('manufacturer');
if ($product->virtuemart_manufacturer_id !=0 ) {

$manufacturer = $model->getManufacturer();
$model->addImages($manufacturer,1);

$product->manufacturerImage = $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image"',false);
                }


between line 147-146 in product view ----->file components/com_virtuemart/views/productdetails/view.html.php

This add the manufacturerImage  fields to the template product object  ($this->product) in the view productdetails.
So you can display the  $this->product->manufacturerImage var  in the

templates/your_template/html/com_virtuemart/productdetails/default.php
or in
templates/your_template/html/com_virtuemart/productdetails/default_manufacturer.php

I hope it will be useful....
Bye......
Like say mikidg1984 and other guys, his code work in product details page, but in version 2.0.22a you need insert it not in between line 147-146 but before 152 string
$product_model->addImages($product);
$this->assignRef('product', $product);

This code will dislay the manufacturer image
echo $this->product->manufacturerImage;
+woot to mikidg1984  ;)
Title: Re: Show Manufacturers information on "productdetails page"
Post by: yosandra on August 18, 2013, 19:28:36 PM
Quote from: JtouchMobile.com on January 05, 2012, 04:07:01 AM
@tobsagt:

#1: Open /components/com_virtuemart/views/productdetails/tmpl/default.php

Find this code:
if(VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) { ?>

Move its view section to any place (in the file) you refer to

#2: Hack to the view of manufacture, you can find all at /views/manufacturer

But in top of the answers, I think you should take a time on understanding what M-V-C of Joomla do. Then it is very very easy for you to do any custom on VM ;)

Cheers,

I have this code to display the manufacturer products, but it gets me to the same category (of the manufacturer). I wonder if is possible to display in this code all manufacturer products no matter the category?

<?php
$iManufacturer $this->product;
JRequest::setVar('virtuemart_manufacturer_id',$iManufacturer->virtuemart_manufacturer_id,'GET');
$model VmModel::getModel('manufacturer');
$manufacturerURL JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_manufacturer_id=' $iManufacturer->virtuemart_manufacturer_id);
if ($iManufacturer->virtuemart_manufacturer_id !=) {
$manufacturer $model->getManufacturer();
$model->addImages($manufacturer,1);
$manufacturerImage $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image-product-page"',false);
?>

</div>
<div class="product-manufacturer-information">
<div class="pleft">
<div class="product-field-type-S">
<label class="product-fields-title" ><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DETAILS_MANUFACTURER_LBL'?></label>

</div>
</div>
<div class="manufacturer-image pright">
<a title="<?php echo JText::_('TPL_GK_LANG_VIRTUEMART_PRODUCTS_DISPLAY_MANUFACTURER_PRODUCTS'?><?php echo $iManufacturer->mf_name?>" href="<?php echo $manufacturerURL?>"><?php echo $manufacturerImage?></a>
</div>
</div>


Plase let me know if it's possible.

Kind Regards,
Title: Re: Show Manufacturers information on "productdetails page"
Post by: yosandra on August 24, 2013, 11:11:02 AM
Quote from: yosandra on August 18, 2013, 19:28:36 PM
Quote from: JtouchMobile.com on January 05, 2012, 04:07:01 AM
@tobsagt:

#1: Open /components/com_virtuemart/views/productdetails/tmpl/default.php

Find this code:
if(VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) { ?>

Move its view section to any place (in the file) you refer to

#2: Hack to the view of manufacture, you can find all at /views/manufacturer

But in top of the answers, I think you should take a time on understanding what M-V-C of Joomla do. Then it is very very easy for you to do any custom on VM ;)

Cheers,

I have this code to display the manufacturer products, but it gets me to the same category (of the manufacturer). I wonder if is possible to display in this code all manufacturer products no matter the category?

<?php
$iManufacturer $this->product;
JRequest::setVar('virtuemart_manufacturer_id',$iManufacturer->virtuemart_manufacturer_id,'GET');
$model VmModel::getModel('manufacturer');
$manufacturerURL JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_manufacturer_id=' $iManufacturer->virtuemart_manufacturer_id);
if ($iManufacturer->virtuemart_manufacturer_id !=) {
$manufacturer $model->getManufacturer();
$model->addImages($manufacturer,1);
$manufacturerImage $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image-product-page"',false);
?>

</div>
<div class="product-manufacturer-information">
<div class="pleft">
<div class="product-field-type-S">
<label class="product-fields-title" ><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DETAILS_MANUFACTURER_LBL'?></label>

</div>
</div>
<div class="manufacturer-image pright">
<a title="<?php echo JText::_('TPL_GK_LANG_VIRTUEMART_PRODUCTS_DISPLAY_MANUFACTURER_PRODUCTS'?><?php echo $iManufacturer->mf_name?>" href="<?php echo $manufacturerURL?>"><?php echo $manufacturerImage?></a>
</div>
</div>


Plase let me know if it's possible.

Kind Regards,

Hello, any solution for this? I need to display all products by the manufacturer no matter what the category we are in.I don't know if the code is ok, but it keeps into the category ,to show manufacturer products into the category we are in. I need into the code to display all manufacturer products (all categories).

Kind Regards,
Title: Re: Show Manufacturers information on "productdetails page"
Post by: Snake 60 on August 25, 2013, 12:16:34 PM
I think, need to write query to a DataBase for realize that. Is here any True PROgrammers? ;) I noob in php, but I will try to do that, becouse me need too this feature. :)
Title: Re: Show Manufacturers information on "productdetails page"
Post by: CasperH on August 12, 2015, 21:29:52 PM
JamesSVk, thank you very very much for below code. It can easily be added on the detail page, requires no core changes, is upgrade proof and does exactly what it needs to do!

I'm replying to this "old" thread to also confirm this works for VM 3.0.9 and it hopefully points new people also to this solution, as it was still being asked in this thread even though a solution was provided.

Quote from: JamesSVk on February 03, 2013, 18:30:59 PM
I got solution, try this directly on your view site (/productdetails/tmpl/default.php or in template /html/com_virtuemart/productdetails/default.php):

<?
   JRequest::setVar('virtuemart_manufacturer_id',$this->product->virtuemart_manufacturer_id,'GET');
        $model = VmModel::getModel('manufacturer');
        if ($this->product->virtuemart_manufacturer_id !=0 ) {
$manufacturer = $model->getManufacturer();
$model->addImages($manufacturer,1);
$this->manufacturerImage = $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image"',false);
                }
              echo $this->manufacturerImage;
  ?>

Title: Re: Show Manufacturers information on "productdetails page"
Post by: Geppux on December 10, 2015, 11:15:47 AM
I used the above solution and in my template/html/com_virtuemart/productdetails/default.php I replaced this code:
<?php
// Manufacturer of the Product
if (VmConfig::get('show_manufacturers'1) && !empty($this->product->virtuemart_manufacturer_id)) {
echo $this->loadTemplate('manufacturer');
}
?>


with this:
<?php
// Manufacturer of the Product

   
JRequest::setVar('virtuemart_manufacturer_id',$this->product->virtuemart_manufacturer_id,'GET');
        
$model VmModel::getModel('manufacturer');
        if (
$this->product->virtuemart_manufacturer_id !=) {
$manufacturer $model->getManufacturer();
$model->addImages($manufacturer,1);
$this->manufacturerImage $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image"',false);
                }
              echo 
$this->manufacturerImage;
?>


and now I have the logo instead of the name of the manufacturer, but the name was linked, clicking on it I was going on the manufacturer virtuemart page and now it's no more linked... what I have to change to have the logo linked to the manufacturer page as before or, better, to display all the products of the manufacturer?
Thank you.
Giuseppe
Title: Re: Show Manufacturers information on "productdetails page"
Post by: escozul on March 16, 2017, 17:03:36 PM
Hello,

The above code from Geppux still works for VM 3

However it seems that the link issue is not worked out yet and also, I'd like an if clause to actually hide the image of the manufacturer if none is set. Right now, that code displays a no-image set image when a manufactrer has no logo.

Do you guys have any suggestions to that?

Thanks
Title: Re: Show Manufacturers information on "productdetails page"
Post by: escozul on April 20, 2017, 17:55:12 PM
Sorry for bumping this but maybe someone who could help would see it this time? I have still not been able to figure it out without a bit of guidance
Title: Re: Show Manufacturers information on "productdetails page"
Post by: Studio 42 on April 21, 2017, 12:17:49 PM
Check for substr("$manufacturer->images[0]->file_url, -1) ==='/')

        if ($this->product->virtuemart_manufacturer_id !=0 ) {
$manufacturer = $model->getManufacturer();
$model->addImages($manufacturer,1);
if( substr($manufacturer->images[0]->file_url, -1) ==='/') ) {
$this->manufacturerImage = $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image"',false);
              echo $this->manufacturerImage;
                }
                }
Title: Re: Show Manufacturers information on "productdetails page"
Post by: escozul on April 21, 2017, 19:47:37 PM
Hello,

Thanks for posting. However I couldn't get it to work. it also crashed the product details page. I would get a white page when using this code :(

Could there be a typo in the code?
Title: Re: Show Manufacturers information on "productdetails page"
Post by: Studio 42 on April 21, 2017, 21:31:30 PM
Typo corrected :

        if ($this->product->virtuemart_manufacturer_id !=0 ) {
$manufacturer = $model->getManufacturer();
$model->addImages($manufacturer,1);
if( substr($manufacturer->images[0]->file_url, -1) ==='/' ) {
$this->manufacturerImage = $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image"',false);
              echo $this->manufacturerImage;
                }
                }


Title: Re: Show Manufacturers information on "productdetails page"
Post by: escozul on April 25, 2017, 08:25:08 AM
Oh Great That in deed worked.. However I still fail to see where the difference is.. I suppose my eyes are failing me... I can't locate the typo but the new code works! It works like a charm actually.

I also changed it a bit to make the image link to the manufacturer page:

I will place below here the whole additional info div which includes rating, email to a friend and pdf link

<div class="product-additional-info">
    <?php
    // Rating
    echo shopFunctionsF::renderVmSubLayout('rating',array('showRating'=>$this->showRating,'product'=>$this->product));
                    
?>
<br><?php //Break a line
    // Manufacturer of the Product
    if (VmConfig::get('show_manufacturers'1) && !empty($this->product->virtuemart_manufacturer_id)) {
        //echo $this->loadTemplate('manufacturer'); //I commented this out to hide the manufacturer text.
    }
                    
//Androutsos: Logo of the manufacturer
                    
if (VmConfig::get('show_manufacturers'1) && !empty($this->product->virtuemart_manufacturer_id)) { //I placed this here to hide the manufacturer image. Below code is not finished yet and does not display properly when there is no manufacturer image
                        
JRequest::setVar('virtuemart_manufacturer_id',$this->product->virtuemart_manufacturer_id,'GET');
                        
$model VmModel::getModel('manufacturer');
                        if (
$this->product->virtuemart_manufacturer_id !=) {
                            
$manufacturer $model->getManufacturer();
                            
$model->addImages($manufacturer,1);
                            
$manlink JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_manufacturer_id='.$manufacturer->virtuemart_manufacturer_idFALSE);
                            if( 
substr($manufacturer->images[0]->file_url, -1) !='/' ) { //as suggested here: http://forum.virtuemart.net/index.php?topic=95818.new;topicseen#new
                                
$this->manufacturerImage $manufacturer->images[0]->displayMediaThumb('class="manufacturer-image"',false);
                                
?>
<a class="manufacturer" href="<?php echo $manlink?>"><?php echo $this->manufacturerImage?></a><?php
                            
}
                        }
                    }
                    
?>
<br><?php //Break a line
    ?>

   
    <?php if (VmConfig::get('show_emailfriend') || VmConfig::get('show_printicon') || VmConfig::get('pdf_icon')) : ?>
    <?php
    $link 'index.php?tmpl=component&option=com_virtuemart&view=productdetails&virtuemart_product_id=' $this->product->virtuemart_product_id;

echo $this->linkIcon($link '&format=pdf''COM_VIRTUEMART_PDF''pdf_button''pdf_icon'false);
echo $this->linkIcon($link '&print=1''COM_VIRTUEMART_PRINT''printButton''show_printicon',false,true,false,'class="printModal"');
$MailLink 'index.php?option=com_virtuemart&view=productdetails&task=recommend&virtuemart_product_id=' $this->product->virtuemart_product_id '&virtuemart_category_id=' $this->product->virtuemart_category_id '&tmpl=component';
    echo $this->linkIcon($MailLink'COM_VIRTUEMART_EMAIL''emailButton''show_emailfriend'false,true,false,'class="recommened-to-friend"');
    ?>

    <?php echo $this->edit_link?>
    <?php endif; // PDF - Print - Email Icon END ?>
        </div>

I have also added the link to the manufacturer's products there but you may change it to get redirected to the manufacturer's details page:
$manlink = JRoute::_('index.php?option=com_virtuemart&view=manufacturer&virtuemart_manufacturer_id='.$manufacturer->virtuemart_manufacturer_id, FALSE);