Jump to content

Check if price is higher than


andref

Recommended Posts

Hello there,

 

I'm making a module to display some shipping information on the product page, I've hooked the module to "ExtraRight" to show up in the product page. I have most of what I want working apart from one thing. I want to check if the price of the product is higher than 35€ displays something and if it's lower display something else. I've tried a bunch of diferent code snippets without any luck, I can get the price without taxes, but I need to check the price with taxes included, and that's my problem, I can't get the price with the taxes included.

 

Here's the code I have that get's me the price without taxes. I'm working on the tpl file of the module. Using PS 1.6.1.16

{if $product->price >= 35}
   <div>
      Something
   </div>
{else}
   <div>
      Something else
   </div>
{/if}

I've tried several diferent variables with no luck.

 

If anyone could help me I would really appreciate it. Thank You!

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

You can find the answer in product.tpl - all is already there. And you might note the fact that prices show can change with different customers groups if you have set up different pricing models for different customer groups.

 

And - sey prestashop version you use. If on V 1.7 forget everything I wrote.

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

That was my first move, go to product.tpl and "copy" what was done there, but I couldn't figure out how after trying a bunch of diferent things.

 

I'm not using diferent prices for diferent groups.

 

I tried, as used in the product.tpl

{$productPrice}

But that does't work. I tested all my code to display the price of the product on the page just to see if it was returning what the price as I wanted, and with this it doesn't return nothing.

 

Thank You.

Link to comment
Share on other sites

I've tried that, I've tried:

{if $productPrice >= 35}
   <div>...</div>
{else}
   <div>...</div>
{/if}

And nohting happens...

 

And tried just to display the price:

{$productPrice}

I tried this on the product page on other place than  the price block and it returns the price that I want with taxes, but when I use it in the template file of the hook ExtraRight it returns nothing, I don't know why, it is on the product page and it should have access to that

 

Thank You.

Link to comment
Share on other sites

Yes, as I said in the original post, I'm making a module that is hooked to the ExtraRight hook in the product page.

 

And as I said in the second reply I used

{$product->price}

Which returns me the price without taxes, but I need the price with taxes included.

 

Any ideas on this?

 

Thank You.

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