News:

Looking for documentation? Take a look on our wiki

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

sulimo

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 !

ivus

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.

sulimo

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

sulimo

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)

ivus

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.

sulimo

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?

ivus

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?

sulimo

Yes that is the first thing I tried. With no luck...

BSSennenhonden

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.

ivus

#9
Hi guys.

-- URL REMOVED --

Go nuts.

sulimo

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!

ivus

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

sulimo

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  :)

alexius

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]

ivus

Hi alexius,

simply change the code in my module to suit your needs. I won't get offended.