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

Create own Mage_CatalogSearch_Model_Advanced
 
laccas
Member
 
Total Posts:  39
Joined:  2010-08-08
 

Hi there! I have an interesting issue with extending the Mage_CatalogSearch_Model_Advanced class.

When I’m calling my class in the extended Mage_CatalogSearch_AdvancedController (code below), the attributes are magically droping out from the query.

in TLSoft/AdvancedSearch/controllers/AdvancedController.php

require_once "Mage/CatalogSearch/controllers/AdvancedController.php";
class 
TLSoft_AdvancedSearch_AdvancedController extends Mage_CatalogSearch_AdvancedController
{

    
public function resultAction()
    
{
        $this
->loadLayout();
        try 
{
            Mage
::getSingleton('tlcatalogsearch/advanced')->addFilters($this->getRequest()->getQuery());
        
catch (Mage_Core_Exception $e{
            Mage
::getSingleton('catalogsearch/session')->addError($e->getMessage());
            
$this->_redirectError(
                
Mage::getModel('core/url')
                    ->
setQueryParams($this->getRequest()->getQuery())
                    ->
getUrl('*/*/')
            );
        
}
        $this
->_initLayoutMessages('catalog/session');
        
$this->renderLayout();
    
}

}

in TLSoft
/AdvancedSearch/Model/Advanced.php

<?php
class TLSoft_AdvancedSearch_Model_Advanced extends Mage_CatalogSearch_Model_Advanced
{
}

Is there a different approach for extending classes when it’s called by the getSingleton() function?

 
Magento Community Magento Community
Magento Community
Magento Community
 
laccas
Member
 
Total Posts:  39
Joined:  2010-08-08
 

I think I’ve finally figured it out. I also have to extend the Mage_CatalogSearch_Block_Advanced_Result class!

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