This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

mwindey

  • *****
  • 482 posts
Display price old and new
« on: November 15, 2021, 08:31:41 PM »
I'm wondering if there is any plugin that shows the price of a listing like old price and current price.
Osclasspoint is using this as in attachment.... If it doesn't exist i have to do it myself  ::)  :D

*

MB Themes

Re: Display price old and new
« Reply #1 on: November 15, 2021, 10:18:32 PM »
@mwindey
Today introduced Price Comparison Plugin has feature to store "old price" when listing is modified.
It can be easily shown in theme using:
Code: [Select]
<?php echo pcm_item_old_price(); ?>
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

MB Themes

Re: Display price old and new
« Reply #2 on: November 16, 2021, 11:00:40 AM »
@mwindey
Thank you, old price was updating everytime, no matter if it was same or no.
We have updated plugin to change old price just in case price has changed.
You can download update in v1.0.1  8)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

mwindey

  • *****
  • 482 posts
Re: Display price old and new
« Reply #3 on: November 16, 2021, 12:25:46 PM »
@MB Themes

Cool, thanks! Super plugin by the way and just delivered in time of needs  :D
I still have one question and that is that it shows every time even when there is no price change....
Can i hide the div in my code you think so it only shows when there is a price change??
Now i have a new div id in css called price_old:
Code: [Select]
        <div id="price_old" class="round3 i-shadow<?php if(function_exists('pcm_item_old_price')) { echo pcm_item_old_price($item_id NULL$format true); } ?>">
          <i class="fa fa-tags"></i>
          <span class="long-price-fix"><p style = "text-decoration:line-through;"><?php echo pcm_item_old_price(); ?></p></span>
        </div>
           
        <div id="price" class="round3 i-shadow<?php if(function_exists('multicurrency_add_prices') && osc_item_price() <> '' && osc_item_price() > 0) { ?> mc<?php ?>">
          <i class="fa fa-tags"></i>
          <span class="long-price-fix"><?php echo osc_item_formated_price(); ?></span>
        </div>

*

MB Themes

Re: Display price old and new
« Reply #4 on: November 16, 2021, 01:17:37 PM »
@mwindey
Condition would be:
Code: [Select]
if(floatval(osc_item_price()) <> floatval(pcm_item_old_price(NULL, false)) {
not quite sure here if osc_item_price is multiplied by 1 000 000 or no ;)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

mwindey

  • *****
  • 482 posts
Re: Display price old and new
« Reply #5 on: November 16, 2021, 03:13:55 PM »
@MB Themes,

I have tried with:
Code: [Select]
      <?php if(floatval(osc_item_price()) <> floatval(pcm_item_old_price(NULLfalse))) { ?>

        <div id="price_old" class="round3 i-shadow<?php if(function_exists('pcm_item_old_price')) { echo pcm_item_old_price($item_id NULL$format true); } ?>">
          <i class="fa fa-tags"></i>
          <span class="long-price-fix"><p style = "text-decoration:line-through;"><?php echo pcm_item_old_price(); ?></p></span>
        </div>
           
        <div id="price" class="round3 i-shadow<?php if(function_exists('multicurrency_add_prices') && osc_item_price() <> '' && osc_item_price() > 0) { ?> mc<?php ?>">
          <i class="fa fa-tags"></i>
          <span class="long-price-fix"><?php echo osc_item_formated_price(); ?></span>
        </div>

        <?php } else { ?>

        <div id="price" class="round3 i-shadow<?php if(function_exists('multicurrency_add_prices') && osc_item_price() <> '' && osc_item_price() > 0) { ?> mc<?php ?>">
          <i class="fa fa-tags"></i>
          <span class="long-price-fix"><?php echo osc_item_formated_price(); ?></span>
        </div>
But the div id="price_old" still shows ...without price in the grey part and that is correct but i want to hide the complete div if no price change was made... is that possible you think??? Thanks ...
« Last Edit: November 16, 2021, 03:19:19 PM by mwindey »

*

MB Themes

Re: Display price old and new
« Reply #6 on: November 16, 2021, 03:27:56 PM »
Try
Code: [Select]
if(floatval(osc_item_price()/1000000) <> floatval(pcm_item_old_price(NULL, false)) {
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

mwindey

  • *****
  • 482 posts
Re: Display price old and new
« Reply #7 on: November 16, 2021, 03:51:29 PM »
Same as before   :'( I will continue until i solved it  :D there must be a way to hide the grey div somehow  ;D
Anyway i appreciate your great help, even though it is not a plugin problem because that works super.....

*

MB Themes

Re: Display price old and new
« Reply #8 on: November 16, 2021, 04:10:42 PM »
@mwindey
Print those 2 functions just to see what values they have ;)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

mwindey

  • *****
  • 482 posts
Re: Display price old and new
« Reply #9 on: November 16, 2021, 05:19:27 PM »
first value 580 second value 0
so it checks the 2 values correctly.... When price changes value is 520 second 580 so that is correct.....
« Last Edit: November 16, 2021, 05:24:12 PM by mwindey »

Marked as best answer by frosticek on November 18, 2021, 08:53:06 AM
*

mwindey

  • *****
  • 482 posts
Re: Display price old and new
« Reply #10 on: November 17, 2021, 11:59:06 AM »
SOLVED  :D :D

If value in tables is null / false or have same value then only show price ...else if tables is not equal show more div...

 
Code: [Select]
      <?php if($content_only == 0) { ?>
       <div id="side-right">
         <div id="price" class="round3 i-shadow<?php if(function_exists('multicurrency_add_prices') && osc_item_price() <> '' && osc_item_price() > 0) { ?> mc<?php ?>">
         <i class="fa fa-tags"></i>
         <span class="long-price-fix"><?php echo osc_item_formated_price(); ?></span>
        </div>

      <?php if(function_exists('pcm_item_old_price')) { ?>
      <?php if(floatval(pcm_item_old_price(NULLfalse) <> floatval(pcm_item_old_price()))) { ?>
        <div id="price_old" class="round3 i-shadow<?php if(function_exists('pcm_item_old_price')) { echo pcm_item_old_price($item_id NULL$format true); } ?>">
        <i class="fa fa-tags"></i>
        <span class="long-price-fix"><p style = "text-decoration:line-through;"><?php echo pcm_item_old_price(); ?></p></span>
        </div>
      <?php ?>
« Last Edit: November 30, 2021, 11:57:51 AM by mwindey »

*

MB Themes

Re: Display price old and new
« Reply #11 on: November 18, 2021, 08:52:58 AM »
Glad to hear that, looks nice!
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots