0

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;
}
  • thanks for answer I tried But still its showing same Error – Grace Apr 28 '17 at 8:04

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.