I'm using ultimate module creator. And I created one entity.
And one of the attribute is product attribute (SKU).

Its created SKU as an attribute in back end but its not binding product SKU collection.

following function returns null array.

public function getAllOptions($withEmpty = true, $defaultValues = false){
    $source  = Mage::getModel('eav/config')->getAttribute('catalog_product', 'sku');
    return $source->getSource()->getAllOptions($withEmpty, $defaultValues);

1 Answer 1


The dropdown attributes from your custom entities that come from product attributes, work only with dropdown or multiselect product attributes.
SKU is a text attribute.
It will work with product attributes like color or country of manufacture, but not with sku or name or weight, etc.
There is no verification done when creating the module to see if the product attribute is a dropdown or multiselect because you can create a module using UMC on one instance that does not contain the attribute you want, but use it on an other instance that has it. Or you can add the product attribute later.

If you want to use the SKU in a dropdown you need to modify the method in your question.
Something like this:

protected $_options = null;
public function getAllOptions($withEmpty = true, $defaultValues = false){
    if (is_null($this->_options)) {
        $collection = Mage::getModel('catalog/product')->getCollection();
        $this->_options = array();
        foreach ($collection as $product) {
            $this->_options[] = array('value' => $product->getSku(), 'label' => $product->getSku());
    $skus = $this->_options;
    if ($withEmpty) {
        array_unshift($skus, array('label' => '', 'value'=>''));

Since SKU is a text attribute and the options for your entity are created by default with type int you need to change the type of your entity attribute to text

But I advice you do do this only if you have a few products in your website. If you have over 300-400 products this might turn into a performance killer because you have to go through the product collection each time you use this attribute.

  • @sivakumar. I was writing a solution while you were posting your comment. See my update. Maybe it fits your needs. I didn't test the code so watch out for syntax errors.
    – Marius
    Oct 16, 2014 at 8:35
  • I'm afraid it will not work with 20k products. You will see a dropdown with 20K values. It's hard to get round it. But if you insist, you can also try to cache the values from the dropdown so you won't load them each time.
    – Marius
    Oct 16, 2014 at 8:48
  • Normally we will update records from web services.but as a option they need interface in admin panel.
    – sivakumar
    Oct 16, 2014 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.