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