0

I have a problem to override Mage_Catalog_Model_Resource_Product_Attribute_Backend_Media.

Here is what I did:

config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Xx_Catalog>
      <version>0.1.0</version>
    </Xx_Catalog>
  </modules>
  <global>
    <models>
      <xx_catalog>
        <class>Xx_Catalog_Model</class>
      </xx_catalog>
      <catalog_resource>
        <rewrite>
          <product_attribute_backend_media>
        Xx_Catalog_Model_Resource_Product_Attribute_Backend_Media
          </product_attribute_backend_media>
        </rewrite>
      </catalog_resource>
    </models>
</global>

Media.php

class Xx_Catalog_Model_Resource_Product_Attribute_Backend_Media extends Mage_Catalog_Model_Resource_Product_Attribute_Backend_Media
{
  public function loadGallery($product, $object){
    echo "test";
    die();
  }
}

And here is the error:

Fatal error: Call to a member function loadGallery() on a non-object in /magento/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php on line 51`

Do you know how to override this class?
I have Magento 1.9.3.3

Thanks

1

1 Answer 1

0

Still no answer ...

I tried to change catalog_resource to catalog_resource_eav_mysql4, but I got the same error:

  <catalog_resource_eav_mysql4>
    <rewrite>
      <product_attribute_backend_media>Xx_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Backend_Media</product_attribute_backend_media>
    </rewrite>
  </catalog_resource_eav_mysql4>

Error is the same:

Fatal error: Call to a member function loadGallery() on a non-object in /magento/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php on line 51

Your Answer

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

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