浏览代码

Do not allow to put child product to the basket, but rather navigate to the child detail page instead.

master
Alexander Gaevsky 7 年前
父节点
当前提交
08cbdbbbcf
共有 1 个文件被更改,包括 17 次插入5 次删除
  1. 17
    5
      src/oscar/templates/oscar/catalogue/detail.html

+ 17
- 5
src/oscar/templates/oscar/catalogue/detail.html 查看文件

10
 {% load purchase_info_tags %}
10
 {% load purchase_info_tags %}
11
 
11
 
12
 {% block title %}
12
 {% block title %}
13
-    {{ product.title }} | {{ block.super }}
13
+    {{ product.get_title }} | {{ block.super }}
14
 {% endblock %}
14
 {% endblock %}
15
 
15
 
16
 {% block description %}
16
 {% block description %}
28
             <a href="{{ c.get_absolute_url }}">{{ c.name }}</a>
28
             <a href="{{ c.get_absolute_url }}">{{ c.name }}</a>
29
         </li>
29
         </li>
30
         {% endfor %}
30
         {% endfor %}
31
-        <li class="active">{{ product.title }}</li>
31
+        <li class="active">{{ product.get_title }}</li>
32
 
32
 
33
         {% get_back_button as backbutton %}
33
         {% get_back_button as backbutton %}
34
         {% if backbutton %}
34
         {% if backbutton %}
78
 
78
 
79
             <hr/>
79
             <hr/>
80
 
80
 
81
-            {% block product_basket_form %}
82
-                {% include "catalogue/partials/add_to_basket_form.html" %}
83
-            {% endblock %}
81
+            {% if not product.is_parent %}
82
+                {% block product_basket_form %}
83
+                    {% include "catalogue/partials/add_to_basket_form.html" %}
84
+                {% endblock %}
85
+            {% else %}
86
+                {% block variants %}
87
+                    <h2>{% trans 'Variants:' %}</h2>
88
+                    {% for child in product.children.all %}
89
+                        {% purchase_info_for_product request child as child_session %}
90
+                        {% if child_session.availability.is_available_to_buy %}
91
+                            <a href="{{ child.get_absolute_url }}">{{ child.get_title }}</a><br>
92
+                        {% endif %}
93
+                    {% endfor %}
94
+                {% endblock %}
95
+            {% endif %}
84
         </div><!-- /col-sm-6 -->
96
         </div><!-- /col-sm-6 -->
85
         {% endblock %}
97
         {% endblock %}
86
 
98
 

正在加载...
取消
保存