Jump to content

[SOLVED] Product list - showing old price - Reduction - new price


Recommended Posts

Hi

 

I try to get solution on how to display on product listing these information

 

OLD PRICE -> REDUCTION (AMOUNT OR %) -> NEW PRICE

 

have anybody done this?

 

I realy need help with that ...

 

Martin

 

ps. I attached picture how it should look like

post-33924-0-76763700-1367011842_thumb.jpg

Link to comment
Share on other sites

What version do you use?

 

If 1.5, just go to your product, go to price-TAB, add a specific price with discount in %. It will show the original price, the reduction (say 10%) and the final price.

 

Or is your question to get the special layout, precisely as in your picture, not how to display the three values at all?

 

Let us know,

Pascal

Link to comment
Share on other sites

For display, you can play in themes/<your theme folder>/css/product.css

for example like this (PS 1.5.3.1 default theme)

 

#buy_block p#old_price {

font-size: 14px;

text-align: left; <-- add this, to move old price to the left

}

 

#reduction_amount {

position: relative; <-- add these two line to move the % to the middle

left: -120px; <---

display: block;

float: right;

margin-left: 10px;

padding: 0 0 0 10px;

font-weight: 700;

font-size: 12px;

color: #fff;

background: url(../img/bg_reduction.png) no-repeat 0 0 transparent;

}

 

 

.our_price_display {

top: 25px; <-- add this to move the final price down to align with the other ones

position: relative;

padding-bottom: 10px;

font-weight: 700;

position: relative;

font-size: 24px;

line-height: 18px;

color: #9b0000;

position: relative;

}

 

Just a sample for what's possible.

Hope this helps,

Pascal

Link to comment
Share on other sites

On product page the old price and new price are shown.

 

I want to shown on product list page. Now there is shown only new price.

 

All product with discount showing on right side of picture tekst SPLETNA CENA in orange color.

 

thanks

 

Martin

Link to comment
Share on other sites

hmm, I don't have the 1.4.9 code here, so that is difficult, but for sure this given in themes/<your theme folder>/product-list.tpl

 

in 1.5.3.1 you have a piece of code like this: (search for the red code in your file)

 

<span class="price" style="display: inline;">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>

 

Here you should add some code to show the full price, discount % and then the discounted price...

 

I think I found it: (Thanks to other reply from NikPraskaton)

 

Add BEFORE the code found above this piece of red code:

 

 

{if $product.price_without_reduction neq $product.price}

 

<span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$product.price_without_reduction}{else}{displayWtPrice p=((($product.price_without_reduction) / (1 + ((($product.rate|intval) / 100)|floatval)))|floatval)}{/if}</span>

{if $product.specific_prices}{assign var='pro_specific_prices' value=$product.specific_prices}

{if $pro_specific_prices.reduction_type eq 'percentage' && ($pro_specific_prices.from eq $pro_specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $pro_specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $pro_specific_prices.from))}

(-{$pro_specific_prices.reduction * 100|floatval}%)

{/if}

{/if}

{/if}

 

 

<span class="price" style="display: inline;">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>

 

 

This will add the full price and the reduction% within brackets.

Please add and see if it works. We may have to work on the layout a little afterwards, but add the values first, so we can play with it.

 

Hope this does the trick. Let me know...

 

Pascal

  • Like 2
Link to comment
Share on other sites

Small edit: I put the full price within the test for reduction (otherwise you sometimes get full price, final price without any reduction shown)

 

So, replace red code above with this:

 

{if $product.price_without_reduction gt $product.price}

{if $product.specific_prices}{assign var='pro_specific_prices' value=$product.specific_prices}

{if $pro_specific_prices.reduction_type eq 'percentage' && ($pro_specific_prices.from eq $pro_specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $pro_specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $pro_specific_prices.from))}

