Page 1 of 1

Add to cart button

Posted: Fri Jan 28, 2011 1:08 am
by oc5
i'm wondering how to change the add to cart button image, it is so small, i would prefer a wide rectangle one if possible, i tried to replace the image file, but it only show a small tall rectangle, can somebody help me please thank you, :)

Re: Add to cart button

Posted: Fri Jan 28, 2011 2:59 am
by Chones
You need to change the images button_left.png and button_right.png

Then in the stylesheet, in .button span, you need to change the padding
The default is padding: 4px 12px 5px 5px;

It goes round like a clock, so first is top, then right, bottom and left.

To widen the button you could therefore try padding: 4px 24px 5px 17px;

Re: Add to cart button

Posted: Fri Jan 28, 2011 11:57 am
by oc5
Hi Chones, glad to hear from you again & thanks for your replied :) the button i mention are not the one when viewing the product then add to cart, but the one in the Latest Product/Featured, with the (Little Plus Sign at each product's right bottom) +. :)

Re: Add to cart button

Posted: Fri Jan 28, 2011 3:16 pm
by Chones
Ah, sorry. You need to change the styles for .button_add_small

If you're making it much bigger it might be worth also adding some text in each template too. Instead of

Code: Select all

<a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" >&nbsp;</a>
Use

Code: Select all

<a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" >Add to Cart</a>
Hope that helps.

Re: Add to cart button

Posted: Fri Jan 28, 2011 7:00 pm
by oc5
Hi Chones,
It helps :) You are genius :) Thank you very much for your help, it fits perfectly what i wanted to :D much appreciate :)

Re: Add to cart button

Posted: Sun Jan 30, 2011 1:28 pm
by Sidecutter
Hi Chones, I found this thread and was hoping you could help me as well. I want to take that same tiny little "add to Cart" button, replace it with a much more reasonably sized (and themed) button, and drop it down one line so it is under the product price instead of to the right of the product's price.

Can you point me to the right files and changes for this, other than simply replacing the button?

I also want to replace the Add to Cart button on the detailed product page with a variation on this same button, but as that one seems to be composed of several elements I'm not sure what all needs changing.

Any help will be greatly appreciated!

Re: Add to cart button

Posted: Sun Jan 30, 2011 5:53 pm
by Chones
Hi Sidecutter, the small Add to cart is added using this code

Code: Select all

<a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" >&nbsp;</a>
You will find it, or something very similar, in the category template, product template, and most of the module templates.
You can change it to a big button by copying one of the other buttons - so basically giving it the class "button" and adding a <span>, like this.

Code: Select all

<a class="button" href="<?php echo $products[$j]['add']; ?>"><span><?php echo $button_add_to_cart; ?></span></a>
Notice I also removed the title, and used it for the text on the button instead.

Re: Add to cart button

Posted: Mon Jan 31, 2011 12:24 am
by Sidecutter
Hi Chones,

Thank you. What I actually want to do though is substitute an image of my own which already exists, and has the text embedded in it as part of the image, not to have it replicate the large button button which is created on the fly by the cart. I want to use this same button in place of the one the cart generates on the product page. Would it help if I was to do a quick mockup in photoshop?

Re: Add to cart button

Posted: Tue Feb 01, 2011 2:18 am
by Chones
Hi Sidecutter,

Just edit the .button_add_small style in the stylesheet, and give it enough padding so that it is big enough to show your whole image e.g. padding: 5px 12px 5px 12px;

That should do it.

Re: Add to cart button

Posted: Wed Feb 02, 2011 9:48 am
by Sidecutter
That doesn't fix the button on the actual product page though, or move the button in the product previews (homepage, category list of products, etc) down under the price...

Re: Add to cart button

Posted: Wed Feb 02, 2011 3:43 pm
by Chones
To move it under the price you'll need to edit the category template, latest_ome template etc. and add a <br /> before the button. Or firstly you could try adding display: block; to the style.

The Add to Cart on the Product page is a different button - it has the class "button" like the search button and the continue button on information pages etc.

If you want to change that, but not all the others, you'll need to give it a new class in the product template, then add your own styles for that class in your stylesheet.