Jump to content

How do I add a second Add to Cart button, with a different color and placement?


Soliloquy

Recommended Posts

My theme has the Add to Cart button pretty far down on the page, and because of customization options I wouldn't want to change that. However, I want to add a second Add to Cart button in the right-hand column, higher up on the page, for those who want to have the product to the cart without customization. I'd like it to be a different color as well. Do I need to create a custom module to do this?

Link to comment
Share on other sites

No you don't. You can change the product.tpl file in your theme directory. Make a backup first.

Then find the add-to-cart button.

 

Copy the button code to an appropriate place within the same file. After success, you can start to play with formatting and renaming id and name of the button to something new.

Link to comment
Share on other sites

I've been working on that, but the second button hasn't been appearing. I think the problem is that my template uses a right-hand column, which is where I want the second add to cart button to go, but the code for the right-hand column is actually in footer.tpl. When I tried adding a second copy of the code to the appropriate place in footer.tpl, the code was visible in the source, but the button didn't show up. Then I tried moving the code for the very top of the column to the bottom of of the product.tpl file, with the code for the button underneath, but when I reloaded the page it was blank and all white. Maybe I'm running up against some sort of template conditional? That's why I thought maybe I had to create a module to do this.

Any further advice appreciated!

Link to comment
Share on other sites

Here's a copy of my Add to Cart button code, in case anything is wrong with it:
 


							<div class="cart-product"{if (!$allow_oosp && $product->quantity <= 0) || !$product->available_for_order || (isset($restricted_country_mode) && $restricted_country_mode) || $PS_CATALOG_MODE} class="unvisible"{/if}>
								<p id="add_to_cart" class="buttons_bottom_block no-print">
									<button type="submit" name="Submit" class="exclusive">
										<img src="../themes/pos_beestore2/img/icon/stroller-icon.png" />
										 <span>{if $content_only && (isset($product->customization_required) && $product->customization_required)}{l s='Customize'}{else}{l s='Add to cart'}{/if}</span>
									</button>
								</p>
							</div>
							

Link to comment
Share on other sites

You cannot add a buy button in the footer nor in a left or right column.

 

You have to stay within product.tpl. A blank page indicates a parsing / syntax error. It means your change resulted in not executable code.

Link to comment
Share on other sites

  • 1 month later...

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...