Commits

Kai Diefenbach committed fc589b5

First version of working packing unit

Comments (0)

Files changed (8)

lfstheme/static/css/main.css

     padding: 10px 10px 0 0;
 }
 
+div.product-quantity {
+    float: right;
+}
+
 .for-sale-price {
     font-weight: bold;
 }
     text-decoration: line-through;
 }
 
+.packing-result {
+    clear: both;
+    float: right;
+    font-size: 89%;
+    margin-top: 10px;
+}
+
+.packing-unit {
+    color: #555;
+}
+
 .sorting {
     background: url(../../lfstheme/img/portlet_header_bg.jpg) no-repeat right;
     text-align: right;
   background-color:#7e6b60;
   border:1px solid #dfd7d3;
   color:black !important;
-}
+}

lfstheme/templates/lfs/cart/added_to_cart_items.html

                 {% if cart_item.product.is_configurable_product %}
                     {% for property in cart_item.properties.all %}
                         <div>
-                            {{ property.property.name }} : {{ property.value|option_name }} {{ property.property.unit|safe }}
+                            {{ property.property.name }} : {{ property|option_name_for_property_value }} {{ property.property.unit|safe }}
                         </div>
                     {% endfor %}
                 {% endif %}
 
             </td>
             <td class="number">
-                {{ cart_item.amount|quantity }}
+                {{ cart_item.amount|quantity }} {{ cart_item.product.price_unit }}
+
+                {% if cart_item.product.active_packing_unit %}
+                    <span class="packing-unit">
+                        ({{ cart_item|packages }} {{ cart_item.product.packing_unit_unit }})
+                    </span>
+                {% endif %}
+
             </td>
             <td class="number">
                 {{ cart_item.product.get_price|currency }}
                 {% if cart_item.product.price_unit %}
                     / {{ cart_item.product.price_unit }}
-                {% endif %}                
+                {% endif %}
             </td>
             <td class="number">
                 ({{ cart_item.product.get_tax|currency }})

lfstheme/templates/lfs/cart/cart_inline.html

 
                     </td>
                     <td class="number">
-                        <input class="cart-amount"
+                        <input class="number cart-amount"
                                type="text"
                                name="amount-cart-item_{{ cart_item.id }}"
-                               size="2"
-                               value="{{ cart_item.amount }}" />
+                               size="6"
+                               value="{{ cart_item.amount }}" /> {{ cart_item.product.price_unit }}
+                               
+                        {% if cart_item.product.active_packing_unit %}
+                            <span class="packing-unit">
+                                ({{ cart_item|packages }} {{ cart_item.product.packing_unit_unit }})
+                            </span>
+                        {% endif %}
                     </td>
                     <td class="number"
                         nowrap="nowrap">
-                        {{ cart_item.get_price|currency }}
+                        {{ cart_item.product.get_price|currency }}
                         {# {{ cart_item.product.get_price|currency }} #}
                         {% if cart_item.product.price_unit %}
                             / {{ cart_item.product.price_unit }}

lfstheme/templates/lfs/catalog/packing_result.html

+{% load lfs_tags %}
+<div>
+Das entspricht {{ packs }} Paket/e ({{ real_quantity|decimal_l10n }} qm)
+</div>
+<div>
+und kostet {{ price|currency }}
+</div>

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

                     {{ property.name }}:
                 </td>
                 <td>
-                    <input style="margin: 0 6px" type="input" size="6" name="property-{{ property.id }}" />{{ property.unit }}
+                    <input class="product-input-field" style="margin: 0 6px" type="input" size="6" name="property-{{ property.id }}" />{{ property.unit }}
                 </td>
             {% endfor %}
 
     {% endif %}
 
     <br clear="both">
+
     <div class="buttons">
         {% if variant.deliverable %}
-            <div style="float:right; padding-right: 10px">
-                <input class="number" name="quantity" size="2" type="text" value="1" /> {% trans "Piece" %}
-            </div>
+            {% 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.price_unit }}
+                </div>
+                
+                <div class="packing-result">
+                    {{ packing_result }}
+                </div>
+                                
+            {% else %}
+                <div class="product-quantity">
+                    <input name="quantity" 
+                           size="10" 
+                           type="text" 
+                           value="1" /> {{ product.price_unit }}                
+                </div>
+            {% endif %}
             <br clear="both">
 
             <button class="emphasized"

