overbags Posted March 11, 2022 Share Posted March 11, 2022 (edited) Hello i have prestashop 1.6.1.24 I would like to change the text of the "add to cart" button to "reserve" when a product or attribute is not available. Edited March 14, 2022 by overbags (see edit history) Link to comment Share on other sites More sharing options...
Ress Posted March 11, 2022 Share Posted March 11, 2022 More specifically, when the product is not in stock, but can still be ordered, the text "Reserve" will appear. Link to comment Share on other sites More sharing options...
overbags Posted March 11, 2022 Author Share Posted March 11, 2022 (edited) I need the text to be on the "add to cart" button because many don't read the written reservation I was thinking of creating an if in the <span> of the <button> "add to cart" type if $ product-> quantity <= 0 book else Add to Cart / if but with $ product-> quantity it gives me the total sum of the attributes of a product and not the quantity of the single attribute Edited March 11, 2022 by overbags (see edit history) Link to comment Share on other sites More sharing options...
Ress Posted March 12, 2022 Share Posted March 12, 2022 In /public_html/themes/default-bootstrap/js/product.js function updateDisplay() { //add if (quantityAvailable > 0) { $('#add_to_cart span').text('Add to cart'); } else { $('#add_to_cart span').text('Preorder'); } //end add ..... Link to comment Share on other sites More sharing options...
overbags Posted March 12, 2022 Author Share Posted March 12, 2022 I modified the product.js file as indicated in the picture deleted cache etc etc but nothing happens do I have to create an id at the span of the product.tpl file because it doesn't have it? you have to photo Link to comment Share on other sites More sharing options...
Ress Posted March 12, 2022 Share Posted March 12, 2022 Can you post shop link? Link to comment Share on other sites More sharing options...
overbags Posted March 12, 2022 Author Share Posted March 12, 2022 (edited) there he ishttps://www.overbags.com/trasparente/908-25-pz-tubo-busta-scatola-bomboniera-confetti-riso-trasparente-matrimonio-regalo.html#/259-dimensione_mm-mm_60x60x22 if it can be useful I attach the product.js file product.js Edited March 12, 2022 by overbags (see edit history) Link to comment Share on other sites More sharing options...
Ress Posted March 12, 2022 Share Posted March 12, 2022 (edited) I went to the site, and I see that it works. I think you have a browser cache, clear browser cache or try incognito. Edited March 12, 2022 by Ress (see edit history) Link to comment Share on other sites More sharing options...
overbags Posted March 12, 2022 Author Share Posted March 12, 2022 The text does not change to book if not in stock can you send me a screenshot? This is the attribute link not available https://www.overbags.com/trasparente/908-25-pz-tubo-busta-scatola-bomboniera-confetti-riso-trasparente-matrimonio-regalo.html#/259-dimensione_mm-mm_60x60x22 Link to comment Share on other sites More sharing options...
Ress Posted March 12, 2022 Share Posted March 12, 2022 (edited) Replace in code, Preorder with Book, Preorder now appears. Edited March 12, 2022 by Ress (see edit history) 1 Link to comment Share on other sites More sharing options...
overbags Posted March 14, 2022 Author Share Posted March 14, 2022 yes you were right i had to clear the chrome history and everything works perfectly. 1 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