Jump to content

How to hide price Price when Price is 0.00


Zen_j1

Recommended Posts

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
Link to comment
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

Link to comment
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
Link to comment
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
Link to comment
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

Link to comment
Share on other sites

  • 2 weeks later...
  • 8 months later...
  • 6 months later...

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. 

Link to comment
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
Link to comment
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)
Link to comment
Share on other sites

  • 3 months later...
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

Link to comment
Share on other sites

  • 5 months later...
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?

Link to comment
Share on other sites

  • 6 months later...

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.

Link to comment
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...