Answer the question
In order to leave comments, you need to log in
How to assign original id to duplicate when adding in MySql?
I get the data in this form
id_product
attribute - value
attribute - value
In different products, attributes can duplicate each other, in fact, when working with Opencart3, there are two problems.
1. you need to assign id to all attributes. at the same time, the attributes of the duplicates need to be assigned the value of the original ...
2. you need to somehow add this attribute id to the table to the goods, so as not to be confused.
I broke my head, help with ideas, does anyone have any thoughts on how to organize this with procedural php?
Answer the question
In order to leave comments, you need to log in
Make an attribute_product table - an intermediate one, where you will store the product attribute relationship, in it id Primary Key, product_id, attribute_id (you can use a foreign key, you can not steam
it ) goods, or, at worst, a separate request. And accordingly, also for adding the behavior, so that the connection in the database is added.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question