Jump to content

[SOLVED] $productPrice in Product.tpl is empty!


Recommended Posts

Hi,

I have pt_winestore as my main template in prestashop!

But the problem is Prices are not shown in product page (Product.tpl) , and at the same time are shown in product list page (product_list.tpl) !

I don't know why :( But I know the $productPrice variable is empty!

Here is the template code for Product.tpl :

            <div class="price">
                <p class="our_price_display" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
                {if $product->quantity > 0}<link itemprop="availability" href="http://schema.org/InStock"/>{/if}
                {if $priceDisplay >= 0 && $priceDisplay <= 2}
                    <span id="our_price_display" itemprop="price">{convertPrice price=$productPrice}</span>
                    <!--{if $tax_enabled  && ((isset($display_tax_label) && $display_tax_label == 1) OR !isset($display_tax_label))}
                        {if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
                    {/if}-->
                    <meta itemprop="priceCurrency" content="{$currency->iso_code}" />
                {/if}
                </p>

the if statement return True because I can see the HTML codes but price :(

How can I fix this Problem ?!

Thanks a lot

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

At the top of the template, there should be a line similar to this:

 

        {assign var='productPrice' value=$product->getPrice(true, $smarty.const.NULL, $priceDisplayPrecision)}
 

Which is where that variable gets filled.. have a check to see if that's there and hasn't been accidentally removed or some such?

 

If it is there, could try just printing out the info it returns straight after, then compare to later in the page.. possibly something else such as a module is overwriting it after the fact

You can do that with:

 

{var_dump($productPrice)}

 

It should print out not just what's in the variable, but also tell you the variable type, so if it returns something like bool(false) instead, it suggests that the function which gets the price is failing for some reason

  • Like 1
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...