Hi everyone,
I apologize in advance for my english, I'm French! :mrgreen:
I am actually facing a problem with Contao search engine. I developed a module which permits to store detailed product informations and then displays those products on a frontend page. But the issue is that my page needs the product id as a GET parameter. So the URL of my page is like this one:
mywebsite.com/product-page.html?id=1
So I wanted that the search engine indexes my product pages. I used the "getSearchablePages" hook like that:
Code:
class HookSearchProducts extends Frontend
{
public function addProductPages($arrPages, $intRoot=0)
{
$objArticle = $this->Database->query("SELECT * FROM tl_produits");
$domain = $this->Environment->base;
while ($objArticle->next())
{
$newPages[] = $domain . "fiche-produit/id/" . $objArticle->id . ".html";
}
$arr = array_merge($arrPages, $newPages);
return $arr;
}
}
But it doesn't work with this way. When I manually rebuild the search index in the back-office all my product pages are listed correctly, but none of them appears in the "tl_search" table, except the page without the GET parameter.
However, words of my product pages are correctly indexed. If I search one of the words of my pages, I get a results list where the first result points to the "product-page.html" page (without any GET parameter, which doesn't display my product).
Is there any way to fix this issue?
Thanks in advance to those who reflect on my problem.
Bookmarks