News:

Support the VirtueMart project and become a member

Main Menu

How to integrate Manufacturer with link and image in Product Details page?

Started by kostianev, October 09, 2017, 16:47:19 PM

Previous topic - Next topic

kostianev

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?

Ghost

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);

kostianev

Thank you! Working fine, can I link the image with the Manufacturer`s products? How must be the link looking?

Ghost

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>

kostianev

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?

Ghost

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.

kostianev

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?