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;
}

2 Answers 2

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;
}
1
  • thanks for answer I tried But still its showing same Error Apr 28, 2017 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.

Your Answer

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

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