Comments

zenimagine created an issue. See original summary.

trebormc’s picture

Status: Active » Needs work

Right now I don't have time to develop this functionality.
Although I would love to see a patch with this functionality and thus be able to make a better module ;)

csedax90’s picture

Status: Needs work » Needs review
StatusFileSize
new8.64 KB

Please test this:

csedax90’s picture

StatusFileSize
new5.08 KB

Reroll with better template variables

csedax90’s picture

loze’s picture

This works well for me
+1

loze’s picture

I've added a few things to this.

  • Added a variable discount_currency to display the currency amount of the discount. ( "-$50.00" vs "-20%")
  • Moved the "-" that was in front of the percentage to the twig template instead of the variable. Since there may be cases when you want to display it as something like "You Save: 20%"
  • Added configuration options on the field settings to enable either "percentage discount" and "currency discount" (or both or none) per field.
loze’s picture

There was a issue in the logic of the last patch.

Here's an updated version. It cleans up a few unneeded variables, and uses better coding standard practices.
also renames the template to just price-difference-formatter.html.twig
I've documented the twig variables in the template file.

Thanks.

loze’s picture

csedax90’s picture

StatusFileSize
new8.82 KB

I've extended latest patch adding adjustments as template variable (useful example for adding conditional tax info)

loze’s picture

awesome. looks good.

csedax90’s picture

Someone is still supporting this module? @trebormc can you test our patches?

nattyweb’s picture

#10 worked perfectly for me. Thank you @csedax90.
I'm using Commerce 8.x-2.23 with Drupal 8.9.13.

nevergone’s picture

StatusFileSize
new8.7 KB

Fix patch (delete embedded patch file and unnecessary white space).

trebormc’s picture

Status: Needs review » Fixed

Thanks for your time.
I have applied the changes

trebormc’s picture

Status: Fixed » Closed (fixed)