| Author | Message |
|---|---|
|
Written on: 15. 12. 2009 [18:50]
|
|
|
stwsimon
Simon Browning
Topic creator
registered since: 20.11.2009
Posts: 13
|
Thanks for that. Still doesn't work for some reason, I get a whoops page. Still fiddling. |
|
Written on: 15. 12. 2009 [20:22]
|
|
|
stwsimon
Simon Browning
Topic creator
registered since: 20.11.2009
Posts: 13
|
Hi Patrick. Were you able to get that to work? I'm wondering if the querystring, which currenly is: http://.../search-results.html?q=guitar&tx_ansearchit_form[submit]=OK should be more like the shop urls (ie tx_fbmagento[shop][id]= rather then q=) Simon [This article was edited 1 times, at last 15.12.2009 at 20:23.] |
|
Written on: 18. 12. 2009 [12:12]
|
|
|
trikr
Patrik Remmele
registered since: 30.11.2009
Posts: 9
|
stwsimon wrote: Thanks for that. Still doesn't work for some reason, I get a whoops page. Still fiddling. you need to submit some search query for some result stwsimon wrote: Were you able to get that to work? This is copy&pasted from www.eswe.de - up and running |
|
Written on: 16. 03. 2010 [14:50]
|
|
|
september
Jan
registered since: 12.03.2010
Posts: 2
|
heya, same problem here, just can't get the serach function to work :-/ any advice other than the ones posted above? thanks for reading [This article was edited 1 times, at last 16.03.2010 at 14:51.] |
|
Written on: 17. 11. 2010 [16:30]
|
|
|
flip.flap
Oliver Schmid
registered since: 17.11.2010
Posts: 4
|
Hi Does the search function find Magento products and TYPO3 Articles that way? Thanks Oli |
|
Written on: 24. 11. 2010 [09:28]
|
|
|
erik.dahlin
erik
registered since: 02.11.2010
Posts: 11
|
I've been using an index_search xclass to include the magento search. That way I can integrate the results with typo3 and configure different rootcategories for my searches (for multiple sites in the same installation). Might not be the best approach but its easy, does the job and is highly customizable. Heres the code: PHP /**
* Performes the search in magento
* @param array $search - Search array params from index search
* @return string - Html result list from magento
*/
private function magentoSearch($search) {
require_once(t3lib_extmgm::extPath('fb_magento').'lib/class.tx_fbmagento_tools.php');
require_once(t3lib_extmgm::extPath('fb_magento').'lib/class.tx_fbmagento_interface.php');
$emConf = tx_fbmagento_tools::getExtConfig();
$mage = tx_fbmagento_interface::getInstance( $emConf );
$mage->setTsConfig($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_fbmagento_pi1.']);
foreach ($search as $s)
{
$sWord .= $s['sword'].' ';
}
$params = array(
'route' => 'catalogsearch',
'controller' => 'result',
'action' => 'index',
'q' => $sWord
);
$mage->dispatch($params);
$resultList = $mage->getBlock('content')->getChild('search.result')->getChild('search_result_list');
$productCollection = $resultList->getLoadedProductCollection();
$productsArray = array();
$collection = Mage::getResourceModel('catalog/product_collection');
foreach ($productCollection as $product)
{
$categoryIds = $product->getAvailableInCategories();
if (in_array($this->conf['magentoRoot'], $categoryIds)) {
$productsArray[] = $product->getId();
}
}
$collection->addIdFilter($productsArray);
$collection->addAttributeToSelect('*');
$collection->load();
$resultList->setCollection($collection);
$content = $resultList->renderView();
return $content;
}And then call the function in index search main() (around line 195) PHP // Do search:
// If there were any search words entered...
if (is_array($this->sWArr)) {
$content .= $this->doSearch($this->sWArr);
if ($this->conf['magento']) {
$content .= '<div class="tx-fbmagento">'.$this->magentoSearch($this->sWArr).'</div>';
}
}As you can see, for this piece of code to work properly you'll need to configure it through typoscript. Something like: TYPOSCRIPT #activate the magento search plugin.tx_indexsearch.magento = 1 #Root category id in magento for where to do the search plugin.tx_indexsearch.magentoRoot = 2 |
|
Written on: 24. 11. 2010 [09:54]
|
|
|
flip.flap
Oliver Schmid
registered since: 17.11.2010
Posts: 4
|
Super, I may try this. Thanks Erik |