Jump to content

Custom Basket Buttons


Recommended Posts

I am trying to replicate one of my sites in PS so that I can move over from the shop I am using to PS but I am having difficulty trying to use an image to add the product to the basket.

This site only has one product so I don't actually show the product page just different cms pages for information.

So I have an easy order button and another image that just says order now that I want to attach my product id to so once it is clicked it adds it to the basket and shows the cart. Most visitors are return vistitors and know that product so just want to click the button to add to basket.

Having used PS on two other sites I intend to use it on all of my sites but this little problem is holding me back from doing that.

Is it possible to use code that can be attached to the image to do this?

Link to comment
Share on other sites

  • 2 months later...

Is there anyone that knows how to do this?

I have virtually themed my Prestashop at www.evolutionsuperfood.co.uk but cannot find out how to get it so that the button on the right adds the products to the basket as well as the ones in the write up throughout the front page.

Is it possible that someone could tell me which code I need to make it so that the buttons can be used as custom add to cart buttons and also if possible which code to use for the quantity.

Can I do this as the add to cart button and quantity is a form?

If not could someone tell me how to add this form in any part of the site as that would be better. I can't change the site too much as it needs to look like the live site at www.monatomicgold.co.uk.

Link to comment
Share on other sites

I had a look at the link on the "Easy order, Click here" button, and it is only cart.php. You need to put a link like the following on it:

{$base_dir}cart.php?add&id_product=1&token={$static_token}



This will add one of product 1 to the cart. Change 1 to the ID of your product.

Link to comment
Share on other sites

  • 4 months later...

Hi Rocky

Bit of a delay I am afraid as I have been busy trying to get my visa application in to go to Oz but I am now back on the site as I need to get it working for when I go (fingers crossed).

I have made my new site at www.monatomicgold.co.uk/ps and have created a button in a second addstuff block but how do I put the code you put here behind the image so it adds to basket when clicked.

Also, I have been trying without any success at all to put the price under the image of the product but it either throws an error or when the visitor changes the currency it doesn't change it.

Link to comment
Share on other sites

You need to change:

<img src="http://www.monatomicgold.co.uk/ps/img/easy_order.gif" alt="one_click_order_button" />



to:

<a href="{$base_dir}cart.php?add&id_product=1&token={$static_token}"><img src="http://www.monatomicgold.co.uk/ps/img/easy_order.gif" alt="one_click_order_button" />



Change 1 to the ID of the "Evolution: The Vital Link" product.

Link to comment
Share on other sites

There is a tpl file but all it has in it is;

<!-- MODULE Addstuff -->


{$addstuff2_code}

<!-- /MODULE Addstuff -->

I tried a different way to do this by saving product.tpl as product1.tpl, removing all of the code and then putting your code in and then putting product1.tpl in the addstuff instead of the addstuff tags.

Although it didn't work it didn't come up with the same error. It came up with an error that the product didn't exist.

I then copied the product from category 2 to the home section so it was (if I have it right) product 1 but it still said that the product didn't exist.

Doesn't matter what I do though I can't get the price od product 1 - there is only 1 product) in the tpl file to change at all.

Can anyone out there shed any more light on how I can do this as I want my new site to look like as much like the old one as possible
Link to comment
Share on other sites

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