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

Product original price & discount price

Started by cvrak, June 06, 2017, 19:33:48 PM

Previous topic - Next topic

cvrak

Hi,

Joomla 3.7.0, VM 3.2.2  PHP 7.0.19
URL: www.greecery.gr

I'm trying to set discounts for certain products. Not % discount, but specific amount different for every product.
At the frontend I need to show original price with a strikethrough and the discount price.
I've searched a lot in the forum, but I'm confused since most of the posts are referring to old Joomla and Vm versions.
According to https://forum.virtuemart.net/index.php?topic=96175.0 and tobisagt' post I did the following:

At currencydisplay.php in administrator/components/com_virtuemart/helpers/ I've added the following code:

// ==
// START MODIFICATION
// ==

// 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 == "basePriceWithTax")
{
// Checks if there is a discount.
if(!empty($product_price['discountAmount']))
{
// Discount exist: Show Price with Tax and with an extended CSS class
$css = "red";
return '<div class="Price'.$name.'" style="display : '.$vis.';" >'.$descr.'<span class="Price'.$name.' '.$css.'" >'.$product_price[$name].'</span></div>';
}
}

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

I also, in VM/Settings/Pricing I've set "base price with tax but no discounts" & "Final price to be visible".

As you can see in attached pic, I almost get what I want, since "base price with tax but no discounts" returns "0" strikethrough.
I don't know much of programming, but I understand that it reads something wrong, returning zero.
The page's URL is http://bit.ly/2rR0f64 (I used bit.ly because of the Greek text)

How this can be solved?
Pls advice.

Regards
Chris

aftertaf

how are you applying the discounts ?
via calculation rules and category nesting?

If you've applied the discount correctly, then you should see the prices (original barred and actual, unbarred..) - if they are set to be displayed in the VM configuration..

show us a screenshot of the product in backend, maybe would help...

cvrak

Quote from: aftertaf on June 06, 2017, 21:52:22 PM
how are you applying the discounts ?
via calculation rules and category nesting?

If you've applied the discount correctly, then you should see the prices (original barred and actual, unbarred..) - if they are set to be displayed in the VM configuration..

show us a screenshot of the product in backend, maybe would help...

I don't use calculation rules, because I don't want percentage discount. I want some products with some discount.
For the specific product, original price is 1.2 Euro, and the discount price is 1 Euro. You can see the screenshot.
Is this the wrong way for discounts?

cvrak

Also the screenshot of configuration of pricing

aftertaf

calc rules are not only for %age reductions..

cvrak

Quote from: aftertaf on June 07, 2017, 23:40:19 PM
calc rules are not only for %age reductions..

Pls, can you explain?
As far as I've read the documentation calc rules apply with a percentage.
Can you tell me what settings i have to use for different discount (0.20 up to 0.80 Euro) to different products?

Jörgen

Choose + and - instead of +% and -%.  ;)

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

cvrak

Quote from: Jörgen on June 08, 2017, 10:05:43 AM
Choose + and - instead of +% and -%.  ;)

regards

Jörgen @ Kreativ Fotografi

Hi Jorgen, thanks for tip.
I managed to display original and discount price, with the settings you can see at attached pics.
Now, I face a strange problem: The original price uses "." instead of "," for Greek decimal, and is not displaying the "€" symbol. But, when I increase the quantity, it's Ok!! See attached pic, product 1 & 2
The page's URL for checking is http://bit.ly/2rR0f64 (I used bit.ly because of the Greek text)


Any ideas what's wrong?
Thanks in advance.

Jörgen

Don´t know why it does that, but try to uncheck the override final price and see what happens.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

cvrak

Quote from: Jörgen on June 08, 2017, 12:55:52 PM
Don´t know why it does that, but try to uncheck the override final price and see what happens.

regards

Jörgen @ Kreativ Fotografi

If I uncheck "override final price" there is not any discount.
Any ideas?

Jörgen

The calculation rule does not seem to be activated because value = 0. Add value to the discount value in the calculation rule.

Example:
Create a category called Discount 0,5 €, to discount 0,5 €. (unpublished)
Add this category to the discount rule that has 0,5€ discount.
Add all Products that you want to have 0,5€ to this category.
Untick override final will then use the calculation rules, guided by categories of course.

You can add a 2€ category, 5€ and so on. To create 0,5 + 2 + 5 = 7 € discounts. You can combine how You want. Even have negative discounts to make exceptions.

Do You get what I mean?

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

cvrak

Quote from: Jörgen on June 08, 2017, 14:29:03 PM
The calculation rule does not seem to be activated because value = 0. Add value to the discount value in the calculation rule.

Example:
Create a category called Discount 0,5 €, to discount 0,5 €. (unpublished)
Add this category to the discount rule that has 0,5€ discount.
Add all Products that you want to have 0,5€ to this category.
Untick override final will then use the calculation rules, guided by categories of course.

You can add a 2€ category, 5€ and so on. To create 0,5 + 2 + 5 = 7 € discounts. You can combine how You want. Even have negative discounts to make exceptions.

Do You get what I mean?

regards

Jörgen @ Kreativ Fotografi

I did what you propose, but it's not working. Only the discount price is shown!
It's very frustrating that such a good component as VM, has such difficulty to create a simple discount, and there is no documentation for this.

Jörgen

This should be working. I show the same prices and use calculation rules for both VAT and discount.

But You have to untick Overwrite final, this sets the calculation rules out of play.

You can start here:
https://docs.virtuemart.net/manual/products-menu/taxes-and-calculation-rules.html

regards

Jörgen @ Kreativ Fotografi


Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

jenkinhill

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

aftertaf

Quote from: jenkinhill on June 08, 2017, 23:22:59 PM
Quote from: cvrak on June 08, 2017, 17:29:48 PM
there is no documentation for this.

Same as tax setup by categories:  https://docs.virtuemart.net/manual/general-concepts/204-tax-and-calculation-rules-overview.html

Hi,
side-question : the doc post you made...

"

CHILD PRODUCTS OFTEN HAVE NO CATEGORIES, HOW TO HANDLE THAT?

A child product does inherit the categories from the parent. You need to set a category to a child product only, when you want that a child product is browseable. This is the case if your parent is used as product pattern. In the other case, when the children are used for variants, you usually do not set any category and let the parent handle it.

"
I added the emphasis... How do we do this to a category? Something stupidly obvious I can't find?
:)