2

Suppose I have a product custom attribute 'brand', after choosing one of the brand options & saving the product in how many tables this product attribute will be saved?

attribute "brand" type is varchar so according to me it'll be saved in the "catalog_product_entity_varchar" table.

But when I'm inserting values directly into this table by using insert query.

e.g-

SET FOREIGN_KEY_CHECKS=0;

INSERT INTO `catalog_product_entity_varchar` (`value_id`, `attribute_id`, `store_id`, `entity_id`, `value`) VALUES
(NULL, 611, 0, 11, '560');

SET FOREIGN_KEY_CHECKS=1;

Then getting following problem:-

Error SQL query:

INSERT INTO `catalog_product_entity_varchar` (`value_id`, `attribute_id`, `store_id`, `entity_id`, `value`) VALUES
(NULL, 611, 0, 11, '560')
MySQL said: Documentation

#1452 - Cannot add or update a child row: a foreign key constraint fails (`dev21_wp2`.`catalog_product_entity_varchar`, CONSTRAINT `CAT_PRD_ENTT_VCHR_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE )

Please clarify me & help me to resolve this issue.

Your Answer

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

Browse other questions tagged or ask your own question.