Jump to content

how to add 'add to cart button' on favorite products


Wouter van der Horst

Recommended Posts

I have version 1.6.1.10 

 

i will have a button by products in the list. 

but it does not work

 

I have try the next:

 

edit file: modules/favoriteproducts/views/templates/front/favoriteproducts-account.tpl

and add the red code:


{foreach from=$favoriteProducts item=favoriteProduct}
<div class="favoriteproduct clearfix">
<a href="{$link->getProductLink($favoriteProduct.id_product, null, null, null, null, $favoriteProduct.id_shop)|escape:'htmlall':'UTF-8'}" class="product_img_link">
<img src="{$link->getImageLink($favoriteProduct.link_rewrite, $favoriteProduct.image, 'medium_default')|escape:'htmlall':'UTF-8'}" alt=""/></a>
<h3><a href="{$link->getProductLink($favoriteProduct.id_product, null, null, null, null, $favoriteProduct.id_shop)|escape:'htmlall':'UTF-8'}">{$favoriteProduct.name|escape:'htmlall':'UTF-8'}</a></h3>
<div class="product_desc">{$favoriteProduct.description_short|strip_tags|escape:'htmlall':'UTF-8'}</div>


<a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$favoriteProduct.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$favoriteProduct.id_product|intval}", false)}" title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a>

<div class="remove">
...

This does basically the job, but there should maybe be added some code for tests when exactly you can enable/ should disable the button, like when the shop is in catalog mode, the product is out of stock, if there are selectable attributes to choose first etc. This I didn't do. There are probably some sample files where they do this already.

Edited by Wouter van der Horst (see edit history)
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...