Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Problem to configure a config.xml file for my module
 
Gregory Tonon
Member
 
Avatar
Total Posts:  65
Joined:  2008-03-27
Toulouse
 

Hello

I develop a module to add new functions.
I want to overide the Mage_Catalog_Block_Layer_Filter_Attribute to add a new method in this class.

But in the config.xml i don’t know how to give order to magento to use my class named Compagny_Layered_Block_Catalog_Layer_Filter_Attribute instead of Mage_Catalog_Block_Layer_Filter_Attribute

Can you help me ?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gregory Tonon
Member
 
Avatar
Total Posts:  65
Joined:  2008-03-27
Toulouse
 

My current config.xml

<?xml version="1.0"?>
<global>
    <
blocks>
        <
catalog>
            <
rewrite>
                <
layer_filter_attribute>Compagny_Module_Block_Catalog_Layer_Filter_Attribute</layer_filter_attribute>
            </
rewrite>
        </
catalog>
    </
blocks>    
</global>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Gregory Tonon
Member
 
Avatar
Total Posts:  65
Joined:  2008-03-27
Toulouse
 

Yop

I found my error, i forget the <global> tag.

Now My config.xml is

<?xml version="1.0"?>
<config>
    <global>
        <
blocks>
            <
catalog>
                <
rewrite>
                    <
layer_filter_attribute>Compagny_Layered_Block_Catalog_Layer_Filter_Attribute</layer_filter_attribute>
                </
rewrite>
            </
catalog>
        </
blocks>
        <
models>
            <
eav>
                <
rewrite>
                    <
entity_attribute_source_table>Compagny_Layered_Model_Entity_Attribute_Source_Table</entity_attribute_source_table>
                </
rewrite>
                <
rewrite>
                    <
entity_attribute_option_collection>Compagny_Layered_Model_Mysql4_Entity_Attribute_Option_Collection</entity_attribute_option_collection>
                </
rewrite>
            </
eav>
        </
models>
    </global>
</
config>

But now, the rewrite rule for entity_attribute_option_collection does not work !
In the code i get the resourceModel using:

Mage::getResourceModel('eav/entity_attribute_option_collection')

How is the good rewrite rule for this resourcemodel ?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gabriel Queiroz
Sr. Member
 
Total Posts:  135
Joined:  2008-05-28
Brasília, Brazil
 

Hi,

I’m not sure, but i think it should be like this:

...
                <
rewrite>
                    <
mysql4_entity_attribute_option_collection>Compagny_Layered_Model_Mysql4_Entity_Attribute_Option_Collection</mysql4_entity_attribute_option_collection>
                </
rewrite>
...

Cheers,

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gabriel Queiroz
Sr. Member
 
Total Posts:  135
Joined:  2008-05-28
Brasília, Brazil
 

Also, I don’t know if it’s a very good idea to overload eav… sounds risky… Isn’t there any other class you could extend?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gregory Tonon
Member
 
Avatar
Total Posts:  65
Joined:  2008-03-27
Toulouse
 

Thank you Gabriel,

I used your config rewrite rule but it doesn’t work.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gregory Tonon
Member
 
Avatar
Total Posts:  65
Joined:  2008-03-27
Toulouse
 

What is a syntax for rewrite a resource model ?
Who know the answer ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gregory Tonon
Member
 
Avatar
Total Posts:  65
Joined:  2008-03-27
Toulouse
 

In fact i want the following code load my class Compagny_Module_Model_Mysql4_Entity_Attribute_Option_Collection instead of
Mage_Eav_Model_Mysql4_Entity_Attribute_Option_Collection :

Mage::getResourceModel('eav/entity_attribute_option_collection')

I’m trying many config.xml structure but at this time it’s nerver work !

Someone have an idea to resolve this problem ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gregory Tonon
Member
 
Avatar
Total Posts:  65
Joined:  2008-03-27
Toulouse
 

Yes i found a solution.

Mage::getResourceModel('layered/entity_attribute_option_collection')

Config.xml associated

<config>
    <global>
        <
models>
            <
layered>
            <class>
Compagny_Layered_Model</class>
            <
resourceModel>layered_mysql4</resourceModel>
         </
layered>
         <
layered_mysql4>
              <class>
Compagny_Layered_Model_Mysql4</class>
            </
layered_mysql4>
       </
models>
     </global>
</
config>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top