Author Topic: Discount Pricing Display  (Read 13256 times)

Coltras

  • Beginner
  • *
  • Posts: 16
Discount Pricing Display
« on: February 07, 2012, 15:12:55 pm »
On VM v.1 when you set a discount on a product, it would automatically display:

Was: £xx.xx
Discount £xx.xx
Now: £xx.xx

But if there was no discount it would just show £xx.xx However on VM2 as far as i can see, it doesn't do this and you have to have those three price breaks showing even if the product isn't discounted. Is there a setting to change this?

Mole_LR

  • Beginner
  • *
  • Posts: 34
Re: Discount Pricing Display
« Reply #1 on: February 08, 2012, 14:41:31 pm »
[EDITED 08.02.2012. 16.33]
It killed me too...
I'm using Joomla 2.5.1. and VirtueMart 2.0.1e!

I do not know why even on VM 2.0.1e there is no by default such inormation to show 1 price (Base price or Base price with Tax - depends on what U choose in MV 2 configuration for Prices) if there is no discount and show 3 prices (Base Price or Base price with Tax, Discount amount and Sales price depends on what U choose in MV 2 configuration for Prices).

I found this solution (thank U tobisagt): http://forum.virtuemart.net/index.php?topic=96175.0

i change/customize for me like this:
1.)Go to Yours template css and add (I use 2 css: template css + additional css for virtuemart in my css folder (not using default VM css):
Code: [Select]
.sales-price
{
color: red;
}
.old-price
{
color: black;
text-decoration: line-through;
}

2.)Go to administrator/components/com_virtuemart/helpers/, open file currencydisplay.php, then find line with "vmdebug('createPriceDiv $name '.$name.' '.$product_price[$name]);" and directly bellow add this:
Code: [Select]
// ==
// START MODIFICATION for showing - 1 price (if there is no discount) or 3 prices (is there is discount)
// ==

// Checks if there is a discount.
if ($name == "discountAmount" && $vis == "none")
{
// If discount is empty (discountAmount) (display: none) it gives you an empty string instead of <div>
return "";
}

// If you have an discount and want to show the Price with Tax
if ($name == "basePrice")
{
// Checks if there is a discount.
if(!empty($product_price['discountAmount']))
{
 // Discount exist: Show Price with Tax and with an extended CSS class
 return $descr.$product_price[$name];
 }
}

// ==
// END MODIFICATION
// ==

3.)Then open your VM template files (/joomla-root/templates/your-template/html/com-virtuemart/productdetails or category (after Your need and wish) default.php.
For productdetail/default.php find this code :
"
// Product Price
            if ($this->show_prices) { ?>
            <div class="product-price" id="productPrice<?php echo $this->product->virtuemart_product_id ?>">
            <?php
            if ($this->product->product_unit && VmConfig::get ( 'price_show_packaging_pricelabel' )) {
               echo "<strong>" . JText::_ ( 'COM_VIRTUEMART_CART_PRICE_PER_UNIT' ) . ' (' . $this->product->product_unit . "):</strong>";
            } else {
               echo "<strong>" . JText::_ ( 'COM_VIRTUEMART_CART_PRICE' ) . "</strong>";
            }
"
directly bellow add this code:
Code: [Select]
//START My modifications for showing prices!!!
?>
<div class="old-price">
<?php echo $this->currency->createPriceDiv 'basePrice''COM_VIRTUEMART_PRODUCT_BASEPRICE'$this->product->prices ); ?>
</div>
<div class="sales-price">
<?php echo $this->currency->createPriceDiv 'salesPrice''COM_VIRTUEMART_PRODUCT_SALESPRICE'$this->product->prices ); ?>
</div>
<?php echo $this->currency->createPriceDiv 'discountAmount''COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT'$this->product->prices ); ?>

</div>
<?php ?>
//END My modifications for showing prices!!!
?>
In my case there is no code for price section and after that starts Add To Cart Button section etc...

For category/default.php find this code
"
               <div class="product-price marginbottom12" id="productPrice<?php echo $product->virtuemart_product_id ?>">
               <?php
               if ($this->show_prices == '1') {
                  if( $product->product_unit && VmConfig::get('vm_price_show_packaging_pricelabel')) {
                     echo "<strong>". JText::_('COM_VIRTUEMART_CART_PRICE_PER_UNIT').' ('.$product->product_unit."):</strong>";
                  }
"
and directly bellow add this code:
Code: [Select]
//START My modifications for showing prices!!!

if ($this->currency->createPriceDiv('discountAmount','COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT',$product->prices))
{
?>
<div class="old-price"> <?php echo $this->currency->createPriceDiv('basePrice','COM_VIRTUEMART_PRODUCT_BASEPRICE',$product->prices);?>
</div>
<?php echo $this->currency->createPriceDiv('discountAmount','COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT',$product->prices); ?>
<div class="sales-price"> <?php echo $this->currency->createPriceDiv('salesPrice','COM_VIRTUEMART_PRODUCT_SALESPRICE',$product->prices);?>
</div>
<?php
}
else

echo $this->currency->createPriceDiv('basePrice','COM_VIRTUEMART_PRODUCT_BASEPRICE',$product->prices);
}