lfstheme/templates/lfs/checkout/checkout_cart_inline.html

                 {% if cart_item.product.is_configurable_product %}
                     {% for property in cart_item.properties.all %}
                         <div>
-                            {{ property.property.name }} : {{ property.value|quantity }} {{ property.property.unit|safe }}
+                            {{ property.property.name }} : {{ property|option_name_for_property_value }} {{ property.property.unit|safe }}
                         </div>
                     {% endfor %}
                 {% endif %}
 
             </td>
             <td class="number">
-                {{ cart_item.amount }}
+                {{ cart_item.amount }} {{ cart_item.product.price_unit }}
+                
+                {% if cart_item.product.active_packing_unit %}
+                    <span class="packing-unit">
+                        ({{ cart_item|packages }} {{ cart_item.product.packing_unit_unit }})
+                    </span>
+                {% endif %}
+                
             </td>
             <td class="number">
                 {{ cart_item.product.get_price|currency }}
                 {% if cart_item.product.price_unit %}
                     / {{ cart_item.product.price_unit }}
                 {% endif %}
+
             </td>
             <td class="number">
                 ({{ cart_item.get_tax|currency }})

lfstheme/templates/lfs/mail/order_received_mail.html

                     {% trans 'Customer name' %}:
                 </td>
                 <td>
-                    {{order.customer_firstname}} {{order.customer_lastname}}
+                    {{ order.customer_firstname }} {{ order.customer_lastname }}
                 </td>
                 <td class="label">
                     {% trans 'Date' %}:
                 </td>
                 <td>
-                    {{order.created|date:_("DATETIME_FORMAT")}}
+                    {{ order.created|date:_("DATETIME_FORMAT") }}
                 </td>
             </tr>
             <tr>
                     {% trans 'E-mail' %}:
                 </td>
                 <td>
-                    {{order.customer_email}}
+                    {{ order.customer_email }}
                 </td>
                 <td class="label">
                     {% trans 'State' %}:
                 </td>
                 <td>
-                    {{order.get_state_display}}
+                    {{ order.get_state_display }}
                 </td>
             </tr>
             <tr>
                     {% trans 'Phone' %}:
                 </td>
                 <td>
-                    {{order.shipping_phone}}
+                    {{ order.shipping_phone }}
                 </td>
                 <td class="label">
                     {% trans 'Total' %}:
                 </td>
                 <td>
-                    {{order.price|currency}}
+                    {{ order.price|currency }}
                 </td>
             </tr>
 
             <tr>
                 <td>
                     <div>
-                        {{order.shipping_firstname}}
+                        {{ order.shipping_firstname }}
                     </div>
                     <div>
-                        {{order.shipping_lastname}}
+                        {{ order.shipping_lastname }}
                     </div>
                     <div>
-                        {{order.shipping_company_name}}
+                        {{ order.shipping_company_name }}
                     </div>
                     <div>
-                        {{order.shipping_street}}
+                        {{ order.shipping_street }}
                     </div>
                     <div>
-                        {{order.shipping_zip_code}} {{order.shipping_city}}
+                        {{ order.shipping_zip_code }} {{ order.shipping_city }}
                     </div>
                     <div>
-                        {{order.shipping_country}}
+                        {{ order.shipping_country }}
                     </div>
                     <div>
-                        {{order.shipping_phone}}
+                        {{ order.shipping_phone }}
                     </div>
                     <div>
-                        {{order.shipping_email}}
+                        {{ order.shipping_email }}
                     </div>
                 </td>
                 <td>
                     <div>
-                        {{order.invoice_firstname}}
+                        {{ order.invoice_firstname }}
                     </div>
                     <div>
-                        {{order.invoice_lastname}}
+                        {{ order.invoice_lastname }}
                     </div>
                     <div>
