Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Display appropriate delivery group number
Adam Bogdal813174c12fdf
diff --git a/saleor/checkout/__init__.py b/saleor/checkout/__init__.pyindex dbda3618c6..89350dfe06 100644--- a/saleor/checkout/__init__.py+++ b/saleor/checkout/__init__.py@@ -109,6 +109,9 @@ class Checkout(ProcessManager):def __iter__(self):return iter(self.steps)+ def delivery_steps(self):+ return [step for step in self.steps if step.group]+def create_order(self):order = Order()if self.request.user.is_authenticated():diff --git a/saleor/checkout/templates/checkout/summary.html b/saleor/checkout/templates/checkout/summary.htmlindex 4e2cb6bf4d..b7cb911b72 100644--- a/saleor/checkout/templates/checkout/summary.html+++ b/saleor/checkout/templates/checkout/summary.html@@ -35,58 +35,56 @@</div></div>- {% for step in checkout %}- {% if step.group %}- <div class="panel panel-default">- <div class="panel-heading">- {% blocktrans with number=forloop.counter %}Delivery group #{{ number }}{% endblocktrans %}- </div>- <div class="panel-body">- <table class="table table-striped">- <thead>+ {% for step in checkout.delivery_steps %}+ <div class="panel panel-default">+ <div class="panel-heading">+ {% blocktrans with number=forloop.counter %}Delivery group #{{ number }}{% endblocktrans %}+ </div>+ <div class="panel-body">+ <table class="table table-striped">+ <thead>+ <tr>+ <th class="col-sm-4">{% trans "Name" %}</th>+ <th class="col-sm-2">{% trans "Price" %}</th>+ <th class="col-sm-2">{% trans "Subtotal" %}</th>+ </tr>+ </thead>+ <tfoot>+ <tr>+ <th class="col-sm-4"></th>+ <th class="col-sm-2">{% trans "Total" %}</th>+ <th class="col-sm-2">{% gross step.group.get_total_with_delivery %}</th>+ </tr>+ </tfoot>+ <tbody>+ {% for item in step.group %}<tr>- <th class="col-sm-4">{% trans "Name" %}</th>- <th class="col-sm-2">{% trans "Price" %}</th>- <th class="col-sm-2">{% trans "Subtotal" %}</th>+ <td class="col-sm-4">{{ item.product }}{% if item.quantity != 1 %} <em>×{{ item.quantity }}</em>{% endif %}</td>+ <td class="col-sm-2">{% gross item.get_price_per_item %}</td>+ <td class="col-sm-2">{% gross item.get_total %}</td></tr>- </thead>- <tfoot>+ {% endfor %}+ {% if step.group.get_delivery_total.gross %}<tr>- <th class="col-sm-4"></th>- <th class="col-sm-2">{% trans "Total" %}</th>- <th class="col-sm-2">{% gross step.group.get_total_with_delivery %}</th>+ <td class="col-sm-4">+ {% trans "Shipping" %} ({{ step.group }})+ </td>+ <td class="col-sm-2">{% gross step.group.get_delivery_total %}</td>+ <td class="col-sm-2">{% gross step.group.get_delivery_total %}</td></tr>- </tfoot>- <tbody>- {% for item in step.group %}- <tr>- <td class="col-sm-4">{{ item.product }}{% if item.quantity != 1 %} <em>×{{ item.quantity }}</em>{% endif %}</td>- <td class="col-sm-2">{% gross item.get_price_per_item %}</td>- <td class="col-sm-2">{% gross item.get_total %}</td>- </tr>- {% endfor %}- {% if step.group.get_delivery_total.gross %}- <tr>- <td class="col-sm-4">- {% trans "Shipping" %} ({{ step.group }})- </td>- <td class="col-sm-2">{% gross step.group.get_delivery_total %}</td>- <td class="col-sm-2">{% gross step.group.get_delivery_total %}</td>- </tr>- {% endif %}- </tbody>- </table>- {% if step.group.email %}- <p>{% trans "Will be sent to" %} {{ step.group.email }}</p>- {% elif step.group.address %}- <p>{% trans "Will be shipped to" %} {% include "userprofile/snippets/address-short.html" with address=step.group.address %}</p>- {% else %}- <p class="text-danger">{% trans "No address given yet." %}</p>- {% endif %}- <p><a href="{{ step.get_absolute_url }}">{% trans "Edit delivery details" %}</a></p>- </div>+ {% endif %}+ </tbody>+ </table>+ {% if step.group.email %}+ <p>{% trans "Will be sent to" %} {{ step.group.email }}</p>+ {% elif step.group.address %}+ <p>{% trans "Will be shipped to" %} {% include "userprofile/snippets/address-short.html" with address=step.group.address %}</p>+ {% else %}+ <p class="text-danger">{% trans "No address given yet." %}</p>+ {% endif %}+ <p><a href="{{ step.get_absolute_url }}">{% trans "Edit delivery details" %}</a></p></div>- {% endif %}+ </div>{% endfor %}{% with total=checkout.get_total %}