#76 – cadproduct content for categories

Posted in ‘Catproduct Content’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

This is more a suggestion that a question:
Please modify your plugin, or make a new version in a way that it can be used to show all products in a category. While this is there already somehow in a way, it is not very flexible since you always need to write that category id manually:

If there is a menu for each virtuemart category (maybe automatically created instead of manually keeping it up), it would be good if, when one menuitem clicked, there would be a module or something with your Catproduct Content plugin showing all the products in that specific category. But that means that it needs to pick up category id automatically from GET or POST variable or such, instead of admin creating manually maybe hundreds of modules for hundreds of categories (and when there is usually no child products).

I believe that wasn't even a very large modification and would put usefulness of the plugin to whole new level :)

Hello Seppo,

Very good suggestion. I'll add it in next version.

But quick solution for you. Open plugins/content/catproduct/catproduct.php

and find

if (strpos($working,'#CATEGORY[') !== false) {<br /> preg_match("/#CATEGORY.*?[(.*?)\]/",$working,$category_ids);
$category_ids = $category_ids[1];
} else $category_ids = '';

and replace it with

if (strpos($working,'#CATEGORY[') !== false) {<br /> preg_match("/#CATEGORY.*?[(.*?)\]/",$working,$category_ids);
$category_ids = $category_ids[1];
if (JRequest::getInt( 'virtuemart_category_id', 0) != 0) array_push($category_ids, JRequest::getInt( 'virtuemart_category_id', 0));
} else $category_ids = '';

So with that if you put

#CATEGORY[] inside catproduct contend command it will also search for category inside url.

Hope it helps.

Best Regards,
Hello Maja,

Thank you for your solution :)

I had actally tried a bit similat approach already, but not getting it to work. I tried that too, but it didn't work either.. I do not know why yet. When I add that line, or even if I add there instead of second if just straight
array_push($category_ids, 183);
of even
$category_ids = 183;

just to see if it will print out anything, it doesn't. It prints only when the content there is the id mentioned:
isntead of

and even then it only prints the products from 234, not adding or replacing from 183 in tryout this case. So could there be some other part to change as well? I actually tried few from the same file, but didn't succeed yet..

Thanks in adcance,

I fought with it a while and found couple of reasons it was not working..

One was that I had to change from
JRequest::getInt( 'virtuemart_category_id', 0)
$jinput = JFactory::getApplication()->input;
$jinput->getInt('virtuemart_category_id', 0)

and another a bit trickier one, was that the lin endings with catproduct_content.php were in MACINTOSH format, which made it behaving strange. After taht was changed to unix-format, it begun to work properly. Since I have not used mac in my editings, I guess it is like that in the original files I got from installation package. Might be good thing to check out and change to avoid problems also there :)


About the author

Who‘s behind this


Maja Mozina Mlinar


Sandi Mlinar



Skype: maja.mozina1