我在magento的管理面板中的客户部分中有一个自定义属性,管理员可以在其中上传每个客户唯一的文件。
我需要一种方法来显示这个文件在前端,从而允许他们下载它。允许上传文件的模块是由我的同事使用模块创建器创建的。链接:http://www.silksoftware.com/magento-module-creator/
如果有人有关于这件事的任何信息,可以阐明这一点。我将非常感激。
Magento版本: 1.7
问候,朱利安
您可以加载客户集合,告诉它选择所有属性(或者如果您知道属性代码,则使用该属性),然后按客户id进行过滤…
$customerId = 1;
$customer = Mage::getModel('customer/customer')
->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('entity_id', array('eq' => $customerId))
->getFirstItem();
// There may be a better way, but i've found that using the collection method returns all attributes easily.
var_dump($customer);
die();
从var_dump中,你应该能够看到你想要看到的属性,然后它只是一个调用…
$myAttributeName = Mage::getModel('customer/customer')->load(185)->getMyAttributeCode()->getName();