<span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$product.price_without_reduction}{else}{displayWtPrice p=((($product.price_without_reduction) / (1 + ((($product.rate|intval) / 100)|floatval)))|floatval)}{/if}</span>

 

(-{$pro_specific_prices.reduction * 100|floatval}%)

{/if}

{/if}

{/if}

  • Like 1
Link to comment
Share on other sites

hmm,

code checks the following conditions:

1) Full price smaller than reduced price, AND

2) if there is a special price for this product, AND

3) If the reduction type = percentage AND

4a) discount date FROM == discount date TO (i.e. until) (This means no end date-> indefinite discount) OR

4b1) current date <= discount date TO (i.e.until) AND (This means current date inside discount valid date interval)

4b2) current date >= discount date FROM

 

can you check if these conditions are met for the non-showing products?

Link to comment
Share on other sites

Can you check one thing for me?

 

Does it work if you put a FROM date before today, and a TO date say next week? (So today should be a discount day)

 

Does deleting the date work for you? Or do we need to have another look what we can improve?

Link to comment
Share on other sites

Thank you for the help. I'll make nessessery changes to the dates and it will work.. WE can mark this as SOLVED (you aready did that :) )

 

Now the only thing remain thing I have to do with my Prestashop store is to sucsessfuly upgrade from 1.4.9.0. to latest version.... till now no luck.. If you know somebody that colud help with that?

 

Martin

Link to comment
Share on other sites

Hello

 

I also used this code, and it works. Thanks alot!

 

Do you know what to write in css to get a line-through on the old price on productlist?

 

I tried with this one, but it doesn't work:

 

 

ul#product_list li .old_price{

font-size:1.0em;

text-decoration:line-through;

}

 

Regards, Elisa

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

Hi Pascal,

 

how to show price before reduction in featured products (front office)- using lof featured product module? Now is showing only reduction price ( special offer), but I want to have both prices( of course I have price before reduction enebled)

http://www.be-xtreme.eu/shoppresta1/index.php

 

Any idea to solve?

 

Thanks a lot for help.

 

Best regards

Klemen

Link to comment
Share on other sites

Hi Klemen,

Unfortunately, I don't have the lof module code, so that's hard to say...

I might imagine, some code similar to the code mentioned above should be added close to the current discounted price code in the lof file, but as said, I don't have the code here...

 

pascal

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Small edit: I put the full price within the test for reduction (otherwise you sometimes get full price, final price without any reduction shown)

 

So, replace red code above with this:

 

{if $product.price_without_reduction gt $product.price}

{if $product.specific_prices}{assign var='pro_specific_prices' value=$product.specific_prices}

{if $pro_specific_prices.reduction_type eq 'percentage' && ($pro_specific_prices.from eq $pro_specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $pro_specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $pro_specific_prices.from))}

<span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$product.price_without_reduction}{else}{displayWtPrice p=((($product.price_without_reduction) / (1 + ((($product.rate|intval) / 100)|floatval)))|floatval)}{/if}</span>

 

(-{$pro_specific_prices.reduction * 100|floatval}%)

{/if}

{/if}

{/if}

 

Thank you Pascal! worked like magic!

 

www.sperpat.co.id

Link to comment
Share on other sites

Thank you so much PascalVG. The code works great!! I only adjusted it a little for my purpose. I'm including more detailed instructions of my modifications. The attached picture shows what my reduced prices look like (take it just as an example as it's still a testing version of my new shop).

I'm using Prestashop 1.5.4.0.

1) Open themes/default/product-list.tpl and find the following code:

<div class="content_price">

2) Add the following code bellow the above mentioned code:

{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}<span class="price" style="display: inline;">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>{/if}

