fde60 Posted September 7, 2023 Share Posted September 7, 2023 hello, in my file product.tpl (path : /themes/child_classic/templates/catalog/_partials/miniatures) : in my theme, i want to hide this button only in homepage ! <form action="{$urls.pages.cart}" method="post" style="display: block;" class="addToCartForm"> <input id="addToCartIdCustomization_{$product.id_product}" class="addToCartButtonIdCustomization" name="id_customization" value="0" type="hidden" placeholder=""> <input id="addToCartToken_{$product.id_product}" class="addToCartButtonToken" type="hidden" name="token" value="{$static_token}"> <input id="addToCartIdProduct_{$product.id_product}" class="addToCartButtonIdProduct" type="hidden" value="{$product.id_product}" name="id_product" value="{$product.id_product}"> {if $product.add_to_cart_url} <button data-button-action="add-to-cart" class="btn btn-primary add-to-cart" style="width: 85%; height: 2.75rem; padding:0;font-size: 0.55rem; border-radius: 3px; height: 2rem;"> <i class="material-icons shopping-cart"></i> {l s='Add to cart' d='Shop.Theme.Actions'} </button> {/if} </form> how can i do? Link to comment Share on other sites More sharing options...
AddWeb Solution Posted September 8, 2023 Share Posted September 8, 2023 8 hours ago, fde60 said: how can i do? Hi, Surround the Add to cart code with a conditional statement that checks if you are on the homepage. Code looks something like below {if !$is_home && $product.add_to_cart_url} <button data-button-action="add-to-cart" class="btn btn-primary add-to-cart" style="width: 85%; height: 2.75rem; padding:0;font-size: 0.55rem; border-radius: 3px; height: 2rem;"> <i class="material-icons shopping-cart"></i> {l s='Add to cart' d='Shop.Theme.Actions'} </button> {/if} Thanks! Link to comment Share on other sites More sharing options...
fde60 Posted September 8, 2023 Author Share Posted September 8, 2023 thank you it doesn't work, but it work with $page_name != 'index' 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