1. Kai Diefenbach
  2. django-lfstheme-0.5

Commits

Kai Diefenbach  committed e127399

Using property.title instead of name; using product.unit instead product.price_unit (when appropriate)

  • Participants
  • Parent commits 853d5be
  • Branches default

Comments (0)

Files changed (14)

File lfstheme/templates/lfs/cart/added_to_cart_items.html

View file
  • Ignore whitespace
                     </div>
                 {% endfor %}
 
+                {% for property in cart_item.product.get_variant_properties %}
+                    <div>
+                        {{ property.title }}: {{ property.value }} {{ property.unit|safe }}
+                    </div>
+                {% endfor %}
+
                 {% if cart_item.product.is_configurable_product %}
                     {% for property in cart_item.get_properties %}
                         <div>

File lfstheme/templates/lfs/cart/cart_inline.html

View file
  • Ignore whitespace
                         <span class="product-title">
                             {{ cart_item.product.get_name }}
                         </span>
+
                         {% for property in cart_item.product.get_displayed_properties %}
                             <div>
                                 {{ property.title }}: {{ property.value }} {{ property.unit|safe }}
                             </div>
                         {% endfor %}
 
+                        {% for property in cart_item.product.get_variant_properties %}
+                            <div>
+                                {{ property.title }}: {{ property.value }} {{ property.unit|safe }}
+                            </div>
+                        {% endfor %}
+
                         {% if cart_item.product.is_configurable_product %}
                             {% for property in cart_item.get_properties %}
                                 <div>

File lfstheme/templates/lfs/catalog/filter_navigation.html

View file
  • Ignore whitespace
                             {% else %}
                                 {% if property.show_quantity %}
                                     <a href='{% url lfs_set_product_filter category.slug property_group.id property.value %}'>
-                                        {{property.name}} {{ property_group.unit|safe }} ({{ property.quantity }})
+                                        {{property.title}} {{ property_group.unit|safe }} ({{ property.quantity }})
                                     </a>
                                 {% else %}
                                     <span>
-                                        {{property.name}} {{ property_group.unit|safe }}
+                                        {{property.title}} {{ property_group.unit|safe }}
                                     </span>
                                 {% endif %}
                         

File lfstheme/templates/lfs/catalog/products/product_inline.html

View file
  • Ignore whitespace
 
     <div class="product-images">
         <div class="main-image">
-            {% if variant.get_image %}
-                <a href="{{ variant.get_image.url_400x400 }}"
-                   class="product-image">
-                    <img src="{{ variant.get_image.url_200x200 }}"
-                         alt="{{ variant.get_name}}" />
-                </a>
-            {% endif %}
+            <a href="{{ variant.get_image.url_400x400 }}"
+               class="product-image">
+                <img src="{{ variant.get_image.url_200x200 }}"
+                     alt="{{ variant.get_name}}" />
+            </a>
         </div>
         <div class="sub-images">
             {% for image in variant.get_sub_images %}
         {{ variant.get_name }}
     </h1>
 
