Hello everyone
I'm new to virtuemart (and to Joomla).
I would to have a module in order to display products that are in a given category.
How should I do ?
It is possible to do this via the component, but I need to do this via a module.
Thanks for any help !
Hi sulimo,
VM comes with a pre-packaged module to do that.
> Extensions > Module Manager
Click new and select "VirtueMart Category" from the list . During setup, simply select the category you wish to display in the panel on the right.
It only displays 1 category per module so you may need to create multiple modules.
I hope this helps.
Thank you for your answer !
That would help a lot but that particular doesn't appear in the list of module types...
Is it a problem with my installation? What does it mean?
About categories for virtuemart I only have the module to display all the categories. So that is not the one I want...
I realize that maybe I didn't express correctly (sorry I'm french...)
What I'm searching for is not a list of categories, but a list of products for a category. But the VirtueMart Category module seems to only display links to categories (or subcategories)
Hi sulimo,
You're absolutely correct. My mistake, I'm sorry.
I just realised I wrote my own module to do that which probably would be too much for what you need. However you could duplicate the following "mod_virtuemart_product" module and modify it for your needs.
Good luck.
Thanks again!
Well I tried to explore the code of the module, but I didn't figure out how I could find products with a category object so I'm stuck there too.
I'm really surprised that there is no module for that. I thought it was quite a common task but maybe it isn't so...
Do you share your code somewhere?
Hi sulimo,
Unfortunately my module is specific for my clients application. Like I mentioned, it's probably too much for what you require.
Have you tried searching around for one?
Yes that is the first thing I tried. With no luck...
I would be happy to see this possible in VM2, too. Just a simple list of products, showing prices and add-to-cart button. Just like it is in VM1.
Hi guys.
-- URL REMOVED --
Go nuts.
Thanks ivus !
That is exactly what I need!
Is that your code? There is a small mistake on line 46 in tmpl/default.php but except that it perfectly works for me!
Thanks again!
Hi sulimo,
Thanks for that pickup. I've now fixed it, re-zipped, re-upped.
All I did was modified "mod_virtuemart_category" so it's not really my code which is why I left the original copyright/version headers in the file.
I'm happy it works for you. Can you mark this topic [SOLVED].
ivus
Of course I'll mark it right now.
For info there is another mistake on line 41 of mod_virtuemart_category_products.php
The test should be if (!class_exists( 'mod_virtuemart_category_product' ))
The use of both mod_virtuemart_category_product and mod_virtuemart_category_products is confusing.
Nevermind, it works and this is great :)
Hi there
I am very very new to Virtuemart - but not to Joomla
I wonder if you can help me - your solution is almost there for me - but not quite....
I am looking for a product list - per category - but just a list - no images etc - basically like the following:
CATEGORY DESCRIPTION
( category image)
[add to cart] SKU CODE Description Price
[add to cart] SKU CODE Description Price
[add to cart] SKU CODE Description Price
[add to cart] SKU CODE Description Price
etc .......
Does anyone know how to achieve this?
Thanks
Lex Faure
I have added a picture I created which may help to explain this....
[attachment cleanup by admin]
Hi alexius,
simply change the code in my module to suit your needs. I won't get offended.
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
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.
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
ivus, your link is no good anymore. Can you repost?
done.
enjoy
Actually.... I'm gonna just put it here.
;D enjoy
[attachment cleanup by admin]
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.
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..
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 (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 == 1 && $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_desc, 40, '...') ?>
</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->link, JText::_('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]
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?
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
This thread is long dead, but the problem is still alive. Is there still a way to get that code? Thanks!
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.