Jump to content

[solved] Add to cart in the product description


Recommended Posts

I think the easier way is use code like this:

 

<a href="#" class="add2cart" title="add to cart">Add to cart</a>
<script>
{literal}
$('.add2cart').click(function()
{
$('#add_to_cart input').trigger('click');
});
{/literal}
</script>

 

Of course <a> you can paste in description textarea on back office but javascript you should place in .tpl file.

  • Like 1
Link to comment
Share on other sites

I think the easier way is use code like this:

 

<a href="#" class="add2cart" title="add to cart">Add to cart</a>
<script>
{literal}
$('.add2cart').click(function()
{
$('#add_to_cart input').trigger('click');
});
{/literal}
</script>

 

Of course <a> you can paste in description textarea on back office but javascript you should place in .tpl file.

Thanks Krystian for your prompt reply!

I am a bit of amateur in this can you help me in getting this done...

I am not sure how to make .tpl file and link it with <a>

Link to comment
Share on other sites

go to the themes/YOUR_THEME/product.tpl

 

open it and paste there the code mentioned by Krystian

 

then in product description you will be able to use <a href="#" class="add2cart" title="add to cart">Add to cart</a>

  • Like 1
Link to comment
Share on other sites

go to the themes/YOUR_THEME/product.tpl

 

open it and paste there the code mentioned by Krystian

 

then in product description you will be able to use <a href="#" class="add2cart" title="add to cart">Add to cart</a>

 

AWESOME!!!

Works Beautifully!!!

+1 rep to you and Krystian

Link to comment
Share on other sites

×
×
  • Create New...