I have noticed that User Group privileges consist of only radio button options, to turn things on or off,
but no inputs to limit amounts for anything.
For instance, in Multi-vendor, there is no place in Group Privileges to limit the number of categories for one product. Also, no such settings is available to Vendor plans.
Without this, a vendor could add a product to limitless categories, causing alot of work to admins to clean up.
I used this function for my needs, vendors can assign their products to only one category, all alternatives will gets deleted. also you can build/write a code for some extra your needs here, within in this function. hope this helps you.
for example, add field on vendor_plan table called "num_cat_for_product" and read it within in this function. let say plan allowed 2, and if products_categories table has more than it's allowed, then keep top 2 and delete all others.
that is what are you asking, isn't?
function fn_mycustom_update_product_categories_post(&$product_id, $product_data, $existing_categories, $rebuild, $company_id)
{
if (AREA !== 'A') {
return;
}
db_query('DELETE FROM ?:products_categories WHERE product_id = ?i AND link_type = "A" ', $product_id);