News:

Support the VirtueMart project and become a member

Main Menu

all product in same category on product detailed page

Started by encreplus, November 03, 2015, 21:41:50 PM

Previous topic - Next topic

encreplus

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

jenkinhill

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.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

lindapowers


PRO

use the product module, category filter turned on, set the quantity to as high as you need it

jenkinhill

Ah yes! I had not realised that Milbo has removed the product limit for relateds. Layout could do with some styling, though.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

melix

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
?>