How to display the products of current category in product details page.
My below code is displaying the products list of current category in category but cant show the same in product details page
<div id="cate_menu">
<span style="margin-left:30px;"><font size="3" color="#8F5700"><B>Products</B></font></span>
<?php
// Category and Columns Counter
$iBrowseCol = 1;
$iBrowseProduct = 1;
// Calculating Products Per Row
$BrowseProducts_per_row = $this->perRow;
$Browsecellwidth = ' width' . floor (100 / $BrowseProducts_per_row);
// Separator
$verticalseparator = " vertical-separator";
// Count products ?? why not just count ($this->products) ?? note by Max Milbers
$BrowseTotalProducts = 0;
foreach ($this->products as $product) {
$BrowseTotalProducts++;
}
// Start the Output
foreach ($this->products as $product) {
// Show the horizontal seperator
if ($iBrowseCol == 1 && $iBrowseProduct > $BrowseProducts_per_row) {
?>
<div class="horizontal-separator"></div>
<?php
}
// this is an indicator wether a row needs to be opened or not
if ($iBrowseCol == 1) {
?>
<div class="row2">
<?php
}
// Show the vertical seperator
if ($iBrowseProduct == $BrowseProducts_per_row or $iBrowseProduct % $BrowseProducts_per_row == 0) {
$show_vertical_separator = ' ';
} else {
$show_vertical_separator = $verticalseparator;
}
// Show Products
?>
<ul>
<li><?php echo JHTML::link ($product->link, $product->product_name); ?></li>
</ul>
</div>
<?php
}
?>
Hello,
I think you should try to bring the category model ... but need some work to get done.
$categoryModel= VmModel::getModel('category'); //Load the category model
$category = $categoryModel->getCategory($this->virtuemart_category_id); //Load products in that category
Also you should bring the product model to list products the given category... like
$products = $productModel->getProductsInCategory($this->virtuemart_category_id);
This is some hits to bring the model on the view (based on MVC) ... then you should work a little bit to correct them ... this are loaded prior to your code.
Regards
Nikos
Can you pls elaborate more,
Hello,
Nope sorry, i have to work some time on that and i am little bit pressure those days. You can try the job sections if you need a custom solution.
Regards
Where you abble to do it correctly ??