Просмотр исходного кода

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

master
Alexander Gaevsky 7 лет назад
Родитель
Сommit
08cbdbbbcf
1 измененных файлов: 17 добавлений и 5 удалений
  1. 17
    5
      src/oscar/templates/oscar/catalogue/detail.html

+ 17
- 5
src/oscar/templates/oscar/catalogue/detail.html Просмотреть файл

@@ -10,7 +10,7 @@
10 10
 {% load purchase_info_tags %}
11 11
 
12 12
 {% block title %}
13
-    {{ product.title }} | {{ block.super }}
13
+    {{ product.get_title }} | {{ block.super }}
14 14
 {% endblock %}
15 15
 
16 16
 {% block description %}
@@ -28,7 +28,7 @@
28 28
             <a href="{{ c.get_absolute_url }}">{{ c.name }}</a>
29 29
         </li>
30 30
         {% endfor %}
31
-        <li class="active">{{ product.title }}</li>
31
+        <li class="active">{{ product.get_title }}</li>
32 32
 
33 33
         {% get_back_button as backbutton %}
34 34
         {% if backbutton %}
@@ -78,9 +78,21 @@
78 78
 
79 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 96
         </div><!-- /col-sm-6 -->
85 97
         {% endblock %}
86 98
 

Загрузка…
Отмена
Сохранить