-    {# Displayed properties #}
-    <div class="product-properties">
-        {% for property in variant.get_displayed_properties %}
-            <div>
-                {{ property.title }}: {{ property.value }} {{ property.unit|safe }}
-            </div>
-        {% endfor %}
-    </div>
+    {% if not product.is_configurable_product %}
+        <div class="product-properties">
+            {% for option in variant.get_options %}
+                {% if option.property.display_on_product %}
+                    <div>
+                        {{ option.property.title }} : {{ option.value|option_name }} {{ option.property.unit|safe }}
+                    </div>
+                {% endif %}
+            {% endfor %}
+        </div>
+    {% endif %}
 
     {% shipping variant %}
 
     {% average_for_instance variant %}
 
-    {# Prices #}
     <div class="prices">
         {% if variant.get_for_sale %}
             <div>
-                <span class="for-sale-standard-price" nowrap="nowrap">
-                    <span class="for-sale-standard-price-value">
-                        {{ variant.get_standard_price|currency }}
-                    </span>
-                    * {% if product.price_unit %}/ {{ product.price_unit }}{% endif %}</span>
-                <span class="for-sale-price" nowrap="nowrap">
-                    <span class="for-sale-price-value">
-                        {{ variant.get_price|currency }}
-                    </span>
-                    * {% if product.price_unit %}/ {{ product.price_unit }}{% endif %}
-                </span>
+                <span class="for-sale-standard-price" nowrap="nowrap">{{ variant.get_standard_price|currency }}* {% if product.price_unit %}/ {{ product.price_unit }}{% endif %}</span>
+                <span class="for-sale-price" nowrap="nowrap">{{ variant.get_price|currency }}* {% if product.price_unit %}/ {{ product.price_unit }}{% endif %}</span>
             </div>
             <div class="price-disclaimer">
                 {% trans '*inc. VAT' %}
 
     </div>
 
-    {# Configurable properties #}
+    {# Configurable Product  #}
     {% if product.is_configurable_product %}
-
         <table class="cp-properties"
                id="cp-url"
                data="{% url lfs_calculate_price product.id %}">
 
-            {% for property in properties %}
+            {% for property in product.get_property_input_fields %}
+                <td class="property-label">
+                    {{ property.title }}:
+                </td>
+                <td>
+                    <input class="product-input-field" style="margin: 0 6px" type="input" size="6" name="property-{{ property.id }}" />{{ property.unit }}
+                </td>
+            {% endfor %}
+
+            {% for property in product.get_property_select_fields %}
                 <tr>
-                    {% if property.obj.is_select_field %}
-                        <td class="property-label">
-                            {{ property.title }}:
-                        </td>
-                        <td>
-                            <select class="cp-property"
-                                    name="property-{{ property.id }}">
-                                {% if not property.obj.required %}
-                                    <option>---</option>
-                                {% endif %}
-                                {% for option in property.options %}
-                                    <option value="{{ option.id }}"
-                                        {% if option.selected %}selected="selected"{% endif %}>
-                                        {{ option.name }}
-                                        
-                                        {% if property.display_price %}
-                                         / {{ option.price|currency }}                                            
-                                        {% endif %}
-                                    </option>
-                                {% endfor %}
-                            </select>
-                        </td>
-                        <td></td>
-                    {% else %}                        
-                        <td class="property-label">
-                            {{ property.title }}:
-                        </td>
-                        <td class="right">
-                            <input class="product-input-field" type="input" size="6" name="property-{{ property.id }}" />
-                        </td>
-                        <td>
-                            {{ property.unit }}
-                        </td>
-                    {% endif %}
+                    <td class="property-label">
+                        {{ property.title }}:
+                    </td>
+                    <td>
+                        <select class="cp-property"
+                                name="property-{{ property.id }}">
+                            {% for option in property.options.all %}
+                                <option value="{{ option.id }}"
+                                    {% if option.selected %}selected="selected"{% endif %}>
+                                    {{ option.name }} /
+                                    {{ option.price|currency }}
+                                </option>
+                            {% endfor %}
+                        </select>
+                    </td>
                 </tr>
             {% endfor %}
         </table>
 
     <br clear="both">
 
-    {% if variant.deliverable %}
-        <table align="right" class="buttons">
-            <tr>
-                {% if product.active_packing_unit %}
-                    <div class="product-quantity packing-unit"
-                        id="packing-url"
-                        data="{% url lfs_calculate_packing product.id %}">
-                        <input class="number product-quantity"
-                               name="quantity"
-                               size="3"
-                               type="text"
-                               value="1" /> {{ product.price_unit }}
-                    </div>
+    <div class="buttons">
+        {% if variant.deliverable %}
+            {% if product.active_packing_unit %}
+                <div class="product-quantity packing-unit"
+                    id="packing-url"
+                    data="{% url lfs_calculate_packing product.id %}">
+                    <input class="number product-quantity"
+                           name="quantity"
+                           size="10"
+                           type="text"
+                           value="1" /> {{ product.unit }}
+                </div>
 
-                    <div class="packing-result">
-                        {{ packing_result }}
-                    </div>
+                <div class="packing-result">
+                    {{ packing_result }}
+                </div>
 
-                {% else %}            
-                    <td>
-                        {% if product.unit %}
-                            {{ product.unit }}:
-                        {% else %}
-                            {% trans "Quantity" %}:
-                        {% endif %}
-                    </td>                    
-                    <td class="product-quantity">
-                        <input name="quantity"
-                               size="3"
-                               type="text"
-                               value="1" />
-                    </td>
-                {% endif %}
-                <td>
-                    <button class="emphasized"
-                           type="submit"
-                           name="add-to-cart">{% trans 'Add to cart' %}</button>                
-                </td>
-            </tr>
-        </table>
-    {% endif %}
-        
+            {% else %}
+                <div class="product-quantity">
+                    <input name="quantity"
+                           size="10"
+                           type="text"
+                           value="1" /> {{ product.unit }}
+                </div>
+            {% endif %}
+            <br clear="both">
 
+            <button class="emphasized"
+                   type="submit"
+                   name="add-to-cart">{% trans 'Add to cart' %}</button>
+
+        {% endif %}
+    </div>
     <p class="product-description">
         {{ variant.get_description|safe}}
     </p>
 
-    {# Product with variants #}
+    <div class="variants">
+        {# Product with variants #}
 
-    {% if product.is_product_with_variants %}
-
-        <div class="variants">
+        {% ifequal product.sub_type "1" %}
             <h1 class="section">{% trans 'Variants' %}</h1>
 
-            {# List #}
             {% ifequal product.variants_display_type 0 %}
                 <table class="product-variants lfs-default"
                        data="{% url lfs_select_variant %}">
                         </th>
                         {% for property in properties %}
                             <th>
-                                {{ property.name}}
+                                {{ property.title }}
                             </th>
                         {% endfor %}
                         <th class="number">
                 </table>
             {% endifequal %}
 
-            {# Select field #}
             {% ifequal product.variants_display_type 1 %}
 
                 <div>
                     {% for property in properties %}
                         <div>
                             <div class="property-label">
-                                {{ property.name }}:
+                                {{ property.title }}:
                             </div>
                             <select class="property"
                                     name="property_{{ property.id }}">
                             </select>
                         </div>
                     {% endfor %}
+
+                    <noscript>
+                        <input type="submit"
+                               name="refresh-options"
+                               value="{% trans 'Refresh options' %}"/>
+                    </noscript>
                 </div>
+
             {% endifequal %}
-        </div>
-    {% endif %}
+        {% endifequal %}
+    </div>
 
-    {# Accessories #}
     {% if product_accessories %}
         <div class="accessories">
             <h1 class="section">{% trans 'Accessories' %}</h1>

File lfstheme/templates/lfs/catalog/products/product_inline_topdescription.html

View file
  • Ignore whitespace
                         </th>
                         {% for property in properties %}
                             <th>
-                                {{ property.name}}
+                                {{ property.title }}
                             </th>
                         {% endfor %}
                         <th class="number">
                     {% for property in properties %}
                         <div>
                             <div class="property-label">
-                                {{ property.name }}:
+                                {{ property.title }}:
                             </div>
                             <select class="property"
                                     name="property_{{ property.id }}">

File lfstheme/templates/lfs/catalog/products/product_inline_topprice.html

View file
  • Ignore whitespace
                         </th>
                         {% for property in properties %}
                             <th>
-                                {{ property.name}}
+                                {{ property.title }}
                             </th>
                         {% endfor %}
                         <th class="number">
                     {% for property in properties %}
                         <div>
                             <div class="property-label">
-                                {{ property.name }}:
+                                {{ property.title }}:
                             </div>
                             <select class="property"
                                     name="property_{{ property.id }}">

File lfstheme/templates/lfs/mail/order_received_mail.html

View file
  • Ignore whitespace
                         {{ item.product_name }}
                         {% for property in item.product.get_displayed_properties %}
                             <div>
-                                {{ property.name }} : {{ property.value }} {{ property.unit|safe }}
+                                {{ property.title }} : {{ property.value }} {{ property.unit|safe }}
+                            </div>
+                        {% endfor %}
+
+                        {% for property in item.product.get_variant_properties %}
+                            <div>
+                                {{ property.title }}: {{ property.value }} {{ property.unit|safe }}
                             </div>
                         {% endfor %}
 
                         {% if item.product.is_configurable_product %}
                             {% for property in item.get_properties %}
                                 <div>
-                                    {{ property.name }} : {{ property.value }} {{ property.unit|safe }} ({{ property.price|currency }})
+                                    {{ property.title }} : {{ property.value }} {{ property.unit|safe }} ({{ property.price|currency }})
                                 </div>
                             {% endfor %}
                         {% endif %}
 
                     </td>
                     <td class="number">
-                        {{ item.product_amount }} {{ item.product.price_unit }}
+                        {{ item.product_amount }} {{ item.product.unit }}
                         {% if item.product.active_packing_unit %} 
                             <span class="packing-unit">
                                 ({{ item|packages }} {{ item.product.packing_unit_unit }})

File lfstheme/templates/lfs/mail/order_received_mail.txt

View file
  • Ignore whitespace
 {% trans 'Order' %}: 
 ==============================================================================
 {% for item in order.items.all %}{% trans 'SKU' %}:  {{ item.product_sku }}
-{% trans 'Name' %}: {{ item.product_name }} {% for property in item.product.get_displayed_properties %}{{ property.name }} : {{ property.value }} {{ property.unit|safe }}\n{% endfor %}
-{% trans 'Amount' %}: {{ item.product_amount }} {{ item.product.price_unit }} {% if item.product.active_packing_unit %}{{ item|packages }} {{ item.product.packing_unit_unit }}{% endif %} 
+{% trans 'Name' %}: {{ item.product_name }} {% for property in item.product.get_displayed_properties %}{{ property.title }} : {{ property.value }} {{ property.unit|safe }}\n{% endfor %}
+{% trans 'Amount' %}: {{ item.product_amount }} {{ item.product.unit }} {% if item.product.active_packing_unit %}{{ item|packages }} {{ item.product.packing_unit_unit }}{% endif %} 
 {% trans 'Price' %}: {{ item.product_price_gross|currency }}
 {% trans 'Total' %}: {{ item.price_gross|currency }}
 {% endfor %}{% if order.voucher_number %}\n{% trans 'Voucher' %} ({{ order.voucher_number }})\n- {{ order.voucher_price|currency }}\n- {{ order.voucher_price|currency }}{% endif %}

File lfstheme/templates/lfs/mail/order_sent_mail.html

View file
  • Ignore whitespace
                        {{ item.product_sku }}
                     </td>
                     <td>
-                       {{ item.product_name }}
+                        {{ item.product_name }}
                         {% for property in item.product.get_displayed_properties %}
                             <div>
-                                {{ property.name }} : {{ property.value }} {{ property.unit|safe }}
+                                {{ property.title }} : {{ property.value }} {{ property.unit|safe }}
+                            </div>
+                        {% endfor %}
+
+                        {% for property in item.product.get_variant_properties %}
+                            <div>
+                                {{ property.title }}: {{ property.value }} {{ property.unit|safe }}
                             </div>
                         {% endfor %}
 
                         {% if item.product.is_configurable_product %}
                             {% for property in item.get_properties %}
                                 <div>
-                                    {{ property.name }} : {{ property.value }} {{ property.unit|safe }} ({{ property.price|currency }})
+                                    {{ property.title }} : {{ property.value }} {{ property.unit|safe }} ({{ property.price|currency }})
                                 </div>
                             {% endfor %}
                         {% endif %}
 
                     </td>
                     <td class="number">
-                        {{ item.product_amount }} {{ item.product.price_unit }}
-                        {% if item.product.active_packing_unit %} 
+                        {{ item.product_amount }} {{ item.product.unit }}
+                        {% if item.product.active_packing_unit %}
                             <span class="packing-unit">
                                 ({{ item|packages }} {{ item.product.packing_unit_unit }})
                             </span>
-                        {% endif %}                      
+                        {% endif %}
                     </td>
                     <td class="number">
                        {{ item.product_price_gross|currency }}{% if item.product.price_unit %} / {{ item.product.price_unit }}{% endif %}

File lfstheme/templates/lfs/mail/order_sent_mail.txt

View file
  • Ignore whitespace
 {% trans 'Order' %}: 
 ==============================================================================
 {% for item in order.items.all %}{% trans 'SKU' %}:  {{ item.product_sku }}
-{% trans 'Name' %}: {{ item.product_name }} {% for property in item.product.get_displayed_properties %}{{ property.name }} : {{ property.value }} {{ property.unit|safe }}\n{% endfor %}
+{% trans 'Name' %}: {{ item.product_name }} {% for property in item.product.get_displayed_properties %}{{ property.title }} : {{ property.value }} {{ property.unit|safe }}\n{% endfor %}
 {% trans 'Amount' %}: {{ item.product_amount }} {{ item.product.price_unit }} {% if item.product.active_packing_unit %}{{ item|packages }} {{ item.product.packing_unit_unit }}{% endif %} 
 {% trans 'Price' %}: {{ item.product_price_gross|currency }}
 {% trans 'Total' %}: {{ item.price_gross|currency }}

File lfstheme/templates/lfs/order/lfs_order_tmpl.html

View file
  • Ignore whitespace
                 {{ item.product_name }} 
                 {% for property in item.product.get_displayed_properties %}
                     <div>
-                        {{ property.name }} : {{ property.value }} {{ property.unit|safe }}
+                        {{ property.title }} : {{ property.value }} {{ property.unit|safe }}
                     </div>
                 {% endfor %}
                 
                 {% if item.product.is_configurable_product %}
                     {% for property in item.get_properties %}
                         <div>
-                            {{ property.name }} : {{ property.value }} {{ property.unit|safe }} ({{ property.price|currency }})
+                            {{ property.title }} : {{ property.value }} {{ property.unit|safe }} ({{ property.price|currency }})
                         </div>
                     {% endfor %}
                 {% endif %}

File lfstheme/templates/lfs/portlets/filter.html

View file
  • Ignore whitespace
                                     {% else %}
                                         {% if property.show_quantity %}
                                             <a href='{% url lfs_set_product_filter category.slug property_group.id property.value %}'>
-                                                {{ property.name }} {{ property_group.unit|safe }} ({{ property.quantity }})
+                                                {{ property.title }} {{ property_group.unit|safe }} ({{ property.quantity }})
                                             </a>
                                         {% else %}
                                             <span>
-                                                {{ property.name }} {{ property_group.unit|safe }}
+                                                {{ property.title }} {{ property_group.unit|safe }}
                                             </span>
                                         {% endif %}
 

File lfstheme/templates/lfs/search/livesearch_results.html

View file
  • Ignore whitespace
                     </a>
                     {% for property in product.get_displayed_properties %}
                         <div>
-                            {{ property.name }} : {{ property.value }} {{ property.unit|safe }}
+                            {{ property.title }} : {{ property.value }} {{ property.unit|safe }}
                         </div>
                     {% endfor %}
                 </td>

File lfstheme/templates/lfs/search/search_results.html

View file
  • Ignore whitespace
                     </a>
                     {% for property in product.get_displayed_properties %}
                         <div>
-                            {{ property.name }} : {{ property.value }} {{ property.unit|safe }}
+                            {{ property.title }} : {{ property.value }} {{ property.unit|safe }}
                         </div>
                     {% endfor %}
                 </div>