Skip to content

Instantly share code, notes, and snippets.

@mschultheiss83
Created February 21, 2013 15:35
Show Gist options
  • Save mschultheiss83/5005521 to your computer and use it in GitHub Desktop.
Save mschultheiss83/5005521 to your computer and use it in GitHub Desktop.
Get product eav entries
use your_databasse;
set @attribute_code = 'name';
set @entity_type_id = '4';
set @entity_id = '502';
set @backend_type =
(select backend_type
from eav_attribute
where attribute_code = @attribute_code and
entity_type_id = @entity_type_id);
set @attribute_id =
(select attribute_id
from eav_attribute
where attribute_code = @attribute_code and
entity_type_id = @entity_type_id);
set @select_attribute :=
CONCAT(
'SELECT * FROM ',
CONCAT('catalog_product_entity', '_', @backend_type), ' ',
CONCAT('WHERE attribute_id = ', @attribute_id, ' AND ' ,
'entity_id = ', @entity_id)
);
select @select_attribute;
Prepare stmt FROM @select_attribute;
Execute stmt;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment