0
votes

I have a custom attribute in the customers section in the magento's admin panel where the admin can upload a file unique to each customer.

I need a way to display this file in the front end thus allowing them to download it. The module that enables the upload of the file was created by my colleague using a module creater. Link: http://www.silksoftware.com/magento-module-creator/

If anyone has any information regarding this matter and could shed some light on this. I would be very grateful.

Magento version: 1.7

Regards,

Julian

1
are you able to upload the file successfully? - Sumit Malik

1 Answers

1
votes

You can load the customer collection, tell it to select all attributes (or if you know the attribute code, use that) and then filter by customer 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();

From the var_dump, you should be able to see the attribute you want to see, then its just a call to...

 $myAttributeName = Mage::getModel('customer/customer')->load(185)->getMyAttributeCode()->getName();