Forum

Thread tagged as: Shop

Search products using keys

Hi,

how can I add search to Perch Shop. to search for products. e.g.: search for 'jumper'

thanks in advance

tony

Tony Monckton

Tony Monckton 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Products are included in the standard search functionality.

https://docs.grabaperch.com/functions/search/

I've read the docs, but not sure how to specify the parms:

would the below php search shop products?

i'm using: 'from-path'=>'/perch_shop_products' and 'template'=>'perch/templates/shop/products/list.html'

many thanks in advance.

tony

<?php
  $query = perch_get('q');
  perch_content_search($query, array(
    'count'=>5,
    'from-path'=>'/perch_shop_products',
    'excerpt-chars'=>300,
    'template'=>'perch/templates/shop/products/list.html'
  ));
?>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, the path doesn't affect the ability to search products. Products are always searched.

The only way they'd not be is if you specified a list of apps to limit the search to.