【问题标题】:Custom customer file attribute自定义客户文件属性
【发布时间】:2013-01-09 11:46:40
【问题描述】:

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

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

如果有人有任何关于这件事的信息并且可以对此有所了解。我将不胜感激。

Magento 版本:1.7

问候,

朱利安

【问题讨论】:

  • 文件上传成功了吗?

标签: php magento magento-1.7


【解决方案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();

【讨论】:

    猜你喜欢
    • 2015-06-25
    • 2023-03-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-27
    • 2011-09-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多