Author Topic: Product original price & discount price  (Read 1378 times)

cvrak

  • Jr. Member
  • **
  • Posts: 52
  • A beginner
Product original price & discount price
« 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

aftertaf

  • Jr. Member
  • **
  • Posts: 147
    • sO couture
  • VirtueMart Version: 3.2.4
Re: Product original price & discount price
« Reply #1 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...
Webmaster for my wife
Long live joomla, virtuemart and open source in general.
usually latest version of VM & J!
Using POSForWebshops, TemplatecreatorCK, MaximenuCK, VM BatchEdit Pro among other things...
VM 3.2.4, PHP Version 7.0.18-1~dotdeb+8.1, mariadb 10.1.22 Joomla! 3.8.1

cvrak

  • Jr. Member
  • **
  • Posts: 52
  • A beginner
Re: Product original price & discount price
« Reply #2 on: June 07, 2017, 09:07:14 am »
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

  • Jr. Member
  • **
  • Posts: 52
  • A beginner
Re: Product original price & discount price
« Reply #3 on: June 07, 2017, 09:11:20 am »
Also the screenshot of configuration of pricing

aftertaf

  • Jr. Member
  • **
  • Posts: 147
    • sO couture
  • VirtueMart Version: 3.2.4
Re: Product original price & discount price
« Reply #4 on: June 07, 2017, 23:40:19 pm »
calc rules are not only for %age reductions..
Webmaster for my wife
Long live joomla, virtuemart and open source in general.
usually latest version of VM & J!
Using POSForWebshops, TemplatecreatorCK, MaximenuCK, VM BatchEdit Pro among other things...
VM 3.2.4, PHP Version 7.0.18-1~dotdeb+8.1, mariadb 10.1.22 Joomla! 3.8.1

cvrak

  • Jr. Member
  • **
  • Posts: 52
  • A beginner
Re: Product original price & discount price
« Reply #5 on: June 08, 2017, 09:06:52 am »
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

  • Global Moderator
  • Full Member
  • *
  • Posts: 1103
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.6
Re: Product original price & discount price
« Reply #6 on: June 08, 2017, 10:05:43 am »
Choose + and - instead of +% and -%.  ;)

regards

Jörgen @ Kreativ Fotografi
Joomla 3.8.2
Virtuemart 3.2.6
Olympiantheme Hera (customized)

cvrak

  • Jr. Member
  • **
  • Posts: 52
  • A beginner
Re: Product original price & discount price
« Reply #7 on: June 08, 2017, 11:56:49 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

  • Global Moderator
  • Full Member
  • *
  • Posts: 1103
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.6
Re: Product original price & discount price
« Reply #8 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
Joomla 3.8.2
Virtuemart 3.2.6
Olympiantheme Hera (customized)

cvrak

  • Jr. Member
  • **
  • Posts: 52
  • A beginner
Re: Product original price & discount price
« Reply #9 on: June 08, 2017, 13:36:58 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

  • Global Moderator
  • Full Member
  • *
  • Posts: 1103
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.6
Re: Product original price & discount price
« Reply #10 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
Joomla 3.8.2
Virtuemart 3.2.6
Olympiantheme Hera (customized)

cvrak

  • Jr. Member
  • **
  • Posts: 52
  • A beginner
Re: Product original price & discount price
« Reply #11 on: June 08, 2017, 17:29:48 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

  • Global Moderator
  • Full Member
  • *
  • Posts: 1103
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.6
Re: Product original price & discount price
« Reply #12 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

regards

Jörgen @ Kreativ Fotografi


Joomla 3.8.2
Virtuemart 3.2.6
Olympiantheme Hera (customized)

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26372
  • Always on vacation
    • Jenkin Hill Internet
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VM3.2.6 on Joomla 3.8.2 PHP 7.0.25

Testing VM3.2.6 on J!4alpha1

aftertaf

  • Jr. Member
  • **
  • Posts: 147
    • sO couture
  • VirtueMart Version: 3.2.4
Re: Product original price & discount price
« Reply #14 on: June 12, 2017, 20:25:45 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?
:)

Webmaster for my wife
Long live joomla, virtuemart and open source in general.
usually latest version of VM & J!
Using POSForWebshops, TemplatecreatorCK, MaximenuCK, VM BatchEdit Pro among other things...
VM 3.2.4, PHP Version 7.0.18-1~dotdeb+8.1, mariadb 10.1.22 Joomla! 3.8.1