hdhazard Posted November 3, 2020 Share Posted November 3, 2020 (edited) Hi all ps 1.7 I have a virtual store , and i want to change "add to cart" button to "download now" when price is zero . for products with any price display "add to cart"(default). So how can i do that? Edited November 5, 2020 by hdhazard solved (see edit history) Link to comment Share on other sites More sharing options...
hdhazard Posted November 3, 2020 Author Share Posted November 3, 2020 Thx but i need add only some codes to to product.tpl to solve this : i add this to the product button : {if $product->price <= 0}{l s='download now'}{/if} but text button changed to this : download now Add to cart Link to comment Share on other sites More sharing options...
razaro Posted November 3, 2020 Share Posted November 3, 2020 3 hours ago, hdhazard said: Thx but i need add only some codes to to product.tpl to solve this : i add this to the product button : {if $product->price <= 0}{l s='download now'}{/if} but text button changed to this : download now Add to cart @hdhazard Not sure if that is behavior you want. even if you just change text it would behave like add to cart button, no ? But if you are making changes use else statement {if $product->price <= 0} {l s='Download now'} {else} {l s='Add to cart' d='Shop.Theme.Actions'} {/if} 1 Link to comment Share on other sites More sharing options...
hdhazard Posted November 3, 2020 Author Share Posted November 3, 2020 not worked for both free product and non-free product , button changed to : Download now here is code that i used : <div class="add"> <button class="btn btn-primary add-to-cart" data-button-action="add-to-cart" type="submit" {if !$product.add_to_cart_url} disabled {/if} > <i class="material-icons shopping-cart"></i> {if $product->price <= 0} {l s='Download now'} {else} {l s='Add to cart' d='Shop.Theme.Actions'} {/if} </button> </div> Link to comment Share on other sites More sharing options...
razaro Posted November 3, 2020 Share Posted November 3, 2020 Yeah that code was untested, sorry about that. Try this <div class="add"> <button class="btn btn-primary add-to-cart" data-button-action="add-to-cart" type="submit" {if !$product.add_to_cart_url} disabled {/if} > <i class="material-icons shopping-cart"></i> {if $product.price_amount <= 0} {l s='Download now'} {else} {l s='Add to cart' d='Shop.Theme.Actions'} {/if} </button> </div> 1 Link to comment Share on other sites More sharing options...
hdhazard Posted November 3, 2020 Author Share Posted November 3, 2020 great ! amazing. It worked well. Thanks a lot ❤ 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