Jump to content
Zen_j1

How to hide price Price when Price is 0.00

Recommended Posts

How to hide price Price when Price is 0.00 of product in prestashop default theme 1.6.1.x on product page and quick view window.

Share this post


Link to post
Share on other sites

On the product.tpl line 264 there is this code

<span id="our_price_display" class="price" itemprop="price" content="{$productPrice}">{convertPrice price=$productPrice|floatval}</span>

you can change it to 

{if $productPrice > 0 }<span id="our_price_display" class="price" itemprop="price" content="{$productPrice}">{convertPrice price=$productPrice|floatval}</span>{/if}
  • Like 1

Share this post


Link to post
Share on other sites

 

On the product.tpl line 264 there is this code

<span id="our_price_display" class="price" itemprop="price" content="{$productPrice}">{convertPrice price=$productPrice|floatval}</span>

you can change it to 

{if $productPrice > 0 }<span id="our_price_display" class="price" itemprop="price" content="{$productPrice}">{convertPrice price=$productPrice|floatval}</span>{/if}

 

You are my Hero 

 

Is there a way to Freeze/Disable Add to cart button for Non Logged in customer and to show message please login to Add to cart. I know there is free module which hide price and add to cart button. I do not want to hide price for product having price greater than zero (0). Need to show price but disable add to cart button

Share this post


Link to post
Share on other sites

On product.tpl line 390 change this 

<p id="add_to_cart" class="buttons_bottom_block no-print">
 <button type="submit" name="Submit" class="exclusive">
  <span>{if $content_only && (isset($product->customization_required) && $product->customization_required)}{l s='Customize'}{else}{l s='Add to cart'}{/if}</span>
 </button>
</p>

to ...

<p id="add_to_cart" class="buttons_bottom_block no-print">
 <button type="submit" name="Submit" class="exclusive" {if !$is_logged}disabled{/if}>
  <span>{if $content_only && (isset($product->customization_required) && $product->customization_required)}{l s='Customize'}{else}{l s='Add to cart'}{/if}</span>
 </button>
</p>

that way your button won't trigger. But you will have to figure a different styling cause it will make the customers confused.

 

I suggest you also add something like

{if !$is_logged}<span>Log in to add to Cart</span>{/if}

before the button

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Hi, we can hide a price also in product list.tpl, shopping cart.tpl and shopping cart product line.tpl.

Can someone help us, how to modify this files?

Thanks

 

Franto

Share this post


Link to post
Share on other sites

Hi there, it is the same logic everywhere. You go to the file you want to change. Find the line that the price is outputted and add a check if it is larger than 0 before you display the value.

 

For example.

 

Product list.tpl line 69 is

<span itemprop="price" class="price product-price">
{hook h="displayProductPriceBlock" product=$product type="before_price"}
{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
</span>

change it to 

<span itemprop="price" class="price product-price">
{hook h="displayProductPriceBlock" product=$product type="before_price"}
{$product.price > 0}
{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
{/if}
</span>

Same goes for the other files

  • Like 2

Share this post


Link to post
Share on other sites

Hi there, it is the same logic everywhere. You go to the file you want to change. Find the line that the price is outputted and add a check if it is larger than 0 before you display the value.

 

For example.

 

Product list.tpl line 69 is

<span itemprop="price" class="price product-price">
{hook h="displayProductPriceBlock" product=$product type="before_price"}
{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
</span>

change it to 

<span itemprop="price" class="price product-price">
{hook h="displayProductPriceBlock" product=$product type="before_price"}
{$product.price > 0}
{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
{/if}
</span>

Same goes for the other files

 Thank You very much!!! Franto

Share this post


Link to post
Share on other sites

How to use this in prestashop 1.7 version? We want to show "Price on request" message if price is "€0.00".

Edited by bvaghani (see edit history)

Share this post


Link to post
Share on other sites

How can I hide or disable the add to cart button if price is 0.I resolved the hide price if 0,I changed to call for price but the add to cart button is active.Can u help me please?

Thank you.

Share this post


Link to post
Share on other sites

Hello Guys, sorry to revive this discussion. 

 

Any one had solution for 1.7.4? We want to hide price or show POA in product page, category page and checkout. We use a request a quote module so we still want the customer to be able to add the price to their basket so they can submit the quote request, but want to change the price from 0 to POA desperately. Any pointers will be appreciated. 

Share this post


Link to post
Share on other sites
22 hours ago, mellsaid said:

Hello Guys, sorry to revive this discussion. 

 

Any one had solution for 1.7.4? We want to hide price or show POA in product page, category page and checkout. We use a request a quote module so we still want the customer to be able to add the price to their basket so they can submit the quote request, but want to change the price from 0 to POA desperately. Any pointers will be appreciated. 

 

Edit the themes/classic/templates/catalog/_partials/miniatures/product.tpl & search for 

<span itemprop="price" class="price">{$product.price}</span>

and replace this line with

{if $product.price eq "0"}
   <span itemprop="price" class="price">POA</span>
{else}
   <span itemprop="price" class="price">{$product.price}</span>
{/if}

This change will change the price 0 to POA in the home page, category page etc page. For product page, you need to make changes in the other file. 

Kindly first check the changes on the home page & category page & confirm.

 

  • Like 1

Share this post


Link to post
Share on other sites
On 01.09.2018 at 8:01 PM, Knowband Plugins said:

 

Edit the themes/classic/templates/catalog/_partials/miniatures/product.tpl & search for 

<span itemprop="price" class="price">{$product.price}</span>

and replace this line with

{if $product.price eq "0"}
   <span itemprop="price" class="price">POA</span>
{else}
   <span itemprop="price" class="price">{$product.price}</span>
{/if}

This change will change the price 0 to POA in the home page, category page etc page. For product page, you need to make changes in the other file. 

Kindly first check the changes on the home page & category page & confirm.

 

Thanks. But it doesn't work in Prestashop 1.7.2.2. 

Screenshot_2.png

Screenshot_3.png

Edited by daysprng (see edit history)

Share this post


Link to post
Share on other sites

My mistake.

$product.price is the amount with the currency so the comparison will not work.

Replace

{if $product.price eq "0"}

with this in the above code & check again (Clear the cache from the backend)

{if $product.price_amount eq "0"}

 

  • Like 2

Share this post


Link to post
Share on other sites
On 5/12/2017 at 2:14 PM, BalzoT said:

On the product.tpl line 264 there is this code


<span id="our_price_display" class="price" itemprop="price" content="{$productPrice}">{convertPrice price=$productPrice|floatval}</span>

you can change it to 


{if $productPrice > 0 }<span id="our_price_display" class="price" itemprop="price" content="{$productPrice}">{convertPrice price=$productPrice|floatval}</span>{/if}

I cant find this file to perform modification

Share this post


Link to post
Share on other sites
On 9/1/2018 at 8:01 PM, Knowband Plugins said:

This change will change the price 0 to POA in the home page, category page etc page. For product page, you need to make changes in the other file. 

Kindly first check the changes on the home page & category page & confirm.

Hello, KP. What changes and in what file I need to make for change 0 price on product page?

Share this post


Link to post
Share on other sites

I also have this problem and from the discussion I didn't understand how exactly to hide price in prestashop 1.7.6.2 if the price is 0. I would like to hide in main product page, in category product listing and in the quick view. But I don't know in which product.tpl put this code:

{if $product.price_amount eq "0"} 
<p> </p>
{else}
{block name='product_prices'}
   {include file='catalog/_partials/product-prices.tpl'}
{/block}
{/if}

I have a custom theme, not classic.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More