Changeset 1768
- Timestamp:
- 12/04/2008 04:12:27 PM (7 months ago)
- Files:
-
- satchmo/trunk/satchmo/discount/templatetags/satchmo_discounts.py (modified) (5 diffs)
- satchmo/trunk/satchmo/discount/utils.py (modified) (2 diffs)
- satchmo/trunk/satchmo/product/utils.py (modified) (6 diffs)
- satchmo/trunk/satchmo/settings-customize.py (modified) (1 diff)
- satchmo/trunk/satchmo/shop/context_processors.py (modified) (3 diffs)
- satchmo/trunk/satchmo/shop/notification.py (modified) (2 diffs)
- satchmo/trunk/satchmo/shop/signals.py (modified) (1 diff)
- satchmo/trunk/satchmo/static/js/satchmo_product.js (modified) (2 diffs)
- satchmo/trunk/satchmo/tax/templatetags/satchmo_tax.py (modified) (2 diffs)
- satchmo/trunk/satchmo/templates/base.html (modified) (2 diffs)
- satchmo/trunk/satchmo/templates/base_cart.html (modified) (3 diffs)
- satchmo/trunk/satchmo/templates/base_product.html (modified) (2 diffs)
- satchmo/trunk/satchmo/templates/discount/checkout_form.html (modified) (1 diff)
- satchmo/trunk/satchmo/templates/discount/some_eligible.html (modified) (1 diff)
- satchmo/trunk/satchmo/templates/email/order_complete.txt (modified) (2 diffs)
- satchmo/trunk/satchmo/templates/email/order_placed_notice.txt (modified) (2 diffs)
- satchmo/trunk/satchmo/templates/product/detail_configurableproduct.html (modified) (2 diffs)
- satchmo/trunk/satchmo/templates/product/detail_customproduct.html (modified) (1 diff)
- satchmo/trunk/satchmo/templates/search.html (modified) (2 diffs)
- satchmo/trunk/satchmo/templates/shop/_order_details.html (modified) (1 diff)
- satchmo/trunk/satchmo/templates/shop/_order_tracking_details.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
satchmo/trunk/satchmo/discount/templatetags/satchmo_discounts.py
r1234 r1768 8 8 from django.template import Context, Template 9 9 from django.utils.translation import get_language, ugettext_lazy as _ 10 from satchmo.configuration import config_value 10 11 from satchmo.discount.utils import calc_by_percentage, find_best_auto_discount 11 from satchmo.configuration import config_value12 12 from satchmo.shop.templatetags import get_filter_args 13 from satchmo.tax.templatetags import satchmo_tax 14 import logging 15 16 log = logging.getLogger('discount') 13 17 14 18 register = template.Library() 15 19 16 20 def sale_price(product): 21 """Returns the sale price, including tax if that is the default.""" 22 if config_value('TAX', 'DEFAULT_VIEW_TAX'): 23 return taxed_sale_price(product) 24 else: 25 return untaxed_sale_price(product) 26 27 register.filter('sale_price', sale_price) 28 29 def untaxed_sale_price(product): 17 30 """Returns the product unit price with the best auto discount applied.""" 18 disc = find_best_auto_discount(product)31 discount = find_best_auto_discount(product) 19 32 price = product.unit_price 20 if disc: 21 return calc_by_percentage(price, disc.percentage) 22 else: 23 return price 24 25 register.filter('sale_price', sale_price) 33 34 if discount and discount.valid_for_product(cartitem.product): 35 price = calc_by_percentage(price, disc.percentage) 36 37 return price 38 39 register.filter('untaxed_sale_price', sale_price) 40 41 def taxed_sale_price(product): 42 """Returns the product unit price with the best auto discount applied and taxes included.""" 43 taxer = satchmo_tax._get_taxprocessor() 44 price = sale_price(product) 45 price = price + taxer.by_price(product.taxClass, price) 46 return price 47 48 register.filter('taxed_sale_price', sale_price) 26 49 27 50 def discount_cart_total(cart, discount): 28 """Returns the discounted line total for this cart item""" 51 """Returns the discounted total for this cart, with tax if that is the default.""" 52 if config_value('TAX', 'DEFAULT_VIEW_TAX'): 53 return taxed_discount_cart_total(cart, discount) 54 else: 55 return untaxed_discount_cart_total(cart, discount) 56 57 register.filter('discount_cart_total', discount_cart_total) 58 59 def untaxed_discount_cart_total(cart, discount): 60 """Returns the discounted total for this cart""" 29 61 if discount: 30 62 total = Decimal('0.00') … … 37 69 return total 38 70 39 register.filter('discount_cart_total', discount_cart_total) 71 register.filter('untaxed_discount_cart_total', discount_cart_total) 72 73 def taxed_discount_cart_total(cart, discount): 74 """Returns the discounted total for this cart with taxes included""" 75 if discount: 76 total = Decimal('0.00') 77 78 for item in cart: 79 total += taxed_discount_line_total(item, discount) 80 else: 81 total = discount_cart_total(cart, discount) 82 83 return total 84 85 register.filter('taxed_discount_cart_total', discount_cart_total) 40 86 41 87 def discount_line_total(cartitem, discount): 88 """Returns the discounted line total for this cart item, including tax if that is the default.""" 89 if config_value('TAX', 'DEFAULT_VIEW_TAX'): 90 return taxed_discount_line_total(cartitem, discount) 91 else: 92 return untaxed_discount_line_total(cartitem, discount) 93 94 95 register.filter('discount_line_total', discount_line_total) 96 97 def untaxed_discount_line_total(cartitem, discount): 42 98 """Returns the discounted line total for this cart item""" 43 lt= cartitem.line_total99 price = cartitem.line_total 44 100 if discount and discount.valid_for_product(cartitem.product): 45 return calc_by_percentage(lt, discount.percentage) 46 else: 47 return lt 48 49 register.filter('discount_line_total', discount_line_total) 101 price = calc_by_percentage(price, discount.percentage) 102 103 return price 104 105 register.filter('untaxed_discount_line_total', discount_line_total) 106 107 def taxed_discount_line_total(cartitem, discount): 108 """Returns the discounted line total for this cart item with taxes included.""" 109 price = discount_line_total(cartitem, discount) 110 taxer = satchmo_tax._get_taxprocessor() 111 price = price + taxer.by_price(cartitem.product.taxClass, price) 112 113 return price 114 115 register.filter('taxed_discount_line_total', discount_line_total) 116 117 def discount_price(product, discount): 118 """Returns the product price with the discount applied, including tax if that is the default. 119 120 Ex: product|discount_price:sale 121 """ 122 if config_value('TAX', 'DEFAULT_VIEW_TAX'): 123 return taxed_discount_price(product, discount) 124 else: 125 return untaxed_discount_price(product, discount) 126 127 128 register.filter('discount_price', discount_price) 50 129 51 def discount_price(product, discount):130 def untaxed_discount_price(product, discount): 52 131 """Returns the product price with the discount applied. 53 132 … … 56 135 up = product.unit_price 57 136 if discount and discount.valid_for_product(product): 58 return calc_by_percentage(up, discount.percentage) 137 pcnt = calc_by_percentage(up, discount.percentage) 138 return pcnt 59 139 else: 60 140 return up 61 141 62 register.filter('discount_price', discount_price) 142 register.filter('untaxed_discount_price', discount_price) 143 144 def taxed_discount_price(product, discount): 145 """Returns the product price with the discount applied, and taxes included. 146 147 Ex: product|discount_price:sale 148 """ 149 price = discount_price(product, discount) 150 taxer = satchmo_tax._get_taxprocessor() 151 price = price + taxer.by_price(product.taxClass, price) 152 153 register.filter('taxed_discount_price', discount_price) 63 154 64 155 def discount_ratio(discount): … … 73 164 74 165 def discount_saved(product, discount): 166 """Returns the amount saved by the discount, including tax if that is the default.""" 167 if config_value('TAX', 'DEFAULT_VIEW_TAX'): 168 return taxed_discount_saved(product, discount) 169 else: 170 return untaxed_discount_saved(product, discount) 171 172 register.filter('discount_saved', discount_saved) 173 174 175 def untaxed_discount_saved(product, discount): 75 176 """Returns the amount saved by the discount""" 76 177 … … 84 185 return Decimal('0.00') 85 186 86 register.filter('discount_saved', discount_saved) 87 88 187 register.filter('untaxed_discount_saved', discount_saved) 188 189 def taxed_discount_saved(product, discount): 190 """Returns the amount saved by the discount, after applying taxes.""" 191 192 if discount and discount.valid_for_product(product): 193 price = product.unit_price 194 discounted = taxed_discount_price(product, discount) 195 saved = price-discounted 196 cents = Decimal("0.01") 197 return saved.quantize(cents) 198 else: 199 return Decimal('0.00') 200 201 register.filter('taxed_discount_saved', discount_saved) satchmo/trunk/satchmo/discount/utils.py
r1320 r1768 20 20 return work.quantize(cents) 21 21 22 def find_discount_for_code(code ):22 def find_discount_for_code(code, raises=False): 23 23 discount = None 24 24 … … 30 30 pass 31 31 32 32 33 if not discount: 34 if raises: 35 raise Discount.DoesNotExist() 33 36 discount = NullDiscount() 34 37 satchmo/trunk/satchmo/product/utils.py
r1748 r1768 1 1 from satchmo.configuration import config_value 2 from satchmo.discount.utils import calc_by_percentage, find_best_auto_discount 2 3 from satchmo.l10n.utils import moneyfmt 3 4 from satchmo.product.models import ProductVariation, Option, split_option_unique_id, ProductPriceLookup, OptionGroup … … 28 29 "SLUG": "Variation Slug", 29 30 "PRICE" : {"qty" : "$price", [...]}, 31 "SALE" : {"qty" : "$price", [...]}, 30 32 "TAXED" : "$taxed price", # omitted if no taxed price requested 31 33 "QTY" : 1 … … 37 39 config = Config.objects.get_current() 38 40 ignore_stock = config.no_stock_checkout 41 discount = find_best_auto_discount(product) 42 use_discount = discount and discount.percentage > 0 39 43 40 44 if include_tax: … … 42 46 tax_class = product.taxClass 43 47 44 details = { }48 details = {'SALE' : use_discount} 45 49 46 50 curr = config_value('SHOP', 'CURRENCY') … … 73 77 74 78 detail['PRICE'] = {} 79 80 if use_discount: 81 detail['SALE'] = {} 82 75 83 if include_tax: 76 84 detail['TAXED'] = {} 85 if use_discount: 86 detail['TAXED_SALE'] = {} 77 87 78 88 details[key] = detail … … 81 91 82 92 detail['PRICE'][detl.quantity] = moneyfmt(price, curr=curr) 93 if use_discount: 94 detail['SALE'][detl.quantity] = moneyfmt(calc_by_percentage(price, discount.percentage), curr=curr) 83 95 84 96 if include_tax: 85 97 tax_price = taxer.by_price(tax_class, price) + price 86 98 detail['TAXED'][detl.quantity] = moneyfmt(tax_price, curr=curr) 99 detail['TAXED_SALE'][detl.quantity] = moneyfmt(calc_by_percentage(tax_price, discount.percentage), curr=curr) 87 100 88 101 return details satchmo/trunk/satchmo/settings-customize.py
r1696 r1768 70 70 "django.contrib.auth.middleware.AuthenticationMiddleware", 71 71 "django.middleware.doc.XViewMiddleware", 72 #The next middleware is required if you want to use satchmo 73 #to serve multiple simultaneous shops. 74 #"threaded_multihost.middleware.ThreadLocalMiddleware", 72 "threaded_multihost.middleware.ThreadLocalMiddleware", 75 73 "satchmo.shop.SSLMiddleware.SSLRedirect", 76 74 "satchmo.recentlist.middleware.RecentProductMiddleware", satchmo/trunk/satchmo/shop/context_processors.py
r1562 r1768 7 7 from django.conf import settings as site_settings 8 8 from satchmo.product.models import Category 9 from satchmo.discount.models import Discount 9 10 from satchmo.shop import get_satchmo_setting 10 11 from satchmo.shop.models import Config, NullConfig, Cart, NullCart 12 from satchmo.shop.signals import satchmo_context 11 13 from satchmo.utils import current_media_url, request_is_secure 14 import datetime 12 15 import logging 13 16 … … 19 22 20 23 all_categories = Category.objects.by_site() 24 25 today = datetime.date.today() 26 discs = Discount.objects.filter(automatic=True, 27 active=True, 28 startDate__lte=today, 29 endDate__gt=today).order_by('-percentage') 30 if discs.count() > 0: 31 sale = discs[0] 32 else: 33 sale = None 21 34 22 return{35 ctx = { 23 36 'shop_base': get_satchmo_setting('SHOP_BASE'), 24 37 'shop' : shop_config, … … 32 45 'login_url': site_settings.LOGIN_URL, 33 46 'logout_url': site_settings.LOGOUT_URL, 47 'sale': sale 34 48 } 49 50 satchmo_context.send(shop_config, context=ctx) 51 52 return ctx satchmo/trunk/satchmo/shop/notification.py
r1424 r1768 11 11 from django.utils.translation import ugettext as _ 12 12 from satchmo.configuration import config_value 13 from satchmo.discount.models import Discount 14 from satchmo.discount.utils import find_discount_for_code 13 15 14 16 log = logging.getLogger('contact.notifications') … … 29 31 shop_name = shop_config.store_name 30 32 t = loader.get_template(template) 31 c = Context({'order': new_order, 'shop_name': shop_name}) 33 try: 34 sale = find_discount_for_code(new_order.discount_code, raises=True) 35 except Discount.DoesNotExist: 36 sale = None 37 38 c = Context({'order': new_order, 'shop_name': shop_name, 'sale' : sale}) 32 39 subject = _("Thank you for your order from %(shop_name)s") % {'shop_name' : shop_name} 33 40 satchmo/trunk/satchmo/shop/signals.py
r1560 r1768 35 35 36 36 satchmo_search = django.dispatch.Signal() 37 38 satchmo_context = django.dispatch.Signal() 39 satchmo/trunk/satchmo/static/js/satchmo_product.js
r1719 r1768 1 1 var satchmo = satchmo || {}; 2 2 3 // Get the current selected product price. If taxed is true, then 4 // return the price inclusive of taxes. 5 satchmo.get_current_price = function(detail, qty, taxed) { 6 var k = taxed ? "TAXED" : "PRICE"; 3 satchmo.use_sale_prices = true; 4 5 // Get the current selected product price. 6 satchmo.get_current_price = function(detail, qty, use_sale) { 7 var taxed = satchmo.default_view_tax, 8 k, prices; 9 10 if (use_sale) { 11 k = taxed ? "TAXED_SALE" : "SALE"; 12 } 13 else { 14 k = taxed ? "TAXED" : "PRICE"; 15 } 16 7 17 var prices = detail[k]; 8 18 if (prices) { … … 75 85 // update name and price based on the current selections 76 86 satchmo.update_price = function() { 77 var key = satchmo.make_optionkey(); 78 var detail = satchmo.variations[key]; 79 var msg = ""; 87 var key = satchmo.make_optionkey(), 88 detail = satchmo.variations[key], 89 msg = "", 90 use_sale, sale_price, full_price; 91 80 92 if (detail) { 81 93 var qty = parseInt($('#quantity').fieldValue()[0]); 82 94 satchmo.set_name(detail['SLUG']); 83 var price = satchmo.get_current_price(detail, qty, satchmo.default_view_tax); 84 satchmo.set_price(price); 95 96 if (!satchmo.variations['SALE']) { 97 use_sale = false; 98 } 99 else { 100 use_sale = satchmo.use_sale_prices; 101 } 102 103 if (use_sale) { 104 full_price = satchmo.get_current_price(detail, qty, false); 105 $('#fullprice').text(full_price); 106 107 sale_price = satchmo.get_current_price(detail, qty, true); 108 } 109 else { 110 sale_price = satchmo.get_current_price(detail, qty, false); 111 $('#fullprice').hide(); 112 } 113 114 satchmo.set_price(sale_price); 115 85 116 if (qty && qty > detail['QTY']) { 86 117 if (detail['QTY'] == -1) { satchmo/trunk/satchmo/tax/templatetags/satchmo_tax.py
r1699 r1768 8 8 from satchmo.shop.templatetags import get_filter_args 9 9 from satchmo.tax.utils import get_tax_processor 10 from threaded_multihost.threadlocals import get_thread_variable, set_thread_variable, get_current_user 10 11 import logging 11 12 12 13 log = logging.getLogger('satchmo.tax.templatetags') 13 14 14 try:15 from threading import local16 except ImportError:17 log.warn('getting threadlocal support from django')18 from django.utils._threading_local import local19 20 _threadlocals = local()21 22 def set_thread_variable(key, var):23 setattr(_threadlocals, key, var)24 25 def get_thread_variable(key, default):26 return getattr(_threadlocals, key, None)27 28 15 register = template.Library() 29 16 30 def _get_taxprocessor(request ):17 def _get_taxprocessor(request=None): 31 18 taxprocessor = get_thread_variable('taxer', None) 32 19 if not taxprocessor: 33 user = request.user 34 if user.is_authenticated(): 35 user = user 20 if request: 21 user = request.user 22 if user.is_authenticated(): 23 user = user 24 else: 25 user = None 36 26 else: 37 user = None27 user = get_current_user() 38 28 39 29 taxprocessor = get_tax_processor(user=user) … … 206 196 return TaxedPriceNode(price, currency, taxclass) 207 197 198 199 def with_tax(product): 200 """Returns the product unit price with tax""" 201 return taxed 208 202 209 203 satchmo/trunk/satchmo/templates/base.html
r1704 r1768 2 2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3 3 4 {% load i18n satchmo_category satchmo_google satchmo_util satchmo_currency %}4 {% load i18n satchmo_category satchmo_google satchmo_util satchmo_currency satchmo_discounts %} 5 5 <head> 6 6 {% block extra-head %}{% endblock %} … … 65 65 66 66 {% if cart_count %} 67 ({{ cart_count }}{% if cart.total %} - {% spaceless %}{% if shop.options.TAX.DEFAULT_VIEW_TAX.value %} 68 {% load satchmo_tax %}{% cart_taxed_total cart 1 %}{% else %}{{ cart.total|currency }} 69 {% endif %}{% endspaceless %}{% endif %})<br/> 67 ({{ cart_count }}{% if cart.total %} - {{ cart|discount_cart_total:sale|currency }}{% endif %})<br/> 70 68 {% url satchmo_checkout-step1 as checkouturl %} 71 69 {% if checkouturl %}<a href="{{ checkouturl }}">{% trans "Check out" %}</a>{% endif %} satchmo/trunk/satchmo/templates/base_cart.html
r1704 r1768 5 5 {% load satchmo_util %} 6 6 {% load satchmo_product %} 7 {% load satchmo_discounts %} 7 8 8 9 {% block navbar %} … … 23 24 <th align="left">{% trans "Quantity" %}</th> 24 25 <th>{% trans "Item" %}</th> 26 {% if sale %} 27 <th>{% trans "Regular Price" %}</th> 28 <th>{% trans "Sale Price" %} 29 {% else %} 30 <th>{% trans "Price" %}</th> 31 {% endif %} 25 32 <th align="center">{% if default_view_tax %}{% trans "Total<br/>(incl. tax)" %}{% else %}{% trans "Total" %}{% endif %}</th> 26 33 </tr> … … 41 48 </td> 42 49 <td><a href="{{cartitem.product.get_absolute_url}}">{{ cartitem.description }}</a></td> 43 <td align="center">{% cartitem_total cartitem default_view_tax %}</td> 50 {% if sale %}<td align="center">{{ cartitem.product.unit_price|currency }}</td>{% endif %} 51 <td align="center">{{ cartitem.product|discount_price:sale|currency }}</td> 52 <td align="center">{{ cartitem|discount_line_total:sale|currency }}</td> 44 53 </tr> 45 54 {% cartitem_custom_details cartitem %} 46 55 {% cartitem_subscription_details cartitem %} 47 56 {% endfor %} 48 <tr><td colspan=" 3" align="right">{% trans "Cart Total" %}:</td>49 <td>{ % cart_total cart default_view_tax %}</td></tr>57 <tr><td colspan="{% if sale %}5{% else %}4{% endif %}" align="right">{% trans "Cart Total" %}:</td> 58 <td>{{ cart|discount_cart_total:sale|currency }}</td></tr> 50 59 </table> 51 60 {% if sale %} satchmo/trunk/satchmo/templates/base_product.html
r1683 r1768 12 12 {% load satchmo_currency satchmo_category %} 13 13 {% load satchmo_ratings %} 14 {% load satchmo_util %}14 {% load satchmo_util satchmo_discounts %} 15 15 {% if "recentlist"|app_enabled %}{% load satchmo_recentlist %}{% endif %} 16 16 … … 51 51 <p>{{ product.translated_description }}</p> 52 52 {% trans "Price" %} {% if default_view_tax %} {% trans '(incl. tax)' %}{% endif %}: 53 <h3 id="price">{% if default_view_tax %}{{ price_with_tax|currency }}{% else %}{{ product.unit_price|currency }}{% endif %}</h3> 53 <h3> 54 {% if sale %}<strike id="fullprice" style="display: block;">{{ product|discount_price:""|currency }}</strike>{% endif %} 55 <span id="price">{{ product|discount_price:sale|currency }}</span> 56 </h3> 54 57 {% for pic in product.productimage_set.all %} 55 58 <img src="{{ pic.picture.url|thumbnail:"width=280" }}" width="280" /> satchmo/trunk/satchmo/templates/discount/checkout_form.html
r1259 r1768 3 3 <td> 4 4 {% with sale.percentage_text as pct %}{% with sale.code as code %}{% with sale.description as desc %}{% with sale.endDate|date:"y-M-d" as enddate %} 5 {% blocktrans %}<p> Some of the products in your cart are eligible to receive a discount of {{ pct }} when you enter the code "{{ code }}" during our {{ desc }} which ends on {{ enddate }}.</p>5 {% blocktrans %}<p>Products in your cart are eligible to receive a discount of {{ pct }} when you enter the code "{{ code }}" during our {{ desc }} which ends on {{ enddate }}.</p> 6 6 {% endblocktrans %} 7 7 {% endwith %}{% endwith %}{% endwith %}{% endwith %} satchmo/trunk/satchmo/templates/discount/some_eligible.html
r1259 r1768 2 2 <div class="saleprice"> 3 3 {% with sale.percentage_text as pct %}{% with sale.code as code %}{% with sale.description as desc %}{% with sale.endDate|date:"y-M-d" as enddate %} 4 {% blocktrans %}<p> Some of the products on this page are eligible to receive a discount of {{ pct }} during checkout when you enter the code "{{ code }}" during our {{ desc }} which ends on {{ enddate }}.</p>4 {% blocktrans %}<p>Products on this page are eligible to receive a discount of {{ pct }} during checkout when you enter the code "{{ code }}" during our {{ desc }} which ends on {{ enddate }}.</p> 5 5 {% endblocktrans %} 6 6 {% endwith %}{% endwith %}{% endwith %}{% endwith %} satchmo/trunk/satchmo/templates/email/order_complete.txt
r1517 r1768 1 {% load i18n %}{% load satchmo_currency%}{% with order.contact.first_name as first_name %}{% with order.contact.last_name as last_name %}{% blocktrans %}Dear {{ first_name }} {{ last_name }},{% endblocktrans %}{% endwith %}{% endwith %}1 {% load i18n satchmo_currency satchmo_discounts %}{% with order.contact.first_name as first_name %}{% with order.contact.last_name as last_name %}{% blocktrans %}Dear {{ first_name }} {{ last_name }},{% endblocktrans %}{% endwith %}{% endwith %} 2 2 3 3 {% blocktrans %}Thank you for ordering with {{ shop_name }}.{% endblocktrans %} … … 8 8 -------------- 9 9 {% for item in order.orderitem_set.all %} 10 {{ item }} - {{item. unit_price|currency}} x {{item.quantity}} = {{item.sub_total|currency}}10 {{ item }} - {{item.product|discount_price:sale}} x {{item.quantity}} = {{item.sub_total|currency}} 11 11 {% endfor %} 12 12 satchmo/trunk/satchmo/templates/email/order_placed_notice.txt
r1517 r1768 1 {% load i18n %}{% load satchmo_currency%}{% with order.contact.first_name as first_name %}{% with order.contact.last_name as last_name %}{% blocktrans %}Dear {{ first_name }} {{ last_name }},{% endblocktrans %}{% endwith %}{% endwith %}1 {% load i18n satchmo_currency satchmo_discounts %}{% with order.contact.first_name as first_name %}{% with order.contact.last_name as last_name %}{% blocktrans %}Dear {{ first_name }} {{ last_name }},{% endblocktrans %}{% endwith %}{% endwith %} 2 2 3 3 {% with order.contact.email as email %}{% with order.contact.full_name as customer %}{% blocktrans %}Order placed on {{ shop_name }} by {{ customer }}<{{ email }}>.{% endblocktrans %}{% endwith %}{% endwith %} … … 6 6 -------------- 7 7 {% for item in order.orderitem_set.all %} 8 {{ item }} - {{item. unit_price|currency}} x {{item.quantity}} = {{item.sub_total|currency}}8 {{ item }} - {{item.product|discount_price:sale|currency }} x {{item.quantity}} = {{item|discount_line_total:sale|currency}} 9 9 {% endfor %} 10 10 satchmo/trunk/satchmo/templates/product/detail_configurableproduct.html
r1719 r1768 6 6 {% load satchmo_currency satchmo_category%} 7 7 {% load satchmo_ratings %} 8 {% load satchmo_discounts satchmo_tax %} 8 9 {% block extra-head %} 9 10 … … 29 30 <h4>{{ product.translated_name }}</h4> 30 31 <p>{{ product.translated_description }}</p> 31 {% trans "Price" %}{% if default_view_tax %} {% trans '(incl. tax)' %}{% endif %}: <h3 id="price">{{ product.unit_price|currency }}</h3> 32 {% trans "Price" %}{% if default_view_tax %} {% trans '(incl. tax)' %}{% endif %}: <h3>{% spaceless %} 33 {% if sale %}<strike style="display: block;" id="fullprice">{{ product|discount_price:""|currency }}</strike>{% endif %} 34 <span id="price">{{ product|discount_price:sale|currency }}</span> 35 {% endspaceless %}</h3> 36 32 37 {% for pic in product.productimage_set.all %} 33 38 <img src="{{ pic.picture.url|thumbnail:"width=280" }}" width="280" /> satchmo/trunk/satchmo/templates/product/detail_customproduct.html
r1424 r1768 1 1 {% extends "base_product.html" %} 2 2 {% load i18n %} 3 {% load satchmo_thumbnail %}3 {% load satchmo_thumbnail satchmo_discounts %} 4 4 {% load satchmo_price %} 5 5 {% load satchmo_currency satchmo_category%} 6 6 {% load satchmo_ratings %} 7 7 {% load satchmo_util %} 8 {% load satchmo_discounts %} 8 9 9 10 {% block productdetail %} 10 11 <h4>{% blocktrans with product.translated_name as name %}Custom order for {{ name }}{% endblocktrans %}</h4> 11 12 <p>{% autoescape off %}{{ product.translated_description }}{% endautoescape %}</p> 12 {% trans "Price" %}: <h3 id="price">{{ product.unit_price|currency }}</h3>13 {% trans "Price" %}: <h3>{% if sale %}<strike id="fullprice">{{ product|discount_price:""|currency }}</strike><br/>{% endif %}<span id="price">{{ product|discount_price:sale|currency }}</span></h3> 13 14 {% for pic in product.productimage_set.all %} 14 15 <img src="{{ pic.picture.url|thumbnail:"width=280" }}" width="280" /> satchmo/trunk/satchmo/templates/search.html
r1683 r1768 1 1 {% extends "base_satchmo.html" %} 2 2 {% load i18n %} 3 {% load satchmo_currency %}3 {% load satchmo_currency satchmo_discounts %} 4 4 5 5 {% block navbar %} … … 31 31 <ul> 32 32 {% for product in results.products %} 33 {% ifchanged %}<li><a href="{{ product.get_absolute_url }}">{{ product.translated_name }}</a> {% trans "for" %} {{ product .unit_price|currency}}</li>{% endifchanged %}33 {% ifchanged %}<li><a href="{{ product.get_absolute_url }}">{{ product.translated_name }}</a> {% trans "for" %} {{ product|discount_price:sale|currency}}</li>{% endifchanged %} 34 34 {% endfor %} 35 35 </ul> satchmo/trunk/satchmo/templates/shop/_order_details.html
r1621 r1768 6 6 {% for item in order.orderitem_set.all %} 7 7 {% if default_view_tax %} 8 {{ item }} - {{item.unit_price_with_tax|currency}} x {{item.quantity}} = {{item.total_with_tax|currency}}<br/>8 {{ item }} - {{item.unit_price_with_tax|currency}} x {{item.quantity}}{% if item.discount %} - {{ item.discount|currency }}{% endif %} = {{item.total_with_tax|currency}}<br/> 9 9 {% else %} 10 {{ item }} - {{item.unit_price|currency}} x {{item.quantity}} = {{item.sub_total|currency}}<br/>10 {{ item }} - {{item.unit_price|currency}} x {{item.quantity}}{% if item.discount %} - {{ item.discount|currency }}{% endif %} = {{item.sub_total|currency}}<br/> 11 11 {% endif %} 12 12 {% endfor %} satchmo/trunk/satchmo/templates/shop/_order_tracking_details.html
r1721 r1768 16 16 <h4>{% trans "Items Ordered" %}</h4> 17 17 {% for item in order.orderitem_set.all %} 18 {{ item }} - {{item.unit_price|currency}} x {{item.quantity}} = {{item.sub_total|currency}}<br/>18 {{ item }} - {{item.unit_price|currency}} x {{item.quantity}}{% if item.discount %} - {{ item.discount|currency }}{% endif %} = {{item.sub_total|currency}}<br/> 19 19 {% endfor %} 20 20
