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

Module to display list of products in a category [SOLVED]

Started by sulimo, July 24, 2012, 20:15:04 PM

Previous topic - Next topic

alexius

Sorry Ivus
I do not have a clue where to begin....
But I am willing to learn ... fast!!
Just point me in the right direction and I will look at making changes.

Am I right in assuming that if I change your code - I may be able to get what I am looking for....?
That would be awesome!  :)

Thanks
Lex

ivus

Hi alexius,

My module is basically a modification of the mod_virtuemart_products anyway. So it's still VM native. And with all module development, you can change the code in the TMPL folder to suit your needs. Modules are probably the easiest things to modify at times.

Quote
Am I right in assuming that if I change your code - I may be able to get what I am looking for....?

Code is code. You make it do what you tell it to.

I hope this helps.

alexius

Thanks Ivus
I still need to find the module I need to modify - and I need to find out what I need to modify.....
But I will hunt around the forum to see if I can find pointers about where to go and what to do.....

Thanks

jthrongard

ivus, your link is no good anymore.  Can you repost?
Small Business Joomla! Website Design - Simple CMS Design
http://www.simplecmsdesign.com

ivus


ivus

Actually.... I'm gonna just put it here.

;D enjoy

[attachment cleanup by admin]

highlander411

From all of the dead ends I keep finding from other users I starting to think that simply "bypassing" the step of "Categories" is quite impossible.

Courtland

Any reason why using this module twice on a page would break the page Ivus? Trying to put one in sidebar A and another in sidebar B, either works alone but if I turn them both on my main product div disappears and some icons disappear..

chosenanointed

Okay, first of all.... great module, thanks for the effort put into this.

However, I too need my products displayed in a table format like alexius. I got the code from another thread to do this -> (http://forum.virtuemart.net/index.php?topic=104825.0)

I've modified it to suit my needs and this is the code I have at the moment to display my products:

<?php
/**
*
* Show the products in a category
*
* @package VirtueMart
* @subpackage
* @author RolandD
* @author Max Milbers
* @todo add pagination
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: default.php 6053 2012-06-05 12:36:21Z Milbo $
*/

//vmdebug('$this->category',$this->category);
vmdebug('$this->category '.$this->category->category_name);
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
JHTML::_'behavior.modal' );
/* javascript for list Slide
  Only here for the order list
  can be changed by the template maker
*/
$js "
jQuery(document).ready(function () {
jQuery('.orderlistcontainer').hover(
function() { jQuery(this).find('.orderlist').stop().show()},
function() { jQuery(this).find('.orderlist').stop().hide()}
)
});
"
;

$document JFactory::getDocument();
$document->addScriptDeclaration($js);


if ( 
VmConfig::get('showCategory',1) and empty($this->keyword)) {
if ($this->category->haschildren) {
?>




<?php }
}
?>

<div class="browse-view">
    <?php
