Author Topic: How to integrate Manufacturer with link and image in Product Details page?  (Read 241 times)

kostianev

  • Jr. Member
  • **
  • Posts: 57
  • Web Developer
    • MOON.bg
  • Skype Name: moonbgltd
  • VirtueMart Version: 3.x
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

  • Jr. Member
  • **
  • Posts: 378
To display manufacturer image:
Code: [Select]
$mfModel= VmModel::getModel('Manufacturer');
$manufacturer = $mfModel->getManufacturer($this->product->virtuemart_manufacturer_id[0]);
$mfModel->addImages($manufacturer);
echo $manufacturer->images[0]->displayMediaThumb(false,false);

kostianev

  • Jr. Member
  • **
  • Posts: 57
  • Web Developer
    • MOON.bg
  • Skype Name: moonbgltd
  • VirtueMart Version: 3.x
Thank you! Working fine, can I link the image with the Manufacturer`s products? How must be the link looking?

Ghost

  • Jr. Member
  • **
  • Posts: 378
Image wrapped with link to manufacturer's products:
Code: [Select]
<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

  • Jr. Member
  • **
  • Posts: 57
  • Web Developer
    • MOON.bg
  • Skype Name: moonbgltd
  • VirtueMart Version: 3.x
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

  • Jr. Member
  • **
  • Posts: 378
The second image is accessed with $this->product->images[1]:
Code: [Select]
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

  • Jr. Member
  • **
  • Posts: 57
  • Web Developer
    • MOON.bg
  • Skype Name: moonbgltd
  • VirtueMart Version: 3.x
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?