1

I am exporting related images data from CWS Extensions extension and I am getting an error by this line.

public function getConfigurableAttributesAsArray($product = null)
{
    $res = array();
    foreach ($this->getConfigurableAttributes($product) as $attribute) {
        $res[] = array(
        'id'             => $attribute->getId(),
        'label'          => $attribute->getLabel(),
        'use_default'    => $attribute->getUseDefault(),
        'position'       => $attribute->getPosition(),
        'values'         => $attribute->getPrices() ? $attribute->getPrices() : array(),
        'attribute_id'   => $attribute->getProductAttribute()->getId(), // i am getting  error in this line
        'attribute_code' => $attribute->getProductAttribute()->getAttributeCode(),
        'frontend_label' => $attribute->getProductAttribute()->getFrontend()->getLabel(),
        'store_label'    => $attribute->getProductAttribute()->getStoreLabel(),
        );
    }

    return $res;
}
0

Check current product is configurable product or not

public function getConfigurableAttributesAsArray($product = null)
{
    $res = array();
    if (Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE == $product->getTypeId()) {
        foreach ($this->getConfigurableAttributes($product) as $attribute) {
            $res[] = array(
                'id'             => $attribute->getId(),
                'label'          => $attribute->getLabel(),
                'use_default'    => $attribute->getUseDefault(),
                'position'       => $attribute->getPosition(),
                'values'         => $attribute->getPrices() ? $attribute->getPrices() : array(),
                'attribute_id'   => $attribute->getProductAttribute()->getId(), // i am getting  error in this line
                'attribute_code' => $attribute->getProductAttribute()->getAttributeCode(),
                'frontend_label' => $attribute->getProductAttribute()->getFrontend()->getLabel(),
                'store_label'    => $attribute->getProductAttribute()->getStoreLabel(),
                );
        }
    }
    return $res;
}
| improve this answer | |
  • thanks for answer I tried But still its showing same Error – Grace Apr 28 '17 at 8:04
0

Pretty sure that you have deleted an attribute that was still used for configurable products. Examine on which attribute you get the error, and remove it from your configurable products.

| improve this answer | |

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.