{if $product.price_without_reduction gt $product.price}
{if $product.specific_prices}{assign var='pro_specific_prices' value=$product.specific_prices}
{if $pro_specific_prices.reduction_type eq 'percentage' && ($pro_specific_prices.from eq $pro_specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $pro_specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $pro_specific_prices.from))}
<span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$product.price_without_reduction}{else}{displayWtPrice p=((($product.price_without_reduction) / (1 + ((($product.rate|intval) / 100)|floatval)))|floatval)}{/if}</span>
<span class="percent">
(-{$pro_specific_prices.reduction * 100|floatval}%) </span>
{/if}
{/if}
{/if}
<br>

3) Open your theme css file and edit values in brackets to look something similar to this (depending on your layout)
#product_list li .content_price {float:left;margin:84px 0 0; width: 220px; line-height: 18px; display: inline}

4) Still in your theme css, add the following :

#product_list li .price-discount{text-decoration: line-through; vertical-align: top;}

#product_list li .percent{vertical-align: top;}

(price-discount is your price before reduction, percent is the percentage of your discount - you can adjust these to suit your needs, e.g. change color, font, text decoration etc.)

That's it. :-)

post-280884-0-03730100-1377911475_thumb.jpg

Edited by mouse1 (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

Ps3z

In my example in post number 8, I show how To make an

- Old price (striked-through)

- reduction percentage/Amount,

- New price.

http://www.prestashop.com/forums/topic/242926-solved-product-list-showing-old-price-reduction-new-price/?view=findpost&p=1203766

 

What exactly do you want to show?

Pascal

i would to show like this

 

100-50 =50tl  %50 discounted. but i will specify old price and discounted last price and percentage will be automatic calculated.

 

http://screencast.com/t/8GOzBxWKRvgU

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

Do I understand right, that you give your discount as a fixed amount, not a percentage, and you want to CALCULATE the percentage?

 

if so, probably something like this:

{if $product.price_without_reduction gt $product.price}

{if $product.specific_prices}{assign var='pro_specific_prices' value=$product.specific_prices}
{if $pro_specific_prices.reduction_type eq 'percentage' && ($pro_specific_prices.from eq $pro_specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $pro_specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $pro_specific_prices.from))}

 

<span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$product.price_without_reduction}{else}{displayWtPrice p=((($product.price_without_reduction) / (1 + ((($product.rate|intval) / 100)|floatval)))|floatval)}{/if}</span>

<span class="reduction_amount"> - {$pro_specific_prices.reduction)}</span>

<span class ="calculated_percentage_reduction"> (-{($pro_specific_prices.reduction|floatval / $product.price_without_reduction|floatval) * 100|floatval}%)

 

{/if}
{/if}
{/if} 

 

Didn't try it, but probably something like that.

Let me know if it works,

pascal

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

Do I understand right, that you give your discount as a fixed amount, not a percentage, and you want to CALCULATE the percentage?

 

if so, probably something like this:

{if $product.price_without_reduction gt $product.price}

 

{if $product.specific_prices}{assign var='pro_specific_prices' value=$product.specific_prices}

{if $pro_specific_prices.reduction_type eq 'percentage' && ($pro_specific_prices.from eq $pro_specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $pro_specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $pro_specific_prices.from))}

 

<span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$product.price_without_reduction}{else}{displayWtPrice p=((($product.price_without_reduction) / (1 + ((($product.rate|intval) / 100)|floatval)))|floatval)}{/if}</span>

 

<span class="reduction_amount"> - {$pro_specific_prices.reduction)}</span>

<span class ="calculated_percentage_reduction"> (-{($pro_specific_prices.reduction|floatval / $product.price_without_reduction|floatval) * 100|floatval}%)

 

{/if}

{/if}

{/if} 

 

Didn't try it, but probably something like that.

Let me know if it works,

pascal

 

 

which line i should add this codes? or i need to replace existing code?

 

http://pastebin.com/gz9TfW5s

 

http://www.worldbazaar.com.tr/tr/ps3-oyun/pes-2013-turkce-ps3-oyun.html

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

  • 1 month later...
  • 2 months later...

 

