How to change "add to cart" button size on product page

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, tet 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:

prestashop add to cart change size

 

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>

 

 

Share your button, show us how your button looks!

If you changed own add to cart button - add link to your shop in comments, we want to check how awesome it is! :)

 

author milos myszczuk
Article by Milosz Myszczuk PrestaShop expert, official PrestaShop community moderator. PHP developer, specialist in relative and spatial databases management, GIS Analyst, CEO & founder of VEKIA interactive agency. Read more about VEKIA company
If you like my articles and want much more valuable tips, feel free to send me donation
1.4 version 1.4.11 1.6 404 addon admin advertise ahref ajax alpha animation api app application authentication back office backup badge banner basics block bootstrap button cache carrier cart catalog category certificate changelog chat class clear client clip cms code colors columns comments configuration contact container content controller cookie counter country coupon css csv currency customer dashboard database debug default delete delivery desktop developer device disable discount displayNav displayTop download dynamic editor effect empty encrypt engine error exchange exclude export facebook faceshop fade fancoupon fancybox fanpage fatal feature feed field file fix fixed font footer free friendly url front ftp full gallery generate gift global godaddy google google+ gray grid groupon header help hide highlight homefeatured homepage hook hosting hover howto htaccess html html5 ID image import include input instagram installation integration iPhone issue javascript jquery kgb knowhow languages law left likebox link list livingsocial loading log login logo loyality mail mailing maintenance manufacturer marketing marquee mcrypt menu meta mobile modification module movie moving multilanguage multiupload must have mysql news newsletter notification number open graph order override page password performance PHP phpmyadmin picture pinterest plugin popup post prestashop prestashop 1.0 prestashop 1.1 prestashop 1.2 prestashop 1.3 prestashop 1.4 prestashop 1.5 price rules problem product profile promotion proslider purifier quantity query quick tip random rates register reinsurance release reporting reset responsive restore results ribbon rich text right sales search security seo service shadow share shipping shop shopmania slider smarty social networks SQL SSL statistics stock store style subcategory superuser support switcher tab tablet tag tax template text theme tinyMCE tips and tricks tpl tracking translations tree trends trigger tumblr tutorial twitter update upgrade upload variables video visits voucher vulnerability web2print wide widget width window wishlist wysiwyg youtube zip zopim