How to Add “Add to Favorites” Button on Product List in Prestashop

In this article we will continue helping our blog and forum readers to expand default Prestаshоp functionalities.

We have noticed that one of our forum participants complained about certain difficulties, so we would like to share our solution with the community.

1Add to Favorites

For these purposes we have modified the following files in the module “Favorite products”:

  • modules/favoriteproducts/favoriteproducts.js
  • themes/default/product-list.tpl
  • modules/favoriteproducts/favoriteproducts.css
  • controllers/front/CategoryController.php (the function assignProductList())

To add information about the Favorite Product to our collection of products we need to modify the function аssignPrоduсtList().

Add the below code to the product-list.tpl template:

The last changes are applied to the module’s css file:

 

Download:

FavoriteProducts.zip

CategoryController

Product-List



8 comments

  1. How to Add “Add to Favorites” Button on “Home Featured”? How should i modify the code to use it in Home Featured?

  2. Distortion,

    Yes, it does’t work anymore for v1.6, and thank you for sharing the module adapted for v1.6 with the community.

  3. Denise,

    To make some module (which changes content on the category page) work properly with the Blocklayered module, you need to modify the Blocklayered module itself, that is, that the filters module would know about this data. But we do not describe this case in our article.

  4. Hello,
    I tried download categorycontroller but your link dont work. Do you know say me where I should add code in categorycontroller ?
    I tried add your code within “public function init()” and in “public function initContent()” but it dont work 100% good because if you reload page then Prestashop not remember favorite product added by the user(cookie) like when you come again to favorite product added in product page that show “remove”

Post a new comment

top
BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *