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

How to Show Other products by the same Manufacturer in Product Details

Started by isalcedo, March 15, 2013, 16:27:24 PM

Previous topic - Next topic

isalcedo

Hello i was having a problem about showing other products from the same manufacturer under product details in the product detail page. I solved it. And this is the code. Can be added whatever you want in your template\html\com_virtuemart\productdetails\default code structure.

<?php
    
$db = &JFactory::getDBO();
    
$manufacturer $this->product->virtuemart_manufacturer_id;
    
$sql "SELECT N.product_name,I.virtuemart_media_id,M.virtuemart_product_id,MN.mf_name 
     FROM h3ls8_virtuemart_product_manufacturers AS M 
     LEFT JOIN h3ls8_virtuemart_products AS P ON M.virtuemart_product_id = P.virtuemart_product_id
     LEFT JOIN h3ls8_virtuemart_products_es_es  AS N ON N.virtuemart_product_id = M.virtuemart_product_id
     LEFT JOIN h3ls8_virtuemart_product_medias  AS I ON M.virtuemart_product_id = I.virtuemart_product_id
     LEFT JOIN h3ls8_virtuemart_manufacturers_es_es AS MN ON MN.virtuemart_manufacturer_id = M.virtuemart_manufacturer_id
     WHERE M.virtuemart_manufacturer_id = '
$manufacturer'"// h3ls8_ is your table Prefix
    
$db->setQuery($sql);
    
$db->query();
    
/* $res = $db->loadAssocList(); //This Load the info as a List */
    
$prod $db->loadObjectList(); // This Load the info as a group of objects for loading it.

    
JRequest::setVar('virtuemart_manufacturer_id',$this->product->virtuemart_manufacturer_id,'GET');
    
$productModel VmModel::getModel('product');
    

    
if ($this->product->virtuemart_manufacturer_id !=) {
    
$products $prod;
    
$productModel->addImages($products);
    
$this->assignRef('products'$products);
    
}
        
// Show Products
    
if (!empty($products)) { ?>

<div class="seven columns obras">
<h5> Obras </h5>
<div class="row">
<?php
// Start the Output
foreach ($products as $product) {
// Show Products
?>

<div class="four columns mobile-two end producto">
<div class="imagen">
<!-- <?php //if ($product->product_special == 1) { ?>
<div class="oferta">
<br />
</div>
<?php}?> *** If you wanna add some especial icon to a Special product uncommnent this *** --> 
<?php 
echo JHTML::_('link'JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$product->virtuemart_product_id.'&virtuemart_category_id='.$product->virtuemart_category_id),$product->images[0]->displayMediaThumb('class="catImage"',false));
?>

</div>
</div> <!-- end of product -->
<?php ?>
</div>
</div>
<?php ?>


The Classes of the Divs are for using it into Foundation Zurb Framework, you can just clean it. Sorry for my English. I hope this can help a lot.