Skip to main content

Posts

Showing posts from January, 2017

Get all product attributes for a magento object using SQL

Sometimes you may want to quickly compare all of the attributes that object (category / product) has in magento. The EAV structure of the database makes this difficult to do this simply, so this is a query that will do it for you SELECT * FROM ( SELECT ce . sku , ea . attribute_id , ea . attribute_code , CASE ea . backend_type WHEN 'varchar' THEN ce_varchar . value WHEN 'int' THEN ce_int . value WHEN 'text' THEN ce_text . value WHEN 'decimal' THEN ce_decimal . value WHEN 'datetime' THEN ce_datetime . value ELSE ea . backend_type END AS value , ea . is_required AS required FROM catalog_product_entity AS ce LEFT JOIN eav_attribute AS ea ON ce . entity_type_id = ea . entity_type_id LEFT JOIN catalog_product_entity_varchar AS ce_varchar ON ce