Magento: programmatic search depending on store

saad999

New Member
I'm using the catalogsearch module of Magento. I have 2 stores. When searching "test" on the first one, I get 5 results. When searching "test" on the second one, I get 3 results. I'd like to add the results of the second store (just the number of results) when I search in the first one.I added a block and a template, all I need is the code to retrieve the number of the results in the second store, and that's where I'm stucked.I tried to get the controller code, but it always returns me the number of results in the first store :\[quote\] private function _getStoreQuery($storeId) {\[code\] $query = Mage::helper('catalogSearch')->getQuery(); $query->setStoreId(7); if ($query->getQueryText()) { if (Mage::helper('catalogSearch')->isMinQueryLength())\[/code\] { $query->setId(0) ->setIsActive(1) ->setIsProcessed(1); } else { if ($query->getId()) { $query->setPopularity($query->getPopularity()+1); } else { $query->setPopularity(1); }\[code\] $query->prepare(); } Mage::helper('catalogSearch')->checkNotes(); if (!Mage::helper('catalogSearch')->isMinQueryLength())\[/code\] { $query->save(); } }\[code\] var_dump($query); return $query; }\[/code\]\[/quote\]I also tried to change the store context before, but no luck:Mage::app()->setCurrentStore($secondStoreId);Do you have any idea? Thanks
 
Back
Top