Jump to content

Show discounted price at product.tpl


maestrosombrita

Recommended Posts

I want to show on page "product.tpl" price with VAT, without VAT, and also if the client buys two or more products, show the price with the discount price

 

I attach the screenshoot.

 

I canshow the price with or without VAT with this code:

 

<div class="content_prices clearfix">
  <!-- prices -->
  {if $product->show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
  {if $product->online_only}
   <p class="online_only">{l s='Online only'}</p>
  {/if}
{* --------- PRECIO --------- *}
  <div class="price">
   {if !$priceDisplay || $priceDisplay == 2}
 {assign var='productPrice' value=$product->getPrice(true, $smarty.const.NULL, $priceDisplayPrecision)}
 {assign var='productPriceWithoutRedution' value=$product->getPriceWithoutReduct(false, $smarty.const.NULL)}
   {elseif $priceDisplay == 1}
 {assign var='productPrice' value=$product->getPrice(false, $smarty.const.NULL, $priceDisplayPrecision)}
 {assign var='productPriceWithoutRedution' value=$product->getPriceWithoutReduct(true, $smarty.const.NULL)}
   {/if}
   <p class="our_price_display">
   {if $priceDisplay >= 0 && $priceDisplay <= 2}
 <p><span class="pricewithoutIva">{l s='PricewithoutIva'}</span> <span id="our_price_2_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL, 2)}</span> <span class="withoutIva">{l s='withoutIva'}</span></p>
 <p><span id="our_price_display">{convertPrice price=$productPrice}</span> <span class="withIva">{l s='withIva'}</span></p>
 <p class="shipping"><a href="{$link->getCMSLink('11', 'gastos-de-envio')}">{l s='shipping cost'}</a></p>
 <!--{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}-->
   {/if}
   </p>

   {if $product->on_sale}
 <!--<img src="{$img_dir}onsale_{$lang_iso}.gif" alt="{l s='On sale'}" class="on_sale_img"/>-->
 <span class="on_sale">{l s='On sale!'}</span>
   {elseif $product->specificPrice AND $product->specificPrice.reduction AND $productPriceWithoutRedution > $productPrice}
 <span class="discount">{l s='Reduced price!'}</span>
   {/if}
   {if $priceDisplay == 2}
 <br />
 <span id="pretaxe_price"><span id="pretaxe_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}</span> {l s='tax excl.'}</span>
   {/if}
  </div>
  <p id="reduction_percent" {if !$product->specificPrice OR $product->specificPrice.reduction_type != 'percentage'} style="display:none;"{/if}><span id="reduction_percent_display">{if $product->specificPrice AND $product->specificPrice.reduction_type == 'percentage'}-{$product->specificPrice.reduction*100}%{/if}</span></p>
  <p id="reduction_amount" {if !$product->specificPrice OR $product->specificPrice.reduction_type != 'amount' && $product->specificPrice.reduction|intval ==0} style="display:none"{/if}><span id="reduction_amount_display">{if $product->specificPrice AND $product->specificPrice.reduction_type == 'amount' && $product->specificPrice.reduction|intval !=0}-{convertPrice price=$product->specificPrice.reduction|floatval}{/if}</span></p>
  {if $product->specificPrice AND $product->specificPrice.reduction}
   <p id="old_price"><span class="bold">
   {if $priceDisplay >= 0 && $priceDisplay <= 2}
 {if $productPriceWithoutRedution > $productPrice}
  <span id="old_price_display">{convertPrice price=$productPriceWithoutRedution}</span>
  <!-- {if $tax_enabled && $display_tax_label == 1}
   {if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
  {/if} -->
 {/if}
   {/if}
   </span>
   </p>
  {/if}
  {if $packItems|@count && $productPrice < $product->getNoPackPrice()}
   <p class="pack_price">{l s='instead of'} <span style="text-decoration: line-through;">{convertPrice price=$product->getNoPackPrice()}</span></p>
   <br class="clear" />
  {/if}
  {if $product->ecotax != 0}
   <p class="price-ecotax">{l s='include'} <span id="ecotax_price_display">{if $priceDisplay == 2}{$ecotax_tax_exc|convertAndFormatPrice}{else}{$ecotax_tax_inc|convertAndFormatPrice}{/if}</span> {l s='for green tax'}
 {if $product->specificPrice AND $product->specificPrice.reduction}
 <br />{l s='(not impacted by the discount)'}
 {/if}
   </p>
  {/if}
  {if !empty($product->unity) && $product->unit_price_ratio > 0.000000}
 {math equation="pprice / punit_price"  pprice=$productPrice  punit_price=$product->unit_price_ratio assign=unit_price}
   <p class="unit-price"><span id="unit_price_display">{convertPrice price=$unit_price}</span> {l s='per'} {$product->unity|escape:'htmlall':'UTF-8'}</p>
  {/if}
  {*close if for show price*}
  {/if}
  {if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}
   <span class="exclusive">
 <span></span>
 {l s='Add to cart'}
   </span>
  {else}
   <div class="price_Display">
 <p id="add_to_cart" class="buttons_bottom_block">
  <input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" />
 </p>
   </div>
  {/if}
  {if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if}
  <div class="clear"></div>
 </div>

 

How I can show the price after the discount?

 

Thanks!!!!

post-457361-0-27643700-1360158078_thumb.jpg

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