Jump to content

Adding search results to the bottom of the product page?


lukejapanwalker

Recommended Posts

I want to add a search results to the bottom of the product page, using the title of the product as the keywords.
I know it's a bit of a crude method to add related items but I feel it should do what I need it to.

I have found "searchCatalogue" and think I just need to call this at the end of the product php, any ideas?

Thanks
Luke

Link to comment
Share on other sites

Hey bsmither,
Thanks for your reply.

I just checked out SemperFi's "Related Products".
I'd rather have the related products shown automatically from the title name of the product, as it would be terribly time consuming to assign related products to each product.
Also I'm all for purchasing extensions if they do exactly what I need, but if I can just make use of the search function I'd rather do that.

If I can't find a good way I will probably just add an iframe to the description as a last resort, but I'm sure you'd agree that is not ideal.

Link to comment
Share on other sites

The way I see this working is that you will call (not accurate statements, but rather the idea):

$search_data = array(
  'keywords' => $product['name'],
  'featured' => 1, // otherwise, do not include this line
  'inStock' => 1, // otherwise, do not include this line
  );
Catalogue->searchCatalogue($search_data);

Use the 'class.cubecart.display_product' hook in the Catalogue->displayProduct() function.

Get the result from Catalogue->_category_products.

Send each product, if desired, through Catalogue->getProductPrice() and Catalogue->productAssign().

Then assign it all to a template variable and code the template to show it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...