Jump to content

Layer navigation on custom product list


Recommended Posts

Hello,

I would like to apply a layer navigation (ps_facetedsearch) on a custom products list (a custom module). I'm on prestashop 1.7. What I have to add to make it ?

I can see all my selection of products on my template (99% the same of products.tpl), it's ok, but no filters.

My listing, $product_list is an array of products id. My products list is ok on my custom template, but i don't know, what I have to do for filters.

    $listing['products'] = json_decode(json_encode($product_list), true);
    $listing['rendered_facets']="Filtrer par";   
    $listing['rendered_active_filters']="";   
    $listing['label']="Resultats de recherche";   
    $listing['js_enabled']=false;
    $listing["sort_orders"]=array(array("entity" => "product",
                                        "field" => "position",
                                        "direction" => "asc",
                                        "label" => "Pertinence",
                                        "urlParameter" => "product.position.asc",
                                        "current" => true,
                                        "url" => "?order=product.position.asc"));
    $listing["facetCollection"]=array("facets" =>array("label" => "Catégories", "type" => "category", "displayed" => true));



    $this->context->smarty->assign("listing", $listing);

I think, I have to add list of my filters, include PS_facetedsearch on my custom module ?

Thanks you !

 

Link to comment
Share on other sites

Hi,

You can read the folowing article ( in french ) on how to manage a layered navigation on ps 1.7
https://www.h-hennes.fr/blog/2018/08/08/prestashop-1-7-ajouter-une-navigation-a-facettes-dans-les-listings
Unfortunately if your custom listing is not related to a category you won't be able to use the ps_facetsearch module, but you'll need to create your own implementation.

Regards,

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...