L
L
levshaszr2018-04-17 09:24:42
Yii
levshaszr, 2018-04-17 09:24:42

YII2 add product to different categories?

Hello, how to implement the functionality of adding products to different categories. well, i.e. one product that would belong to several categories. And is it possible to do this on this engine?
Unfortunately, I am not familiar with this engine at all. I don't even know where to look

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Papa, 2018-04-17
Stifflera @PapaStifflera

Is it even possible to do this on this engine?

You can do something like that too. But not with your level of knowledge.
Study the documentation until complete enlightenment. Moreover, it is of high quality and available in many languages.

D
DieZz, 2018-04-17
@DieZz

Yii2 is not an engine, but a framework. Regarding your question - the problem here is not the framework level, but the database design level. It is enough to create three tables

products
----------
id
name
...

categories
------------
id
name
...

products_categories
------------------------
product_id
category_id

In this case, each product can be associated with a large number of categories. Read about many-to-many relationships

A
Artem Spiridonov, 2018-04-17
@customtema

YII is not an engine. Don't look there.
There is light at the end of the tunnel, but years before it. I'm not exaggerating.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question