【发布时间】:2017-04-20 00:00:03
【问题描述】:
我在后端 magento 中创建了一个客户属性,但我想将此属性显示给用户,以便他可以在前端更改其值。我的输入字段显示在前端,但值不存在。我无法得到这个值。我发现我需要显示的值在 apscustomer_entity_varchar 表中,该列称为“值”。如何从该表中获取该值?我正在尝试这个:
$collection = Mage::getModel('eav/entity_attribute')->getCollection();
foreach ($collection as $data) {
return $data;
}
但它不起作用,所以我使用了 SQL 代码并且它起作用了。但是我知道这不是在 Magento 中做到这一点的好方法。我所做的是这样的:
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
$sql = "SELECT * FROM `apscustomer_entity_varchar ` WHERE `entity_id`='$id'";
$rows = $connection->fetchAll($sql);
如何使用 getModel 以 magento 方式从我的 apscustomer_entity_varchar 表中获取值列?
【问题讨论】: