瀏覽代碼

Updated shipping methods display

master
David Winterbottom 13 年之前
父節點
當前提交
cefbca1aaa
共有 3 個檔案被更改,包括 19 行新增2 行删除
  1. 1
    1
      oscar/templates/checkout/checkout.html
  2. 1
    0
      sandbox/apps/shipping/admin.py
  3. 17
    1
      sandbox/apps/shipping/repository.py

+ 1
- 1
oscar/templates/checkout/checkout.html 查看文件

67
     </div>
67
     </div>
68
     <div class="basket-title">
68
     <div class="basket-title">
69
         <div class="row-fluid">
69
         <div class="row-fluid">
70
-            <h4 class="span10">Items Summary</h4>
70
+            <h4 class="span10">Items in basket</h4>
71
             <h4 class="span1">Quantity</h4>
71
             <h4 class="span1">Quantity</h4>
72
             <h4 class="span1">Price</h4>
72
             <h4 class="span1">Price</h4>
73
         </div>
73
         </div>

+ 1
- 0
sandbox/apps/shipping/admin.py 查看文件

1
+from oscar.apps.shipping.admin import *

+ 17
- 1
sandbox/apps/shipping/repository.py 查看文件

1
 from oscar.apps.shipping.methods import Free
1
 from oscar.apps.shipping.methods import Free
2
 from oscar.apps.shipping.repository import Repository as CoreRepository
2
 from oscar.apps.shipping.repository import Repository as CoreRepository
3
 
3
 
4
+# Dummy shipping methods
5
+free1 = Free()
6
+free1.code = 'free1'
7
+free1.description = 'Ship by van'
8
+
9
+free2 = Free()
10
+free2.code = 'free2'
11
+free2.description = 'Ship by boat'
4
 
12
 
5
 class Repository(CoreRepository):
13
 class Repository(CoreRepository):
6
 
14
 
15
+    methods = {
16
+        free1.code: free1,
17
+        free2.code: free2
18
+    }
19
+
7
     def get_shipping_methods(self, user, basket, shipping_addr=None, **kwargs):
20
     def get_shipping_methods(self, user, basket, shipping_addr=None, **kwargs):
8
-        methods = [Free(), Free()]
21
+        methods = self.methods.values()
9
         return self.add_basket_to_methods(basket, methods)
22
         return self.add_basket_to_methods(basket, methods)
23
+
24
+    def find_by_code(self, code):
25
+        return self.methods.get(code, None)

Loading…
取消
儲存