Thank you so much PascalVG. The code works great!! I only adjusted it a little for my purpose. I'm including more detailed instructions of my modifications. The attached picture shows what my reduced prices look like (take it just as an example as it's still a testing version of my new shop).

 

I'm using Prestashop 1.5.4.0.

 

1) Open themes/default/product-list.tpl and find the following code:

 

<div class="content_price">
2) Add the following code bellow the above mentioned code:

 

{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}<span class="price" style="display: inline;">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>{/if}

{if $product.price_without_reduction gt $product.price}
{if $product.specific_prices}{assign var='pro_specific_prices' value=$product.specific_prices}
{if $pro_specific_prices.reduction_type eq 'percentage' && ($pro_specific_prices.from eq $pro_specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $pro_specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $pro_specific_prices.from))}
<span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$product.price_without_reduction}{else}{displayWtPrice p=((($product.price_without_reduction) / (1 + ((($product.rate|intval) / 100)|floatval)))|floatval)}{/if}</span>
<span class="percent">
(-{$pro_specific_prices.reduction * 100|floatval}%) </span>
{/if}
{/if}
{/if}
<br>
3) Open your theme css file and edit values in brackets to look something similar to this (depending on your layout)
#product_list li .content_price {float:left;margin:84px 0 0; width: 220px; line-height: 18px; display: inline}
4) Still in your theme css, add the following :

 

#product_list li .price-discount{text-decoration: line-through; vertical-align: top;}

#product_list li .percent{vertical-align: top;}
(price-discount is your price before reduction, percent is the percentage of your discount - you can adjust these to suit your needs, e.g. change color, font, text decoration etc.)

 

That's it. :-)

 

 

REALLY REALLY NICE!!!

 

Now I can see the old price and percentage in category view!! THANKS!!

 

One big question now, I see this only works when applied a percentage discount, what can I do to see the old price when apply a discount of amount??

Link to comment
Share on other sites

Hi Caballo,

 

Didn't test it, but probably something like this:

{if $pro_specific_prices.reduction_type eq 'amount' && ($pro_specific_prices.from eq $pro_specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $pro_specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $pro_specific_prices.from))}
<span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$product.price_without_reduction}{else}
  {displayWtPrice p=($pro_specific_prices.reduction|floatval)}

{/if}</span>
<span class="amount">
(-{$pro_specific_prices.reduction * 100|floatval}%) </span>
{/if}

 

 

Hope this does the trick. let me know,

pascal.

Edited by PascalVG
Added missing ) (see edit history)
Link to comment
Share on other sites

  • 5 months later...

Ps3z

In my example in post number 8, I show how To make an

- Old price (striked-through)

- reduction percentage/Amount,

- New price.

http://www.prestashop.com/forums/topic/242926-solved-product-list-showing-old-price-reduction-new-price/?view=findpost&p=1203766

 

What exactly do you want to show?

Pascal

Hi Pascal,

I am using PS1.6.0.9, fresh installation, default theme and I would like to show the price like you said above in product-list.tpl page. 

Currently, it shows the percentage correctly, but not the amount. Please see the attachment no show.jpg.

What I want is, please see attachment good.jpg 

I checked product-list.tpl and found the following code, seems "amount" reduction is missing. 

{if $product.specific_prices.reduction_type == 'percentage'}
<span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>
{/if}
Would you please help to show me what code is needed and where to put in?
Thanks
Kent

post-734648-0-00268000-1407707886_thumb.jpg

post-734648-0-44202700-1407707922_thumb.jpg

  • Like 1
Link to comment
Share on other sites

  • 2 months later...
  • 4 months later...
  • 2 months later...
  • 4 weeks later...

hmm, I don't have the 1.4.9 code here, so that is difficult, but for sure this given in themes/<your theme folder>/product-list.tpl

 

in 1.5.3.1 you have a piece of code like this: (search for the red code in your file)

 

<span class="price" style="display: inline;">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>

 

Here you should add some code to show the full price, discount % and then the discounted price...

 

