VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: encreplus on November 03, 2015, 21:41:50 PM

Title: all product in same category on product detailed page
Post by: encreplus on November 03, 2015, 21:41:50 PM
How can i show all products available in the same category of the product a user is watching in the product detail page

Im using VM3 3.0.10 and joomla 3.4.5
Title: Re: all product in same category on product detailed page
Post by: jenkinhill on November 03, 2015, 23:40:41 PM
You can add the related category, when clicked on it will open to show the products, but I know of no way to show all those products.
Title: Re: all product in same category on product detailed page
Post by: lindapowers on November 04, 2015, 00:05:15 AM
Using related products
Title: Re: all product in same category on product detailed page
Post by: PRO on November 04, 2015, 10:26:22 AM
use the product module, category filter turned on, set the quantity to as high as you need it
Title: Re: all product in same category on product detailed page
Post by: jenkinhill on November 04, 2015, 12:18:31 PM
Ah yes! I had not realised that Milbo has removed the product limit for relateds. Layout could do with some styling, though.
Title: Re: all product in same category on product detailed page
Post by: melix on August 06, 2017, 23:41:58 PM
Hi,
I have read all topics regarding this thread, and nothing is able to automatize the process.
Here is the VM 1.1.X piece of hack that allowed showing other products of the same category in product_detail page (old flypage).

Would it be possible someone translate it for VM 3.x ? It would be chic on his part ! 8)

<?php   // find all the other products in this category

  
$q "SELECT p.product_id, p.product_name, p.product_sku, p.product_thumb_image, c.category_name, c.category_flypage
            FROM #__{vm}_product p,#__{vm}_product_category_xref pc, #__{vm}_category c
            WHERE p.product_publish='Y' AND pc.product_id = p.product_id AND pc.category_id = c.category_id AND c.category_id = '
$category_id' AND p.product_id != '$product_id'
            ORDER BY p.product_sku "
;

$i=0;
$max=4//entry by row

$db = new ps_DB;
$db->query$q );
if( $db->next_record() )  {
echo 
'Autres coloris de la collection "'.$db->f('category_name').'"<br />';
   
$flypage $db->f('category_flypage');
   
$db->reset();
   echo 
'<br><table style="width:100%">';
    while( 
$db->next_record() ) { 

if ($i && $i $max == 0)
    {
        echo 
'</tr><tr>';
    }

   echo 
'<td style="padding-right: 10px">';
?>

     
      <a href="<?php  $sess->purl(URL "index.php?page=shop.product_details&flypage=$flypage&product_id=" $db->f("product_id") . "&category_id=$category_id?>">
      <img src="<?php echo $mosConfig_live_site;?>/components/com_virtuemart/shop_image/product/<?php $db->p("product_thumb_image");?>"
  title = <?php $db->p("product_sku"?> alt = <?php $db->p("product_sku"?>>
  <br /><?php echo $db->p("product_name"?>
      </a>
      <?php
  
   echo 
'<hr /></td>';
   
$i++;
   } 
//while
echo '</tr></table>';
// if
?>