Tiago Posted January 15, 2018 Share Posted January 15, 2018 Hello guys , im new to prestashop and to php. I was trying to change some files on the prestashop but i have some problem that im not discovering. Im using the PrestaShop version: 1.7.2.4 And the theme i am using is the classinc one. All i need is when a product have price at 0.00€ it should apear call for pricing! I managed to do this but if the price is difrent then 0 it stills to show call for pricing. The files i changed was - themes/classic/templates/catalog/_partial/product-prices.tpl //top of the file {if $product->price == 0} <div class="product-price h5"> <span itemprop="price" content="">Call for Pricing!</span> </div> {/if} {if $product->price != 0} the rest of the code from the file here {/if} and the second file was: themes/classic/templates/catalog/_partial/miniatures/product.tpl {block name='product_price_and_shipping'} 45 <!-- Changes here --> {if $product->price == 0} <div class="product-price-and-shipping"> <span itemprop="price" class="price"> Call for Pricing!</span> </div> 49 <!-- Changes here --> {/if} 50<!-- Changes here -->{if $product->price !=0} {if $product.show_price} <div class="product-price-and-shipping"> {if $product.has_discount} {hook h='displayProductPriceBlock' product=$product type="old_price"} <span class="sr-only">{l s='Regular price' d='Shop.Theme.Catalog'}</span> <span class="regular-price">{$product.regular_price}</span> {if $product.discount_type === 'percentage'} <span class="discount-percentage">{$product.discount_percentage}</span> {/if} 61 <!-- Changes here --> {/if} {hook h='displayProductPriceBlock' product=$product type="before_price"} <span class="sr-only">{l s='Price' d='Shop.Theme.Catalog'}</span> <span itemprop="price" class="price">{$product.price}</span> {hook h='displayProductPriceBlock' product=$product type='unit_price'} {hook h='displayProductPriceBlock' product=$product type='weight'} </div> {/if} {/if} {/block} Can some one give me a clue what is wrong or where i should put the if statement? Link to comment Share on other sites More sharing options...
Pierre_d Posted January 15, 2018 Share Posted January 15, 2018 Try {if $product.price == 0}. If it stills does not work, check the data type of price in the PHP class. Link to comment Share on other sites More sharing options...
Tiago Posted January 15, 2018 Author Share Posted January 15, 2018 (edited) Pierre_d thanks for the reply. I did the changes but it dosen´s change anything. If the product price is 0 it gives call for pricing and if i change the price it keeps giving the call for price. I cheked the class and the $price var is a float value. But the problem presists! Edited January 16, 2018 by Tiago (see edit history) Link to comment Share on other sites More sharing options...
Tiago Posted January 17, 2018 Author Share Posted January 17, 2018 On 15/01/2018 at 12:31 PM, Pierre_d said: Try {if $product.price == 0}. If it stills does not work, check the data type of price in the PHP class. You have any other sugestion Pierre? Plz let me know cause im trying to figure whats wrong but cant find it. Link to comment Share on other sites More sharing options...
Pierre_d Posted January 17, 2018 Share Posted January 17, 2018 Hi Tiago, I've tried in my development environment and... it works! {if $product.price == 0} the price is zero {else} the price is not zero {/if} Two things come to my mind. 1) $product.price is zero because of your configuration or 2) have you forced template recompilation in the BO > Advanced Parameters > Performance ? Link to comment Share on other sites More sharing options...
Tiago Posted January 17, 2018 Author Share Posted January 17, 2018 23 minutes ago, Pierre_d said: Hi Tiago, I've tried in my development environment and... it works! {if $product.price == 0} the price is zero {else} the price is not zero {/if} Two things come to my mind. 1) $product.price is zero because of your configuration or 2) have you forced template recompilation in the BO > Advanced Parameters > Performance ? In wich lines you did the if statment Pierre? Link to comment Share on other sites More sharing options...
Pierre_d Posted January 17, 2018 Share Posted January 17, 2018 I inserted the if-else-if on line 48, just after <span itemprop="price" content="{$product.price_amount}">{$product.price}</span>. Link to comment Share on other sites More sharing options...
Tiago Posted January 17, 2018 Author Share Posted January 17, 2018 13 minutes ago, Pierre_d said: I inserted the if-else-if on line 48, just after <span itemprop="price" content="{$product.price_amount}">{$product.price}</span>. thank you Pierre , dunno what im doing wrong allways showing call for price. product.tpl product-prices.tpl Link to comment Share on other sites More sharing options...
Pierre_d Posted January 17, 2018 Share Posted January 17, 2018 The tpl you sent me are not modified! Link to comment Share on other sites More sharing options...
Tiago Posted January 17, 2018 Author Share Posted January 17, 2018 12 minutes ago, Pierre_d said: The tpl you sent me are not modified! I did a comment on this ones where i did the changes product-prices.tpl product.tpl Link to comment Share on other sites More sharing options...
Pierre_d Posted January 17, 2018 Share Posted January 17, 2018 I've tried with product-prices.tpl. Works for me. Display "Call for prices" when price is 0 else displays the price! You need to force template recompilation. Have you done that ? Link to comment Share on other sites More sharing options...
Tiago Posted January 22, 2018 Author Share Posted January 22, 2018 On 17/01/2018 at 3:49 PM, Pierre_d said: I've tried with product-prices.tpl. Works for me. Display "Call for prices" when price is 0 else displays the price! You need to force template recompilation. Have you done that ? Yes and seams not to work for me! No idea what i have to do but thanks for the help Link to comment Share on other sites More sharing options...
Pierre_d Posted January 22, 2018 Share Posted January 22, 2018 I can have a look for you, but you will need to give backdoor access to your website... Send me a PM if you wish. Pierre Link to comment Share on other sites More sharing options...
buba10 Posted February 2, 2018 Share Posted February 2, 2018 (edited) Thanks a lot. It really works! Edited February 2, 2018 by buba10 (see edit history) Link to comment Share on other sites More sharing options...
buba10 Posted February 4, 2018 Share Posted February 4, 2018 (edited) Could you tell me how in this case to hide the price "0 €" from sticker on main page (category). Is it possible? Thanks an advance p.s the theme I'm using is the classinc one Edited February 4, 2018 by buba10 (see edit history) Link to comment Share on other sites More sharing options...
Pierre_d Posted February 4, 2018 Share Posted February 4, 2018 Yes, you can hide the price from the miniatures on the category page. You need to modify themes\classic\templates\catalog\_partials\miniatures\product.tpl. Locate {block name='product_price_and_shipping'} and enclose the price display between an if: {if $product.price > 0} ... {/if} 1 Link to comment Share on other sites More sharing options...
buba10 Posted February 5, 2018 Share Posted February 5, 2018 excellent ! everything works exactly as it was needed. Thank you Pierre_d! Link to comment Share on other sites More sharing options...
Pierre_d Posted February 6, 2018 Share Posted February 6, 2018 You're welcome! Link to comment Share on other sites More sharing options...
gumi Posted February 23, 2018 Share Posted February 23, 2018 Hi Pierre_d ! Can you help mee to with this modifications?I try all posibilities but I cant resolve. Thank you. Link to comment Share on other sites More sharing options...
Pierre_d Posted February 24, 2018 Share Posted February 24, 2018 Hi gumi, can you tell me what exactly 1) what you want to do 2) what you've tried so far ? Regards. Link to comment Share on other sites More sharing options...
gumi Posted February 24, 2018 Share Posted February 24, 2018 Thanks for you response.Meantime I resolved the problem ,changed price 0 to call for price if product price is set to 0. Now I want to hide the Add to cart button if price is set to 0. Help me please! Thank you. Link to comment Share on other sites More sharing options...
joaopaisagem Posted February 24, 2018 Share Posted February 24, 2018 Change to catalogue mode the prestashop and you will be fine i think. Let me know if it solve the issue Link to comment Share on other sites More sharing options...
gumi Posted February 24, 2018 Share Posted February 24, 2018 If I change to catalogue mode it will disable add to cart for all products,no? Link to comment Share on other sites More sharing options...
gumi Posted February 24, 2018 Share Posted February 24, 2018 I just want to hide for products witch has set price to 0. Link to comment Share on other sites More sharing options...
gumi Posted February 24, 2018 Share Posted February 24, 2018 I have a new question .How can I translate this "Call to price" text? Link to comment Share on other sites More sharing options...
se.ehsan Posted December 1, 2018 Share Posted December 1, 2018 (edited) hello On 1/22/2018 at 7:01 AM, Tiago said: Yes and seams not to work for me! No idea what i have to do but thanks for the help hello dear you should put below code in product.tpl after line: <span class="sr-only">{l s='Price' d='Shop.Theme.Catalog'}</span> <!-- changes here --> {if $product.price_amount == 0} <span itemprop="price" class="price">Call for Price!</span> {else} <span itemprop="price" class="price">{$product.price}</span> {/if} <!-- finish here --> and below code in product-prices.tpl after line : <meta itemprop="priceCurrency" content="{$currency.iso_code}"> {if $product.price_amount == 0} <!-- changes here <div class="current-price"> --> <span itemprop="price" content="{$product.price_amount}">Call for Price!</span> {else} <div class="current-price"> <span itemprop="price" content="{$product.price_amount}">{$product.price}</span> {/if} Edited December 1, 2018 by se.ehsan (see edit history) Link to comment Share on other sites More sharing options...
kalu Posted October 16, 2019 Share Posted October 16, 2019 On 1/22/2018 at 12:01 PM, Tiago said: Yes and seams not to work for me! No idea what i have to do but thanks for the help Hi Tiago! I want to know if you managed to do what you wanted. Can you please tell me what tou did, or send me the files you edited? Thanks 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