-                        {{order.invoice_company_name}}
+                        {{ order.invoice_company_name }}
                     </div>
                     <div>
-                        {{order.invoice_street}}
+                        {{ order.invoice_street }}
                     </div>
                     <div>
-                        {{order.invoice_zip_code}} {{order.invoice_city}}
+                        {{ order.invoice_zip_code }} {{ order.invoice_city }}
                     </div>
                     <div>
-                        {{order.invoice_country}}
+                        {{ order.invoice_country }}
                     </div>
                     <div>
-                        {{order.invoice_phone}}
+                        {{ order.invoice_phone }}
                     </div>
                     <div>
-                        {{order.invoice_email}}
+                        {{ order.invoice_email }}
                     </div>
                 </td>
                 <td>
                     <div>
-                        {{order.shipping_method}}
+                        {{ order.shipping_method }}
                     </div>
                 </td>
                 <td>
                     <div>
-                        {{order.payment_method.name}}
+                        {{ order.payment_method.name }}
                     </div>
                     {% ifequal order.payment_method.id 1 %}
                         <div>
-                            {{order.account_number}}
+                            {{ order.account_number }}
                         </div>
                         <div>
-                            {{order.bank_identification_code}}
+                            {{ order.bank_identification_code }}
                         </div>
                         <div>
-                            {{order.bank_name}}
+                            {{ order.bank_name }}
                         </div>
                         <div>
-                            {{order.depositor}}
+                            {{ order.depositor }}
                         </div>
                     {% endifequal %}
                     {% ifequal order.payment_method.id 3 %}
             {% for item in order.items.all %}
                 <tr>
                     <td>
-                       {{item.product_sku}}
+                       {{ item.product_sku }}
                     </td>
                     <td>
-                       {{item.product_name}}
+                       {{ item.product_name }}
                        {% for option in item.product.get_options %}
                             {% if option.property.display_on_product %}
                                <div>
-                                   {{option.property.name}} : {{option.value|option_name}} {{option.property.unit|safe}}
+                                   {{ option.property.name }} : {{ option.value|option_name }} {{ option.property.unit|safe }}
                                </div>
                             {% endif %}
                        {% endfor %}
 
                     </td>
                     <td class="number">
-                       {{item.product_amount}}
+                        {{ item.product_amount }} {{ item.product.price_unit }}
+                        {% if item.product.active_packing_unit %} 
+                            <span class="packing-unit">
+                                ({{ item|packages }} {{ item.product.packing_unit_unit }})
+                            </span>
+                        {% endif %}                      
                     </td>
                     <td class="number">
-                       {{item.product_price_gross|currency}}{% if item.product.price_unit %} / {{ item.product.price_unit }}{% endif %}
+                       {{ item.product_price_gross|currency }}{% if item.product.price_unit %} / {{ item.product.price_unit }}{% endif %}
                     </td>
                     <td class="number">
-                       {{item.price_gross|currency}}
+                       {{ item.price_gross|currency }}
                     </td>
                 </tr>
             {% endfor %}
             <tr>
                 <td></td>
                 <td>
-                    {% trans 'Shipping' %} ({{order.shipping_method}})
+                    {% trans 'Shipping' %} ({{ order.shipping_method }})
                 </td>
                 <td class="number">
                     1
                 </td>
                 <td class="number">
-                    {{order.shipping_price|currency}}
+                    {{ order.shipping_price|currency }}
                 </td>
                 <td class="number">
-                    {{order.shipping_price|currency}}
+                    {{ order.shipping_price|currency }}
                 </td>
             </tr>
             <tr>
                 <td></td>
                 <td>
-                    {% trans 'Payment' %} ({{order.payment_method}})
+                    {% trans 'Payment' %} ({{ order.payment_method }})
                 </td>
                 <td class="number">
                     1
                 </td>
                 <td class="number">
-                    {{order.payment_price|currency}}
+                    {{ order.payment_price|currency }}
                 </td>
                 <td class="number">
