From 4c62cff5dc15e051d587ab409bba51d40d8957ec Mon Sep 17 00:00:00 2001 From: Moggach Date: Mon, 15 Jul 2024 17:34:53 +0000 Subject: [PATCH] discounted prices in drop down selector menu now have strikethrough effect --- app/templates/app/includes/cart_options.html | 3 ++- app/templatetags/books.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/templates/app/includes/cart_options.html b/app/templates/app/includes/cart_options.html index a032c04..a6db046 100644 --- a/app/templates/app/includes/cart_options.html +++ b/app/templates/app/includes/cart_options.html @@ -29,7 +29,8 @@ {% if variant.title != "Default Title" %}{{ variant.title }} -{% endif %} {% money_localize variant.price "GBP" %} {% if variant.compare_at_price is not None %} - {% money_localize variant.compare_at_price "GBP" %} + {% money_localize variant.compare_at_price "GBP" as localized_compare_price %} + {{ localized_compare_price|strikethrough }} {% endif %} {% endfor %} diff --git a/app/templatetags/books.py b/app/templatetags/books.py index 528faad..0c6e039 100644 --- a/app/templatetags/books.py +++ b/app/templatetags/books.py @@ -28,3 +28,8 @@ def get_books(since=None, types=None, limit=None): @register.simple_tag def get_merch(): return MerchandisePage.objects.live().public() + +@register.filter(name='strikethrough') +def strikethrough(text): + """Convert text to strikethrough using Unicode characters.""" + return ''.join(char + '\u0336' for char in str(text)) \ No newline at end of file