The Old County
The Old County

Reputation: 89

Magento database tables - where is EAN stored

I am working on a Magento project and to complete an import to ebay process I may need to do a bulk update on EAN numbers.

I am reviewing the database and the tables - and I haven't found or see any indication as to where this "EAN" field is stored.

I can see it present on individual products under "general" in the edit panel on the magento site

Upvotes: 0

Views: 3363

Answers (3)

Cristian Vultur
Cristian Vultur

Reputation: 11

I dont think Magento comes with EAN code out of the box. You have to create an attribute for that.

Upvotes: 0

Vladimir Samsonov
Vladimir Samsonov

Reputation: 1329

Read about EAV.

get eans with product ids

SELECT entity_id, value FROM catalog_product_entity_varchar 
WHERE attribute_id IN ( SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'ean');

write ean to magento

INSERT INTO catalog_product_entity_varchar
(value, entity_id, entity_type_id, attribute_id, store_id)
VALUES ('".$value."', ".$productId.", 4, ".$attributeId.", ".$storeId.")
ON DUPLICATE KEY UPDATE value = '".$value."'

where $attributeId is the id of "ean" attribute from table eav_attribute

Upvotes: 1

Catalin
Catalin

Reputation: 11

As it is present under "General" tab when viewing individual products, it means that EAN is a product attribute.

Values are stored in catalog_product_entity_* tables, based on the backend type of the EAN product attribute. In case you don't know the type, you will need to check the contents of eav_attribute table for the EAN record.

A good article that explains Magento's database structure can be found here: https://fishpig.co.uk/magento/tutorials/eav-database-structure/

Upvotes: 0

Related Questions