leowakgg Posted September 13, 2017 Share Posted September 13, 2017 // I apologize for my english // I'm using prestashop 1.7.2 Hi, I'm trying to add a product to cart with a custom price from an input field. I'm thinking about 2 solutions : - I found on a topic a trick with the specific price which allow to change the price just before adding to the cart, BUT i'm facing a problem with this method : I don't know how to call the php function which do the specific price stuff in my template. I already tryed a <button onclick="{MyController::myfunction(param1, param2 ...)}">Add</button> in product-add-to-cart.tpl but the code is already interpreted when the page is charging (onclick event is useless). How can i call my function by pressing the add to cart button ? - Another solution could be to create a duplicate product with a custom price , each time the input price is filled and the add to cart button pressed. I don't know how to achieve this, the problem is a bit similar to the first solution : how to call the function which create the new product when i press add to cart button ? I hope my ideas were clear, Thanks for help Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now