v1.6-v1.7 Quick Tutorial To Customize "Add to cart Button"

Bin

New member
XNullUser
Joined
Dec 27, 2021
Messages
10
Reaction score
0
Points
1
NullCash
29

How to change "add to cart" button size on product page "by Milosz Myszczuk"​

You can find the tutorial at the original link page: https://mypresta.eu/en/art/developer/how-to-change-add-to-cart-button-size-on-product-page.html

Many e-shop owners, which use Prestashop store in 1.5.x versions said, that the standard template "add to cart" button located in product page is very small. I think exactly the same, so i decided to write little tutorial realted to this case. I will show you how to change button size and layout. I belive, that our tutorial will help you and you will be able to create personalized button, which will looks exactly as you want. So, lets start :)



how to change add to cart button size tutorial prestashop




We want to show you the festest & simplest way to change button size. For the first you need an access to your webservice ftp. Without ability to upload / download files from your server it isn't possible to make any change. So, if you've got an access you must download the product.tpl file located in your theme directory:



themes/_YOUR_THEME_/product.tpl



Open this file in simple text editor like windows notepad and scroll window to ~440 line. You are looking for code which looks like code I pasted below:



1
2
3
4
<p id="add_to_cart" class="buttons_bottom_block">
<span></span>
<input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" />
</p>




prestashop enlarge add to cart buttonUnderstanding the code

For a better understanding, let me explain the purpose of each part of the code that you see above.



p - defines code as a whole button.

span - it's a circle cart icon

input - it's a "add to cart" yellow button



For the first, we must edit size of "add to cart" yellow button, next we have to edit cart icon

How to do that quickly? Just edit your .tpl code. You don't have to edit external .css file source. All changes you can add here. So, let's change it!





For increase button size you need to change font-size & height param of input html tag, exactly as I show you below:

1
2
3
4
<p id="add_to_cart" class="buttons_bottom_block">
<span></span>
<input type="submit" name="Submit" value="Add to cart" class="exclusive" style="height:40px; font-size: 26px;">
</p>


As you see I added style="font-size: 26px;" code, it means that i enlarge button to 26px font size. How it looks now? You can check it on image below:






Old cart icon looks weirdy, don't you think? We can change it! So add style param to the span html tag. I want to change image to other, bigger and in other colors. You should add code i pasted below:



1
2
3
4
5
style="top: -4px;
left: -37px;
width: 48px;
height: 48px;
background: url('http://b.dryicons.com/images/icon_sets/luna_grey_icons/png/48x48/shopping_cart.png');"


you can ofcourse define own icon url. Moreover, you can personalize button by adding own background color, images, own font style, colors etc.





The final effect:



change add to cart button size and style






final code of the example:

1
2
3
4
<p id="add_to_cart" class="buttons_bottom_block">
<span style="top: -4px; left: -37px; width: 48px; height: 48px; background: url('http://b.dryicons.com/images/icon_sets/luna_grey_icons/png/48x48/shopping_cart.png');"></span>
<input type="submit" name="Submit" value="Add to cart" class="exclusive" style=" height: 40px; font-size: 26px;">
</p>
 

d-shilko

Well-known member
☆☆ Special ☆☆
☆ Pro ☆
Joined
Jun 10, 2021
Messages
2,542
Reaction score
1,536
Points
113
NullCash
4,201

How to change "add to cart" button size on product page "by Milosz Myszczuk"​

You can find the tutorial at the original link page: https://mypresta.eu/en/art/developer/how-to-change-add-to-cart-button-size-on-product-page.html

Many e-shop owners, which use Prestashop store in 1.5.x versions said, that the standard template "add to cart" button located in product page is very small. I think exactly the same, so i decided to write little tutorial realted to this case. I will show you how to change button size and layout. I belive, that our tutorial will help you and you will be able to create personalized button, which will looks exactly as you want. So, lets start :)




>
Hello. Will write it in request thread in future. This thread is for themes contribution !
 

ronyki

Member
XNullUser
Joined
Dec 26, 2021
Messages
107
Reaction score
1
Points
16
NullCash
559
nice tutorial thanks for this share
 

ronyki

Member
XNullUser
Joined
Dec 26, 2021
Messages
107
Reaction score
1
Points
16
NullCash
559
Thank you very much! Fantastic module and last version... Ty ❤️
 

sadsdf

Active member
XNullUser
Joined
Nov 24, 2019
Messages
1,243
Reaction score
4
Points
38
NullCash
227
Thank you very much for sharing !!!!
 
Top