I'm trying to get all configurable attributes of a configurable product.
$product_attributes = $_product->getTypeInstance(true)->getConfigurableAttributesAsArray($_product)
So far it worked properly, but suddenly it showed an error message
Call to a member function getId() on a non-object in app/code/core/Mage /Catalog/Model/Product/Type/Configurable.php and I have no idea of what's going on.
I tried to debug and in
$this->getConfigurableAttributes($product) returns 3 attributes but the first one doesn't belong to the product
$attribute->getProductAttribute() returns null, therefore,
$attribute->getProductAttribute()->getId() caused the problem, crashed the app.
If anyone suffered this issue, please tell me what's going on. Any help will always be appreciated.