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

Small search
 
Daim
Sr. Member
 
Total Posts:  172
Joined:  2008-01-08
Germany
 

I will add at the end of the product details view a small resultlist.

$bi = array(
"name" => "PMM2");

$tets Mage::getSingleton('catalogsearch/advanced')->addFilters($bi);

foreach (
$tets as $item
    
{
        
echo $item->getName();
    
}

I only will search by the attribute “name”. But i become a wrong collection back? Because i become the Message “Call to a member function getName() on a non-object in...”

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

Solution

$bi = array(
"name" => "PMM2");

$tets = new Mage_CatalogSearch_Model_Advanced();
$bla $tets->addFilters($bi)->getProductCollection()->load();


foreach (
$bla as $item
    
{
        
echo "Name: ".$item->getName()."<br>";
        echo 
"SKU: ".$item->getsku()."<br>";
    
}
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top