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

Model overload
 
Daim
Sr. Member
 
Total Posts:  172
Joined:  2008-01-08
Germany
 

Hello,

i will not direct hack in the core of Magento and search for a solution to overload the “Mage_CatalogSearch_Model_Advanced” Model.
I use the Magentoserach and found a few informations for this topic but this not work for me :(

My Modul is CatalogSearchCustom and is saved in /app/local/Mage/CatalogSearchCustom

config.xml

<models>
      <
catalogsearchcustom>
        <class>
Mage_CatalogSearchCustom_Model</class> 
      </
catalogsearchcustom>
      <
catalogsearch>
            <
rewrite>
                 <
advanced>Mage_CatalogSearchCustom_Model_Advanced</advanced>
            </
rewrite>
      </
catalogsearch>
    </
models>

Mage_All.xml

<Mage_CatalogSearchCustom>
            <
active>true</active>
            <
codePool>local</codePool>
        </
Mage_CatalogSearchCustom>

Advanced.php

class Mage_CatalogSearchCustom_Model_Advanced extends Mage_CatalogSearch_Model_Advanced
{

    
public function getProductCollection(){
     
...
   
}
}

What is wrong? The method is not overload :(
I the Attachments you see me complete sourcecode.

Thanks Daim

Image Attachments
Bild 1.png
File Attachments
daim.zip  (File Size: 18KB - Downloads: 58)
 
Magento Community Magento Community
Magento Community
Magento Community
 
Daim
Sr. Member
 
Total Posts:  172
Joined:  2008-01-08
Germany
 

nobody?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tweakmag
Guru
 
Avatar
Total Posts:  307
Joined:  2007-08-31
London, UK
 

the xml you put in Mage_All.xml is better saved in its own file - Mage_Catalogsearchcustom.xml (in the same directory as Mage_All.xml). As you said we shouldn’t overwrite any core files. I am not sure whether this will help with your problem though.

Cheers
Adam

 
Magento Community Magento Community
Magento Community
Magento Community
 
Daim
Sr. Member
 
Total Posts:  172
Joined:  2008-01-08
Germany
 

With the Mage_Catalogsearchcustom.xml is my fault. But my module don’t override the Class Mage_CatalogSearch_Model_Advanced. I am trying to customize some code (the method getProductCollection() as example) in this Class.

EDIT:
Sorry was my fault in the template. Tn this one templatefile i don’t use getModel wink but “new Mage_CatalogS();”

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top