Jump to content

[SOLVED] Display prices with and without discount


Recommended Posts

Hi everybody,

In my product list (product-list.tpl), I'd like to display two prices: the one with the discount, and the one without the discount. So my customers can appreciate the discount.

The discount is properly displayed on the product page, with the following line:

{convertPrice price=$product->getPriceWithoutReduct()}



But when I use it in product-list.tpl :

 <!-- {if $product.new == 1}{l s='new'}{/if} -->
{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}
               {if $product.on_sale}
{l s='Green Price'}
                   <!-- On change le texte avec nos Green Price {l s='On sale!'} -->

               {elseif ($product.reduction_price != 0 || $product.reduction_percent != 0) && ($product.reduction_from == $product.reduction_to OR ($smarty.now|date_format:'%Y-%m-%d' <= $product.reduction_to && $smarty.now|date_format:'%Y-%m-%d' >= $product.reduction_from))}

#################### HERE ##############

{l s='Price lowered!'}



The price doesn't come out, and there is a graphic bug (my background image is not displayed).

Would anyone know how to use this getPriceWithoutReduct() function ?
I had a look at it, but I really don't get it...

Thanks !

Link to comment
Share on other sites

Solved on the French board, but I post the solution here, for people who might need it some day:

Here's the bit of code used to display the crossed priced without the discount:

               {if $product.reduction_percent}

{displayWtPrice p=$product.price_without_reduction}{if $priceDisplay == 2} {l s='-Tx' mod='homefeatured'}{/if}
               {/if}



Enjoy

Link to comment
Share on other sites

  • 2 months later...

I used this piece of code in the module "home featured", which display products with promotions on the home page.

You can put the code in /modules/homefeatured/homefeatured.tpl or something like that.

Link to comment
Share on other sites

  • 1 month later...

Here the piece of code I have in product-list.tpl :

               <!-- ******* Affichage du prix avant la réduc  -->
               {elseif ($product.reduction_price != 0 || $product.reduction_percent != 0) && ($product.reduction_from == $product.reduction_to OR ($smarty.now|date_format:'%Y-%m-%d' <= $product.reduction_to && $smarty.now|date_format:'%Y-%m-%d' >= $product.reduction_from))}

               {if $product.reduction_percent}

{displayWtPrice p=$product.price_without_reduction}{if $priceDisplay == 2} {l s='-Tx' mod='homefeatured'}{/if}
               {/if}


{l s='Price lowered!'}  {l s='-'}{if $product.reduction}{$product.reduction_percent}{l s='%'}{/if}

               {/if}
               {if !$priceDisplay || $priceDisplay == 2}

                   {convertPrice price=$product.price}{if $priceDisplay == 2} {l s='+Tx'}{/if}{/if}


               {if $priceDisplay}



                   {convertPrice price=$product.price_tax_exc}
{if $priceDisplay == 2} {l s='-Tx'}{/if}{/if}



Which display the price without discount (crossed), a sentence like "NEW PRICE !! -50% !" and the new price.

:)

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