We needed to have out of stock products show for configurable products. I have managed to get this working all ok, however I have a custom attribute called fulfilment which is a select option for the products so you can set an out of stock message such Available in 7 days etc.

I need to get the attribute text in app/code/local/ModuleCompany/ModuleName/Block/Catalog/Product/View/Type.php but don't seem to be able to however I try.

Inside of getJsonConfig() method I try

    $custom_stock_attribute = Mage::getModel('catalog/product')->load($currentProduct->getId())->getAttributeText('fulfilment');

But just can't seem to get it working. So the question is how do you get attribute value of a select field from a module?

Magento Version:

  • Have you tried Mage::getModel('catalog/product')->load($currentProduct->getId())->getFulfilment(); – Kul Dec 16 '16 at 16:59
  • Yeah, have tried that too. Doesn't output anything. – Alex M Dec 16 '16 at 21:10

Usually, I have to attach a getFrontend()->getValue() on the call for dropdowns to show up for me

See if this works:

$_product = Mage::getModel('catalog/product')->load( $currentProduct->getId() )

Also, make sure you didn't mean fulfillment, instead of fulfilment.

  • Hey! Thanks for the reply! When I try that I just get 'No' as the output value. – Alex M Dec 16 '16 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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