VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: vm14 on January 23, 2014, 17:59:17 PM

Title: Please help me !!! I need a discount in Percentage 2.024c (still unresolved !!)
Post by: vm14 on January 23, 2014, 17:59:17 PM
Good day ,

I have problem with VM.I have version 2.024 c.I need get discount price in percentage.I tried all tutorials on this website,but these tutorials are for lowest version VM.
For me doesnt work these tutorials.I think,if VM consist this function in administration.But I not found nothing. Do you have any solution? Thank you very much everybody
Title: Re: Please help me !!! I need a discount in Percentage 2.024c
Post by: jenkinhill on January 23, 2014, 18:56:09 PM
There are tutorials for adding complex tax (http://docs.virtuemart.net/tutorials/31-administration-configuration-vm-2/109-taxes-calculation-rules-case-1.html), but discount etc is so simple.

Go to Products/Tax & Calculation rules. Set up a new rule.
Enter a Calculation Rule name and select published.
For Type of Arithmetic Operation select  Price modifier, either before or after tax. Math Operation:  -% and set the Value, eg 5 to give 5%. Select category, shopper group etc only if you need to use them.

Save and apply to products that need discount by applying to Base price or Final price in the Prduct editor.
Title: Re: Please help me !!! I need a discount in Percentage 2.024c
Post by: vm14 on January 23, 2014, 20:07:25 PM
Quote from: jenkinhill on January 23, 2014, 18:56:09 PM
There are tutorials for adding complex tax (http://docs.virtuemart.net/tutorials/31-administration-configuration-vm-2/109-taxes-calculation-rules-case-1.html), but discount etc is so simple.

Go to Products/Tax & Calculation rules. Set up a new rule.
Enter a Calculation Rule name and select published.
For Type of Arithmetic Operation select  Price modifier, either before or after tax. Math Operation:  -% and set the Value, eg 5 to give 5%. Select category, shopper group etc only if you need to use them.

Save and apply to products that need discount by applying to Base price or Final price in the Prduct editor.

Thank you for answer,but
i am bad explained.I need discount in percentage on the website in detailproduct  on the display.Where it is shows in numeric number .This is what I need to change the percetange.
For certainly I upload image.After this is same for categories in view discount i percantage!!!
(http://trekkershop.cz/problem.jpg)


Title: Re: Please help me !!! I need a discount in Percentage 2.024c (still unresolved !!)
Post by: AH on February 13, 2014, 21:05:40 PM
Create an override
This might work for you:-

templates/your template/html/com_virtuemart/productdetails/default_showprices.php

Then add this to the pricing layout


//quorvia created discount percentage calculation and display to replace the discount value
if (round($this->product->prices['discountAmount'] != 0 )) {
$discount_percent = round(($this->product->prices['basePriceWithTax'] - $this->product->prices['salesPrice']) * 100 / $this->product->prices['basePriceWithTax']);
?>
        <div class="discountAmount">
            Save <?php echo $discount_percent?>%
        </div>
<?php
}



It works for me and the "div" allow you to position and color as required