Hello. I am trying to implement the addition of recipes on the site with a choice of already added products to the database. Naturally, there are several products to choose from, but the base is supposed to be large, therefore it has fallen into a small dead end due to lack of experience. I can not think how it is more convenient for the user to realize the choice of these products.

Maybe there is some select with search in yii2?

Or is it better to make a gridView in which you can select several products? (And if turning the pages will the data not be reset?)

Or there are more convenient ways that did not occur to me .. Please advise me))

  • Create a table to store the selected products. When choosing a product, add them to this table. Then do anything with it - Vanya Avchyan
  • Well, yes, probably, a kind of "basket" will be familiar and convenient for users) - DumbSailor
  • And also it will give more flexibility and optimally. You will have less goods in the basket than in the main table.
  • By itself id, thank you) as it will allow you to conveniently specify a grammar and move on to further filling in the other fields - DumbSailor
  • Here is a SQL query for you that will help you in the future. SELECT p.name,p.price FROM products p INNER JOIN baskets b ON b.product_id = p.id - Vanya Avchyan

0