自定义客户文件属性

时间:2013-01-09 11:46:40

标签: php magento magento-1.7

我在magento管理面板的customers部分中有一个自定义属性,管理员可以在其中上传每个客户唯一的文件。

我需要一种方法在前端显示这个文件,从而允许他们下载它。 允许上传文件的模块是由我的同事使用模块创建者创建的。链接:http://www.silksoftware.com/magento-module-creator/

如果有人有任何关于此事的信息,可以对此有所了解。我将非常感激。

Magento版本:1.7

此致

儒略

1 个答案:

答案 0 :(得分:1)

您可以加载客户集合,告诉它选择所有属性(或者如果您知道属性代码,请使用它),然后按客户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();
相关问题