News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Please help me !!! I need a discount in Percentage 2.024c (still unresolved !!)

Started by vm14, January 23, 2014, 17:59:17 PM

Previous topic - Next topic

vm14

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

jenkinhill

There are tutorials for adding complex tax, 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.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

vm14

Quote from: jenkinhill on January 23, 2014, 18:56:09 PM
There are tutorials for adding complex tax, 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!!!




AH

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
Regards
A

Joomla 4.4.5
php 8.1