if (!empty($this->keyword)) {
?>

<h3><?php echo $this->keyword?></h3>
<?php
?>

<?php if ($this->search !==null ) { ?>
    <form action="<?php echo JRoute::_('index.php?option=com_virtuemart&view=category&limitstart=0&virtuemart_category_id='.$this->category->virtuemart_category_id ); ?>" method="get">

    <!--BEGIN Search Box --><div class="virtuemart_search">
    <?php echo $this->searchcustom ?>
    <br />
    <?php echo $this->searchcustomvalues ?>
    <input name="keyword" class="inputbox" type="text" size="20" value="<?php echo $this->keyword ?>" />
    <input type="submit" value="<?php echo JText::_('COM_VIRTUEMART_SEARCH'?>" class="button" onclick="this.form.keyword.focus();"/>
    </div>
    <input type="hidden" name="search" value="true" />
    <input type="hidden" name="view" value="category" />

    </form>
<!-- End Search Box -->
<?php ?>

<?php // Show child categories
if (!empty($this->products)) {
?>


<h1><?php echo $this->category->category_name?></h1>

<?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
$BrowseTotalProducts 0;
foreach ( 
$this->products as $product ) {
   
$BrowseTotalProducts ++;
}
?>


<table class="orders" style="width:115%; font-family:Arial, Helvetica, sans-serif; font-size:13px; line-height:120%;">
<tr>
<th>Name</th>
<!--<th>Quantity</th>-->
<th style="width:60px;">Price</th>
<!--<th>Product Details</th>-->
<th style="width:96px;">Add to Cart</th>
</tr>

<?php
// Start the Output
foreach ( $this->products as $product ) {

// Show the horizontal seperator
if ($iBrowseCol == && $iBrowseProduct $BrowseProducts_per_row) { ?>

<div class="horizontal-separator"></div>
<?php }
?>



<tr>
<td style="padding:2px 10px;"><?php  echo JHTML::link($product->link$product->product_name); ?></td>
<!--<td><?php // Product Short Description
     echo shopFunctionsF::limitStringByWord($product->product_s_desc40'...'?>

</td>-->
<td style="padding:2px 10px;"><?php echo $this->currency->createPriceDiv('basePrice','COM_VIRTUEMART_PRODUCT_BASEPRICE',$product->prices); ?> </td>

<!--<td><?php // Product Details Button
echo JHTML::link($product->linkJText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name,'class' => 'product-details'));
?>
</td>-->



<td style="padding:2px 10px;">

<form method="post" class="product" action="index.php" id="addtocartproduct<?php echo $product->virtuemart_product_id ?>">


<div class="addtocart-bar">

<?php echo $this->product->virtuemart_product_id;?>
<span class="quantity-box">
<input type="text" class="quantity-input" name="quantity[]" value="1" />
</span>
<span class="quantity-controls">
<input type="button" class="quantity-controls quantity-plus" style="padding:0px;" />
<input type="button" class="quantity-controls quantity-minus" />
</span>
<?php // Display the quantity box END ?>

<?php // Add the button
$button_lbl JText::_('COM_VIRTUEMART_CART_ADD_TO');
$button_cls ''//$button_cls = 'addtocart_button';
if (VmConfig::get('check_stock') == '1' && !$this->product->product_in_stock) {
$button_lbl JText::_('COM_VIRTUEMART_CART_NOTIFY');
$button_cls 'notify-button';
?>


<?php // Display the add to cart button ?>
<span class="addtocart-button">
<input type="submit" name="addtocart"  class="addtocart-button" value="<?php echo $button_lbl ?>" title="<?php echo $button_lbl ?>" />
</span>

<div class="clear"></div>
</div>

<?php // Display the add to cart button END ?>
<input type="hidden" class="pname" value="<?php echo $product->product_name ?>">
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="view" value="cart" />
<noscript><input type="hidden" name="task" value="add" /></noscript>
<input type="hidden" name="virtuemart_product_id[]" value="<?php echo $product->virtuemart_product_id ?>" />
<?php /** @todo Handle the manufacturer view */ ?>
<input type="hidden" name="virtuemart_manufacturer_id" value="<?php echo $product->virtuemart_manufacturer_id ?>" />
<input type="hidden" name="virtuemart_category_id[]" value="<?php echo $product->virtuemart_category_id ?>" />
</form>
</td>


</tr>
<?php }
// end of foreach ( $this->products as $product )
?>




</table></div><!-- end browse-view -->


What I need is to have this layout in the module.

Although I can often get the result I need by editing some code, I'm unfortunately not a php expert and can't always figure out the solutions. I've tried copying parts of the layout to the module's template file, but it breaks the module's code every time, so I really don't know how to get this layout into the module.

The reason I need the module is because I want to display the products within an Article.
Secondly, the products are put into different categories, but the list I currently have only displays the whole list of products and doesn't show the categories. So what I have in mind is to do multiple modules, each displaying a different category's products and then displaying them separately in the article, putting a heading above each to show which category it's in.
Even if I don't manage to do the multiple modules in the article, I still need to put the products as a list in an article because there's some text that needs to display before the list of products show up.

The website is still on my local server while I'm busy building the site, but I'm attaching a screen shot of the current layout.

Any help in the right direction will be greatly appreciated.

[attachment cleanup by admin]

isalcedo

Is there something like this but display Products by Manufacturer? The mod_virtuemart_product only show, Random, Recent, Etc... Not by Manufacturer. Some one can help me?

manurajsebastian

Hi ivus ,
i have the same problem sulimo had ,
i wanna show products instead of categories ,
please help me with the codes ...

please be specific abt how to change codes , am very new to joomla , but i love joomla , and i donno nthin abt codin ... :) thanks for ur help in advance

lausianne

This thread is long dead, but the problem is still alive. Is there still a way to get that code? Thanks!

Studio 42

Hi, you find many modules to display list of product.
My own https://shop.st42.fr/en/products/products-any-ways.htm can display products using category as filter for eg.