Magento category selection for vendors adding products

So this is more of a question for anyone familiar with Magento since I’m still somewhat new to it.

So I’m using a CED commerce multi vendor extension. When a vendor wishes to add a product, they’re given the category tree. I don’t want people being able to add products in every category however, which means I’m looking for a way to limit each product to one single category. I figured the easiest way to do this would be to write a quick script that will disable all other checkboxes next to each category upon one of them being chosen. And then enabled again if the one they chose is unchecked.

I would not like it to be client sided though so that users can bypass it. So would it best to add something to the list.phtml from the template or write a script and have the page load it?

Can you get away with changing them to a set of radio inputs (they need to all have the same name so only one can be selected) instead of checkboxes ?

1 Like

Honestly I’ve never even thought of this. I’ll have to find them first, which isn’t real easy for people new to Magento. Or so I’ve heard.

If I could, that would be a much easier solution though lol

So changing them to radio buttons could work, except the products wouldn’t end up in any parent categories, only the exact one that’s chosen.

Maybe if I were to remove all checkboxes, and somehow force the lowest subcategories to still have radio buttons, then once the product is added it will show up in all parent categories of the subcategory

I understood this to be a one-to-many, one-to-one relationship i.e.
Each parent category can have many products.
Each product can belong to only one parent category.

If so, the products should not belong in the same radios as the parent categories. In fact, probably only the parent categories would need to be radios

Or are the relationships more complex than this?

The extension allows a product to be added to as many parent categories as you wish. Each parent category being a radio would work, however the vendor could still add their product to multiple subcategories in the parent they choose.

Parent 1-
Sub 1 > Child 1 or Child 2
Sub 2 > Child 1 or Child 2

Parent 2-
Sub 1 > Child 1 or Child 2
Sub 2 > Child 1 or Child 2

I’d like it so that the vendor can only choose one Child category within a sub of a parent. Or is this not what you meant?

Just letting you know I decided to use radio buttons by editing the edit.phtml

I just won’t have items in the parent categories which will be fine

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.