VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: rayge on August 03, 2015, 22:44:58 PM

Title: Multiple categories for product module
Post by: rayge on August 03, 2015, 22:44:58 PM
I read somewhere where you guys might be updating the module to allows this?

Has this been completed and committed yet?

I ended up having to edit a core file to get it to work for me.. simple but effective.

I opened /administrator/components/com_virtuemart/models/product.php
And changed Line 321 from
$where[] = ' `pc`.`virtuemart_category_id` = ' . $virtuemart_category_id;
To
$where[] = ' `pc`.`virtuemart_category_id` IN (' . $virtuemart_category_id.')';

This way in the module i can simply enter cat ids separated by a comma.

We should also have the opportunity to allow to use created_by rather than modified_by as most of my clients import using a spreadsheet.
Title: Re: Multiple categories for product module
Post by: Studio 42 on August 03, 2015, 23:01:18 PM
Hi,

nice idea, but not safe to distribute.
Image someone put a name or sql query at the place ?

I think a better way is to change the category_ids as list multiple in XML, get value from the array of cat_ids and filter with Joomla JArrayHelper::toInteger($cat_ids);

Greets,
Patrick