//END My modifications for showing prices!!!
?>

</div>
U have to delete (or comment out) all createPriceDiv which U do not need and after that there should be only starting <p> for Product Details Button section
After Your need and wish U can customize css for these 2 classes or add 1 extra class for DiscountAmount etc...

Hope this helps...

But question to VM team - why by default it could not be done without hacking VM core files (for checkin prices and then ad SalesPrice)?

Coltras

  • Beginner
  • *
  • Posts: 16
Re: Discount Pricing Display
« Reply #2 on: February 08, 2012, 15:30:22 pm »
Thank you for this, i will go through it this way! But yes i agree why do we have to hack core files for a basic function that was in v.1 !!

jmelwak

  • Jr. Member
  • **
  • Posts: 72
Re: Discount Pricing Display
« Reply #3 on: February 16, 2012, 03:14:19 am »
this is so annoying i cannot get base price to show, you would think they fix this bug before release!

tutyi

  • Beginner
  • *
  • Posts: 11
Re: Discount Pricing Display
« Reply #4 on: March 07, 2012, 11:22:04 am »
Hi, I've followed the instructions above but did not work on J2.5.2 + VM2.0.2

hope1

  • Beginner
  • *
  • Posts: 1
Re: Discount Pricing Display
« Reply #5 on: March 22, 2012, 09:10:38 am »
Hi, I did this modification and it works almost fine - when there is discount everything is fine, but if there is no discount it shows old price ( in my case crossed out ) as well as actual price:

It look like this:
Before discount: 15 euro
Price: 15 euro

Can anyone help me??

J1.7, VM 2.0.3

tichor

  • Beginner
  • *
  • Posts: 2
Re: Discount Pricing Display
« Reply #6 on: April 03, 2012, 13:00:59 pm »
Hello

I can't find  in category/default.php  this code:
Code: [Select]
   <div class="product-price marginbottom12" id="productPrice<?php echo $product->virtuemart_product_id ?>">
               <?php
               
if ($this->show_prices == '1') {
                  if( 
$product->product_unit && VmConfig::get('vm_price_show_packaging_pricelabel')) {
                     echo 
"<strong>"JText::_('COM_VIRTUEMART_CART_PRICE_PER_UNIT').' ('.$product->product_unit."):</strong>";
                  }

What should I do ?
Thx in advance

RevoLion

  • Jr. Member
  • **
  • Posts: 67
  • Joomla Covert Operations
Re: Discount Pricing Display
« Reply #7 on: April 10, 2012, 01:19:55 am »
I am using Joomla 1.5 and VM 1.1.9 and for some reason even though I have no discount selected, but I have price in my store it is showing two prices in product details. It show my price and then 0.00 with a line through it. how do I get the zeros with the line through it to go away?

Thanks for any help,
Jeremy

Tim Zuidgeest

  • Beginner
  • *
  • Posts: 8
Re: Discount Pricing Display
« Reply #8 on: October 14, 2013, 12:37:46 pm »
So I was strugge
Hi, I did this modification and it works almost fine - when there is discount everything is fine, but if there is no discount it shows old price ( in my case crossed out ) as well as actual price:

It look like this:
Before discount: 15 euro
Price: 15 euro

Can anyone help me??

J1.7, VM 2.0.3

I was struggeling with the same problem. Turns out it's the 'round price' option that screws with it! Turn it off, and it works.
http://www.gavick.com/forums/yourshop/base-price-with-tax-always-displayed-even-without-discount-26886.html

Cheers!

mrblonde

  • Beginner
  • *
  • Posts: 7
Re: Discount Pricing Display
« Reply #9 on: September 15, 2014, 05:56:24 am »
So I was strugge
Hi, I did this modification and it works almost fine - when there is discount everything is fine, but if there is no discount it shows old price ( in my case crossed out ) as well as actual price:

It look like this:
Before discount: 15 euro
Price: 15 euro

Can anyone help me??

J1.7, VM 2.0.3

I was struggeling with the same problem. Turns out it's the 'round price' option that screws with it! Turn it off, and it works.
http://www.gavick.com/forums/yourshop/base-price-with-tax-always-displayed-even-without-discount-26886.html

Cheers!


Thank you so much for posting this!  I've been looking for weeks about how to solve this.