Get Free Audit

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

Mar 24, 2014

5137 Alex Simonchik

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:

Andrey_Dubina
Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Andrey


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


 

Download:

FavoriteProducts.zip

CategoryController

Product-List

development_prestashop

PrestaShop Development

Take your online store to the next level with BelVG PrestaShop Development

Visit the page
Andrey Dubina
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Andrey

8 Comments

  1. 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”

  2. 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.

  3. Distortion,

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

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

Post a new comment

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