VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: cvrak on June 06, 2017, 19:33:48 PM

Title: Product original price & discount price
Post by: cvrak on June 06, 2017, 19:33:48 PM
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
Title: Re: Product original price & discount price
Post by: 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...
Title: Re: Product original price & discount price
Post by: cvrak on June 07, 2017, 09:07:14 AM
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?
Title: Re: Product original price & discount price
Post by: cvrak on June 07, 2017, 09:11:20 AM
Also the screenshot of configuration of pricing
Title: Re: Product original price & discount price
Post by: aftertaf on June 07, 2017, 23:40:19 PM
calc rules are not only for %age reductions..
Title: Re: Product original price & discount price
Post by: cvrak on June 08, 2017, 09:06:52 AM
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?
Title: Re: Product original price & discount price
Post by: Jörgen on June 08, 2017, 10:05:43 AM
Choose + and - instead of +% and -%.  ;)

regards

Jörgen @ Kreativ Fotografi
Title: Re: Product original price & discount price
Post by: cvrak on June 08, 2017, 11:56:49 AM
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.
Title: Re: Product original price & discount price
Post by: 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
Title: Re: Product original price & discount price
Post by: cvrak on June 08, 2017, 13:36:58 PM
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?
Title: Re: Product original price & discount price
Post by: 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
Title: Re: Product original price & discount price
Post by: cvrak on June 08, 2017, 17:29:48 PM
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.
Title: Re: Product original price & discount price
Post by: Jörgen on June 08, 2017, 23:07:50 PM
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 (https://docs.virtuemart.net/manual/products-menu/taxes-and-calculation-rules.html)

regards

Jörgen @ Kreativ Fotografi


Title: Re: Product original price & discount price
Post by: 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
Title: Re: Product original price & discount price
Post by: aftertaf on June 12, 2017, 20:25:45 PM
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?
:)

Title: Re: Product original price & discount price
Post by: Jörgen on June 12, 2017, 20:39:48 PM
If You are OK with the same categories that the parent has, there is no problem. It inherits parent category. f.ex discount. But if You want the child to have another discount category, then I am stumped. Would like to hear any oppinion over this.

Regards
Jörgen @ Kreativ Fotografi