Magento通过sql获得客户电话

时间:2014-05-28 12:42:34

标签: sql magento

如何通过sql代码获取客户的电话,

1 个答案:

答案 0 :(得分:0)

Magento基于EAV架构师 因此,如果您查看eav_attribute表,您将看到电话属性是varchar而entity_type_id是2(这意味着它是客户地址属性) 您的Sql请求可能如下所示:

select customer_address_entity_varchar.value from customer_address_entity_varchar
left join  customer_entity on customer_entity.entity_id = "your_customer_id"
left join  customer_address_entity on customer_address_entity.parent_id = customer_entity.entity_id
join eav_attribute on eav_attribute.attribute_code="telephone"
where customer_address_entity_varchar.attribute_id = eav_attribute.attribute_id