I am in the process of creating a site that accommodates multiple sellers (multi-vendor). Sellers can perform Crud on their products. My query concerns methods of data separation for sellers. Which methods are available to ensure sellers can only interact with products they have created.

A couple of ideas I had:

  1. Add a seller ID against product in product table
  2. Create separate product table for every seller

Apart from the above two any further suggestions and wondering how this is usually solved?

  • I am not trying to be rude, but if you have to ask about such a basic issue, you likely shouldn't be doing it yourself as you are almost guaranteed to miss a very important security step. FWIW each product would obviously have a sellerID
    – Steve
    Jun 21 '20 at 1:35
  • I'm not the developer for this application, I've found a hole that the developer has left :( I'm looking at high level options on the best way to solve.Thanks Jun 22 '20 at 8:29

Go with the SellerID against ProductID

A separate table for each seller is not advisable when the number of tables goes out of control.

I used to manage a multisite WP for a client and for each new blog a user used to create it was creating new tables. Everything was great in start but as time went by we had 152,000 tables in the database. (We didn't hoped it will grow so fast.) You would not want to get into this kind of situation.

That is why a table with 1 million rows is manageable but a database with 10,000 tables is a headache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.