Jump to content

How to add "Add to favorites" button on product list?


Recommended Posts

Hello,

 

I want to add an "Add to favorites" button, just like in product.tpl, but on each product in product-list.tpl

I've searched everywhere, but I didn't find a solution. Can someone helps me about this? I would like to have 2 buttons on each product in the list : add to cart and save to favorites (not the wishlist)

 

Thank you in advance.

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 1 month later...
  • 2 weeks later...

Hi there, 

 

Our team help you resolve your problem. Take a look: http://belvg.info/demo/prestashop/pricematch/index.php?id_category=4&controller=category&id_lang=1. (you must be logged in http://storage6.static.itmages.com/i/14/0309/h_1394368628_3219273_9339fa34ee.png) Follow our blog and you know how do that  :)

 

Regards

Edited by Alexander Simonchik (see edit history)
  • Like 2

Share this post


Link to post
Share on other sites

  • 3 weeks later...

 

thanks!

 

I am a bit confused, I was testing and I see the add to favorites...but after that I do not see where to access what I added to favorites...thanks in advance for your patience answering this.

Share this post


Link to post
Share on other sites

thanks!

 

I am a bit confused, I was testing and I see the add to favorites...but after that I do not see where to access what I added to favorites...thanks in advance for your patience answering this.

 

Mm, if it is the same as my site..then you should be able to find it by clicking on "My Account" usually in the first column of the footer and click :my favourite products". Must be logged in. :)

  • Like 1

Share this post


Link to post
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

I followed your tutorial and this is what i got :

 

164428Sanstitre1.jpg

 

 

This is only plain text clicking on it doesn't make actions.

Here is the output from my web brower :

<ul class="fv_block" id="fv_block_8">
    <li class="pl_favoriteproducts_block_extra_add" rel="8">
         Add this product to my list of favorites.
    </li>
    <li class="pl_favoriteproducts_block_extra_added" rel="8">
        Remove this product from my favorite's list. 
    </li>
    <li class="pl_favoriteproducts_block_extra_removed" rel="8">
        Add this product to my list of favorites.
    </li>
</ul>

I checked in the header the link to the JavaScript file is inclued

Share this post


Link to post
Share on other sites

  • 2 weeks later...

Now fixed for Ps 1.6, my bad. Was a problem of class and id's in CSS and Javascript.

 

If someone need, i give my favoriteproduct module, the productlist.tpl and productlist.css

 

But there is still a problem I think. On the product list page after you click twice on the add to favorites it stops working.

 

Add » Remove » Add (stops at this point)

Edited by boragursel (see edit history)

Share this post


Link to post
Share on other sites

But there is still a problem I think. On the product list page after you click twice on the add to favorites it stops working.

 

Add » Remove » Add (stops at this point)

 

This is a problem with the CSS, that's for sure. I am working on it.

Share this post


Link to post
Share on other sites

On the file "favoriteproduct2.js, check the line 150 and remove the unnecessary dot.

Change css inthe file "favoriteproduct.css" too :

.ajout,.del {
 padding-left:0px;
   /* background:url(http://127.0.0.1/prestashop/modules/favoriteproducts/img/add_favorite.gif) no-repeat 0 0;*/
cursor: pointer;
font-weight: bold;
color: #777676;
font-family: FontAwesome;
font-size:1.1em;
 }
 .ajout:hover,.del:hover,.ajoute:hover,.suprime:hover {
color:black;
}
 .ajoute,.suprime {
 padding-left:0px;
    cursor: pointer;
    font-size:1.1em;
    font-family:FontAwesome;
    color: #777676;
    font-weight:bold;
    display: none;
    }    
.ajoute:before,.del:before {
content: "\f004";
font-family: FontAwesome;
color: #777676;
cursor: pointer;
}
.suprime:before,.ajout:before {
content: "\f08a";
font-family: FontAwesome;
color: #777676;
cursor: pointer;
}
.ajoute:hover:before,.del:hover:before,.ajout:hover:before,.suprime:hover:before {
color: black;
}


