VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: kostianev on October 09, 2017, 16:47:19 PM

Title: How to integrate Manufacturer with link and image in Product Details page?
Post by: kostianev on October 09, 2017, 16:47:19 PM
Dear, I need to integrate product Manufacturer in Product Details page with link and image / logo like the Category description short code:

<?php echo $this->category->category_description ; ?>

Can someone help me?
Title: Re: How to integrate Manufacturer with link and image in Product Details page?
Post by: Ghost on October 09, 2017, 17:10:21 PM
To display manufacturer image:

$mfModel= VmModel::getModel('Manufacturer');
$manufacturer = $mfModel->getManufacturer($this->product->virtuemart_manufacturer_id[0]);
$mfModel->addImages($manufacturer);
echo $manufacturer->images[0]->displayMediaThumb(false,false);
Title: Re: How to integrate Manufacturer with link and image in Product Details page?
Post by: kostianev on October 09, 2017, 19:01:39 PM
Thank you! Working fine, can I link the image with the Manufacturer`s products? How must be the link looking?
Title: Re: How to integrate Manufacturer with link and image in Product Details page?
Post by: Ghost on October 09, 2017, 20:36:13 PM
Image wrapped with link to manufacturer's products:

<a href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=0&virtuemart_manufacturer_id=' $this->product->virtuemart_manufacturer_id[0], false); ?>"><?php echo $manufacturer->images[0]->displayMediaThumb(false,false);?></a>
Title: Re: How to integrate Manufacturer with link and image in Product Details page?
Post by: kostianev on October 10, 2017, 07:47:47 AM
Thank you, working very good for me!
Do you know how can I make with Custom CMS code to show the second image of the product?
Title: Re: How to integrate Manufacturer with link and image in Product Details page?
Post by: Ghost on October 10, 2017, 07:56:43 AM
The second image is accessed with $this->product->images[1]: echo $this->product->images[1]->displayMediaThumb(); //or displayMediaFull().
But you should add a check to check if it exists. And should do the same with manufacturer, to avoid errors in case manufacturer is not set.
Title: Re: How to integrate Manufacturer with link and image in Product Details page?
Post by: kostianev on October 10, 2017, 08:12:09 AM
Can you please assist me, to generate the full code to have 1st image / 2nd image and hover, when I roll over the image to show the second image?