-                    {{order.payment_price|currency}}
+                    {{ order.payment_price|currency }}
                 </td>
             </tr>
             <tr class="total">
                 <td colspan="5"
                     class="number total">
-                    {{order.price|currency}}
+                    {{ order.price|currency }}
                 </td>
             </tr>
             <tr>
                 <td colspan="5"
                     class="number tax">
                     <span class="total-label">{% trans 'Inclusive VAT' %}:</span>
-                    {{order.tax|currency}}
+                    {{ order.tax|currency }}
                 </td>
             </tr>
         </table>
                 </tr>
                 <tr>
                     <td colspan="5">
-                        {{order.message}}
+                        {{ order.message }}
                     </td>
                 </tr>
             </table>

lfstheme/templates/lfs/mail/order_received_mail.txt

 
 {% trans 'Shipping address' %}
 ==============================================================================
-{{ order.shipping_firstname}} {{ order.shipping_lastname}}
-{{ order.shipping_company_name}}
-{{ order.shipping_street}}
-{{ order.shipping_zip_code}} {{ order.shipping_city}}
-{{ order.shipping_country}}
-{{ order.shipping_phone}}
-{{ order.shipping_email}}
+{{ order.shipping_firstname }} {{ order.shipping_lastname }}
+{{ order.shipping_company_name }}
+{{ order.shipping_street }}
+{{ order.shipping_zip_code }} {{ order.shipping_city }}
+{{ order.shipping_country }}
+{{ order.shipping_phone }}
+{{ order.shipping_email }}
 
 {% trans 'Invoice address' %}
 ==============================================================================
-{{ order.invoice_firstname}} {{ order.invoice_lastname}}
-{{ order.invoice_company_name}}
-{{ order.invoice_street}}
-{{ order.invoice_zip_code}} {{ order.invoice_city}}
-{{ order.invoice_country}}
-{{ order.invoice_phone}}
-{{ order.invoice_email}}
+{{ order.invoice_firstname }} {{ order.invoice_lastname }}
+{{ order.invoice_company_name }}
+{{ order.invoice_street }}
+{{ order.invoice_zip_code }} {{ order.invoice_city }}
+{{ order.invoice_country }}
+{{ order.invoice_phone }}
+{{ order.invoice_email }}
 
 {% trans 'Shipping method' %}: 
 ==============================================================================
 
 {% trans 'Order' %}: 
 ==============================================================================
-{% for item in order.items.all %}{% trans 'SKU' %}:  {{item.product_sku}}
-{% trans 'Name' %}: {{item.product_name}} {% for option in item.product.get_options %}{% if option.property.display_on_product %}{{ option.property.name}} : {{ option.value|option_name}} {{ option.property.unit|safe}}\n{% endif %}{% endfor %}
-{% trans 'Amount' %}: {{item.product_amount}}
-{% trans 'Price' %}: {{item.product_price_gross|currency}}
-{% trans 'Total' %}: {{item.price_gross|currency}}
+{% for item in order.items.all %}{% trans 'SKU' %}:  {{ item.product_sku }}
+{% trans 'Name' %}: {{ item.product_name }} {% for option in item.product.get_options %}{% if option.property.display_on_product %}{{ option.property.name }} : {{ option.value|option_name }} {{ option.property.unit|safe }}\n{% endif %}{% 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 }}
 {% endfor %}{% if order.voucher_number %}\n{% trans 'Voucher' %} ({{ order.voucher_number }})\n- {{ order.voucher_price|currency }}\n- {{ order.voucher_price|currency }}{% endif %}
 {% trans 'Shipping method' %}: {{ order.shipping_price|currency }} ({{ order.shipping_method }}) 
 {% trans 'Payment method' %}: {{ order.payment_price|currency }} ({{ order.payment_method }})
 
-{% trans ' Total' %}: {{ order.price|currency}}
+{% trans ' Total' %}: {{ order.price|currency }}
 {% trans 'Inclusive VAT' %}: {{ order.tax|currency }}
 
 {% if order.message %}\n{% trans 'Message' %}
 ==============================================================================
-{{ order.message}}{% endif %}
+{{ order.message }}{% endif %}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.