Jump to content

[SOLVED] Hide price when = 0


antoine184

Recommended Posts

Hello,

PS 1.7.4.4, theme classic, PHP version: 7.2.12, MySQL version: 5.7.21

I know that the subject has been treated several times but not on version 1.7 (or I did not find it and I'm sorry) but when I try to follow the subject that is on another version, either the code does not work, either the files no longer exists or the content is empty

On this version, I assumed that the file product-prices.tpl should be used in / shop / themes / classic / templates / catalog / _partials, I tried to put a if price! = 0 but that does not work (I tried enclosing the whole file or enclosing it

{block name = 'product_unit_price'} {if $ displayUnitPrice}
             <p class = "product-unit-price sub"> {ls = '(% unit_price%)' d = 'Shop.Theme.Catalog' sprintf = ['% unit_price%' => $ product.unit_price_full]} </ p>
           {/ If}
         {/ Block}

and it does not work)

Do you have an idea?

Thank you

Regards

Edited by antoine184 (see edit history)
Link to comment
Share on other sites

On 12/13/2018 at 1:51 PM, antoine184 said:

Hello,

PS 1.7.4.4, theme classic, PHP version: 7.2.12, MySQL version: 5.7.21

I know that the subject has been treated several times but not on version 1.7 (or I did not find it and I'm sorry) but when I try to follow the subject that is on another version, either the code does not work, either the files no longer exists or the content is empty

On this version, I assumed that the file product-prices.tpl should be used in / shop / themes / classic / templates / catalog / _partials, I tried to put a if price! = 0 but that does not work (I tried enclosing the whole file or enclosing it

{block name = 'product_unit_price'} {if $ displayUnitPrice}
             <p class = "product-unit-price sub"> {ls = '(% unit_price%)' d = 'Shop.Theme.Catalog' sprintf = ['% unit_price%' => $ product.unit_price_full]} </ p>
           {/ If}
         {/ Block}

and it does not work)

Do you have an idea?

Thank you

Regards

Hi,

How about like this:

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

 

Edited by taniacr
Edited sugested code (see edit history)
  • Thanks 1
Link to comment
Share on other sites

  • 8 months later...
On 12/17/2018 at 9:27 AM, antoine184 said:

It works!

Thanks you

Where exaclty Did you insert it? I tried to put the code at the end of the product-prices.tpl, but the result is that product pages are no longer loading at all.

EDIT: I realized that I have to insert it into product.tpl, but I don't know which one, I have so many between the classic theme and my custom theme that I bought.

Edited by RawArt (see edit history)
Link to comment
Share on other sites

  • 1 year later...

Hi,

I have tried to do on my website the modifications to not display prices for the products with price 0 as it mentioned above.

The problem is I don't know exactly where to insert the code... I have tried in different places but the site is not working anymore after the modification.

I mention I have products available in many combinations and I want to display prices only for few of them, for the rest I want to not have the price displayed because is 0.

I use Pretashop 1.7.6.7.

Link to comment
Share on other sites

Finally I succed to make it works, but I still have a small problem. When a product has the price 0, this is not displayed anymore, but the information "VAT not included" is still displayed. Could I do something to not have this message displayed anymore if the price is 0?

Link to comment
Share on other sites

  • 1 month later...
On 3/11/2021 at 2:50 PM, radu_cmr said:

Finally I succed to make it works, but I still have a small problem. When a product has the price 0, this is not displayed anymore, but the information "VAT not included" is still displayed. Could I do something to not have this message displayed anymore if the price is 0?

So where exact you put this code? 

Link to comment
Share on other sites

For the beginning find the file product-prices.tpl

Open it with Wordpad, Notepad++ or other software

Before  {block name='product_price'} add

{if $product.price_amount eq "0"} 
<p>  </p>
{else}

Between <p> and </p> you can write something to be displayed instead of the price.. something like "Ask for price!"

After this you have to close the IF, for this put {/if} after the last {/block}, but before the new block  {block name='product_without_taxes'}

Enclose is the file

Hope this help

product-prices.tpl

Link to comment
Share on other sites

On 5/10/2021 at 4:55 PM, radu_cmr said:

For the beginning find the file product-prices.tpl

Open it with Wordpad, Notepad++ or other software

Before  {block name='product_price'} add

{if $product.price_amount eq "0"} 
<p>  </p>
{else}

Between <p> and </p> you can write something to be displayed instead of the price.. something like "Ask for price!"

After this you have to close the IF, for this put {/if} after the last {/block}, but before the new block  {block name='product_without_taxes'}

Enclose is the file

Hope this help

product-prices.tpl 4.63 kB · 2 downloads

Thanks. But it has changes it only in product details, also need in product list. And maybe have you got solution for removing add to cart and quantity, if price is "0" ? 

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...