Edited by A_Distortion (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

  • 2 weeks later...

And I have another question related with the subject and couldn't find a solution anywhere. I need to add social share buttons under the add to favorites button for every product on product list page. Has anyone tried to do and found a solution?

Edited by boragursel (see edit history)

Share this post


Link to post
Share on other sites

  • 5 months later...

First of all many thanks to Alex Simonchik, A_Distortion and other discussion makers

 

Now fixed for Ps 1.6, my bad. Was a problem of class and id's in CSS and Javascript.

 

If someone need, i give my favoriteproduct module, the productlist.tpl and productlist.css

 

For Prestashop 1.6.0.9.  (default-bootstrap)

My idea was to get this feature (Favourite products) for the user who could mark  interesting products and place them to his favourites area  (like a short memory during session). 

 

1. I tried the module prepared by  of A_Distortion.

It works for sure placing required button and string (Add this to my favourite products) onto product's container on the list of products

 

2. How to make the button and link enabled  for the customers not logged in . 

I trace through the module and find  the following  inside     /modules/favoriteproducts/favouriteproducts.php

public function hookDisplayLeftColumnProduct($params)
	{
		include_once(dirname(__FILE__).'/FavoriteProduct.php');

		$this->smarty->assign(array(
			'isCustomerFavoriteProduct' => (FavoriteProduct::isCustomerFavoriteProduct($this->context->customer->id, Tools::getValue('id_product')) ? 1 : 0),
			'isLogged' => (int)$this->context->customer->logged,
		));
		return $this->display(__FILE__, 'favoriteproducts-extra.tpl');
	}

I feel that it is here.  

But I have no experience in php  - how to change it.   :wacko:

 

3. After enabling changes proposed in this topic (CategoryController.php , product-list.tpl and A_Distortion version of favourite products module ) I have found that  

Quick search (blocksearch)  did not work as ajax.

It is searching just after clicking Go button.

When I disabled favouriteproducts module - quicksearch works again

 

Any idea how does this effect work?

 

 

NB: If anybody knows other decisions - how to give the easy tool to the customer = to keep favourite products during browsing session - it would be great. 

 

Thank You in advance

 

Share this post


Link to post
Share on other sites

I no longer have access to PrestaShop.

The code you posted stores 2 values in smarty with the array (the id of the related product, and if the user is logged or not). Smarty allow you to share values between PHP functions and the TPL files which generates the output for the display in the browser. So, if you cange this code this will not have effects.

You have to look for code inside the 'favoriteproducts-extra.tpl' like "if(logged)" before the code for favorite product, but i guess this will be harder than that.

 

If you enable the default  favorite-product module, does your quicksearch works ?

 

Hope that helps.

Sorry for bad english, not my native language

Edited by A_Distortion (see edit history)

Share this post


Link to post
Share on other sites

  • 3 years later...
On 05/05/2014 at 2:59 PM, A_Distortion said:

Now fixed for Ps 1.6, my bad. Was a problem of class and id's in CSS and Javascript.

 

If someone need, i give my favoriteproduct module, the productlist.tpl and productlist.css

favoriteproducts.tar.gz

I have tested and try hard to implement your files but doesn't work for me :( 
and i need so bad...can someone give a light about this?

Share this post


Link to post
Share on other sites

  • 3 months later...
On 11.4.2018 at 11:11 AM, aleprestasuri said:

The download link are down. Can you reupload, please?
Can anybody help me, please?

Which download link ? This is not a module. This is a tutorial on how you can change files. The link to the site is still working for me.

https://belvg.com/blog/how-to-create-a-wishlist-on-a-category-page-in-prestashop.html

also the download of both files fixing the tutorial for PS 1.6. is working:

favoriteproducts.tar.gz

 

 

Share this post


Link to post
Share on other sites

En 13/4/2018 a las 6:57 PM, selectshop.at dijo:

Which download link ? This is not a module. This is a tutorial on how you can change files. The link to the site is still working for me.

https://belvg.com/blog/how-to-create-a-wishlist-on-a-category-page-in-prestashop.html

also the download of both files fixing the tutorial for PS 1.6. is working:

favoriteproducts.tar.gz

 

 

 

Thanks for answering.

But... How can i add a delete/remove button from the favorite list in product page? If you click in favorite button that appear a text or another icon for remove the product recently added to favorite list.

Thanks again, regards.

 

Share this post


Link to post
Share on other sites

  • 3 months later...
On 24/03/2014 at 3:25 PM, Alex Simonchik BelVG said:

Hi,

Thank you for the solution. That's what I needed for my website. It works well, but on pages like "special offers", "new products" or a result page after doing a search, the add-to-favorites button doesn't display. Anybody know how to make it show on thoses pages as well?

Thanks in advance.

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More