]> git.parisson.com Git - diggersdigest.git/commitdiff
fix price display on categories
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 24 Sep 2015 14:30:27 +0000 (16:30 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 24 Sep 2015 14:30:27 +0000 (16:30 +0200)
app/records/static/css/dig2.css
app/templates/pages/category.html
app/templates/shop/includes/price.html
app/templates/shop/product.html

index a649de9d69c91de8c64ecddf914dbd2eb638937c..6278061138f8af7caa81415bcf535eea96db6a1b 100644 (file)
@@ -61,3 +61,7 @@ hr {
 .audio {
     margin-top: 2em;
 }
+
+.error-msg {
+    font-size: 85%;
+}
index 910be0527213553cc8e90c039869a58039e7c56f..683b3d13b1f21712734429883e0eab9ac5b6c282 100644 (file)
     <div class="col-xs-6 col-sm-4 col-lg-3 product-thumb slim_margins">
     <a href="{{ product.get_absolute_url }}" class="thumbnail">
         {% if product.image %}
-        <img src="{{ MEDIA_URL }}{% thumbnail product.image 148 148 %}">
+         <img src="{{ MEDIA_URL }}{% thumbnail product.image 148 148 %}">
         {% else %}
-        <div class="placeholder"></div>
+         <div class="placeholder"></div>
         {% endif %}
-        <div class="caption">
-        <h6>{{ product }}</h6>
-        <div class="price-info">
-        {% if product.has_price %}
-            {% if product.on_sale %}
-            <span class="old-price">{{ product.unit_price|currency }}</span>
-            {% trans "On sale:" %}
+         <div class="caption">
+          <h6>{{ product }}</h6>
+          <div class="price-info">
+            {% if product.variations.all %}
+            {% with product.variations.all as variations and True as category %}
+            {% if product.available  %}
+            {% include "shop/includes/price.html" %}
+            {% else %}
+            <span class="error-msg">{% trans "This product is currently unavailable." %}</span>
             {% endif %}
-            <span class="price">{{ product.price|currency }}</span>
-        {% else %}
-            <span class="coming-soon">{% trans "Coming soon" %}</span>
-        {% endif %}
-        </div>
+            {% endwith %}
+            {% endif %}
+          </div>
         </div>
     </a>
     </div>
index adcf16737a6630c70b2a4f26751f4d0a73bd167a..bf8de99dd6dac2b583855d0c92b58eb673e6f35b 100644 (file)
@@ -2,18 +2,18 @@
 
 <ul id="variations" class="list-unstyled">
     {% for variation in variations %}
-    <li id="variation-{{ variation.sku }}"
-        {% if not variation.default %}style="display:none;"{% endif %}>
+    <li id="variation-{{ variation.sku }}" {% if not variation.default %}style="display:none;"{% endif %}>
         {% if variation.has_price %}
             {% if product.available %}
-             {% if not variation.unit_price %}
+             {% if not variation.unit_price and not category %}
               <span class="price">{% trans "Price" %} : <a href="{% url 'page' 'about/contact-form' %}">{% trans "Make an offer" %}</a></span>
+             {% elif not variation.unit_price and category %}
+              <span class="price">{% trans "Price" %} : {% trans "Make an offer" %}</span>
              {% else %}
               <span class="price">{% trans "Price" %} : {{ variation.unit_price|currency }}</span>
              {% endif %}
             {% endif %}
         {% else %}
-        oo
             {% if has_available_variations %}
             <span class="error-msg">
             {% trans "The selected options are currently unavailable." %}
index e04b80149e5b9820e606d12f09878128a6a1f14c..79a221dcfa3c203a708c5e22707d711327caca06 100644 (file)
@@ -97,7 +97,7 @@ $(function () {
   <li><strong>{{ product.record.artist }}</strong></li>
   <li><em>{{ product.record.title }}</em></li>
   <li>
-    {% trans "Label:" %} 
+    {% trans "Label:" %}
     {{ product.record.label }}
   </li>
   <li>
@@ -131,7 +131,6 @@ $(function () {
     </a>
   </li>
   {% if product.available and has_available_variations %}
-  {% errors_for add_product_form %}
   <li>{% include "shop/includes/price.html" %}</li>
   {% else %}
   <li><span class="error-msg">{% trans "This product is currently unavailable." %}</span></li>
@@ -155,8 +154,10 @@ $(function () {
 {% endeditable %}
 </div>
 
-{% if product.available and has_available_variations %}
+{% if product.available and has_available_variations and product.variation.first.unit_price %}
+
 <br/>
+{% errors_for add_product_form %}
 <form method="post" id="add-cart" class="shop-form">{% csrf_token %}
     <div style="display: none;">
     {% fields_for add_product_form %}