I think I found it: (Thanks to other reply from NikPraskaton)

 

Add BEFORE the code found above this piece of red code:

 

{if $product.price_without_reduction neq $product.price}

 

<span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$product.price_without_reduction}{else}{displayWtPrice p=((($product.price_without_reduction) / (1 + ((($product.rate|intval) / 100)|floatval)))|floatval)}{/if}</span>

{if $product.specific_prices}{assign var='pro_specific_prices' value=$product.specific_prices}

{if $pro_specific_prices.reduction_type eq 'percentage' && ($pro_specific_prices.from eq $pro_specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $pro_specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $pro_specific_prices.from))}

(-{$pro_specific_prices.reduction * 100|floatval}%)

{/if}

{/if}

{/if}

 

 

<span class="price" style="display: inline;">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>

 

 

This will add the full price and the reduction% within brackets.

Please add and see if it works. We may have to work on the layout a little afterwards, but add the values first, so we can play with it.

 

Hope this does the trick. Let me know...

 

Pascal

Hello Pascal!

 

I'm using PS 1.6.0.9 and a link to the product is this one: http://webshop.bean-bag.se/sittsackar-for-utomhusbruk/76-x5-1200d-beige-komplett-till-ombud.html

 

In my product-list.tpl I have the following code: (There was no "span class="price"" to be found in that file so I assumed it's this part?

 

                                {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}

                                    <span itemprop="price" class="price product-price">

                                        {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}

                                    </span>

                                    <meta itemprop="priceCurrency" content="{$currency->iso_code}" />

                                    {if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}

                                        {hook h="displayProductPriceBlock" product=$product type="old_price"}

                                        <span class="old-price product-price">

                                            {displayWtPrice p=$product.price_without_reduction}

                                        </span>

                                        {if $product.specific_prices.reduction_type == 'percentage'}

                                            <span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>

                                        {/if}

                                    {/if}

                                    {hook h="displayProductPriceBlock" product=$product type="price"}

                                    {hook h="displayProductPriceBlock" product=$product type="unit_price"}

                                {/if}

                            </div>

                        {/if}

                        {if isset($product.new) && $product.new == 1}

 

===============================================

 

I have a "pack" product that is just 15 SEK cheaper than buying the product as two separate items.

What I want is to reduce prices further when they buy more than one.

Say I want total discount to be 5% when they order 2 pcs, 10% when they buy 3 and 15% when they order 4 etc.

 

If I make price rules for this customers DO get this discount in the cart but I want them to see the discounts (and unit prices) directly when they change quantity on the product page.  In the cart they can't even see that they got a discount unless they take total price and divide this by the quatity they ordered. Well, they can't see the discount but how low the price was each.  To get the discount they need to do further calculations.

 

What I found out was that EVERYTHING worked great if I started the discount allready on 1 item. Then the discount shows just like it should.

However, it does not change when I change amount ordered and I DON'T want any discount when they just buy ONE.  :(

 

Hope you understand and can find a solution.  ;)

 

BTW, it's the same for normal products so it's NOT a "pack" issue.

 

Regards,

Johan in Sweden

 

Edited by Mr.Bean_S (see edit history)
Link to comment
Share on other sites

Oh, I forgot!

If you scroll down on that product page you can see the discounts but I would like them in both places and I wouldn't mind if the one on the bottom showed both unit save AND total save.  ;)
Have not checked if the discount appear on the product lines on the order or if they just show the end price. Anyone know?

Link to comment
Share on other sites

  • 2 weeks later...

Hi Pascal,

 

great, it works for me, exapt sometimes at some products shows 2  same prices instead just one- basicly is just original price  and no other. I can't figure it out why is that? Do you maybe have any idea?

http://www.be-xtreme.eu/shop/index.php?id_category=6&controller=category&id_lang=1

(second row- first product)

Thanks a lot for reply.

 

Klemen

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