diff --git a/core/lib/Thelia/Core/Template/Loop/Customer.php b/core/lib/Thelia/Core/Template/Loop/Customer.php index 1a4b84105..cbf9e4fda 100755 --- a/core/lib/Thelia/Core/Template/Loop/Customer.php +++ b/core/lib/Thelia/Core/Template/Loop/Customer.php @@ -64,6 +64,7 @@ class Customer extends BaseLoop ) ), Argument::createBooleanTypeArgument('reseller'), + Argument::createBooleanTypeArgument('last_order'), Argument::createIntTypeArgument('sponsor') ); } @@ -130,6 +131,20 @@ class Customer extends BaseLoop $loopResultRow->set("SPONSOR", $customer->getSponsor()); $loopResultRow->set("DISCOUNT", $customer->getDiscount()); + $lastOrderDate = ""; + $lastOrderAmount = ""; + + if ($this->getLastOrder()) { + $order = $customer->getOrders()->getFirst(); + if ($order) { + $lastOrderDate = $order->getCreatedAt(); + $lastOrderAmount = $order->getTotalAmount(); + } + } + + $loopResultRow->set("LASTORDER_DATE", $lastOrderDate); + $loopResultRow->set("LASTORDER_AMOUNT", $lastOrderAmount); + $loopResult->addRow($loopResultRow); } diff --git a/core/lib/Thelia/Model/Order.php b/core/lib/Thelia/Model/Order.php index 91582750a..ccdd152b5 100755 --- a/core/lib/Thelia/Model/Order.php +++ b/core/lib/Thelia/Model/Order.php @@ -6,4 +6,15 @@ use Thelia\Model\Base\Order as BaseOrder; class Order extends BaseOrder { + /** + * calculate the total amount + * + * @TODO create body method + * + * @return int + */ + public function getTotalAmount() + { + return 0; + } } diff --git a/templates/admin/default/customers.html b/templates/admin/default/customers.html new file mode 100644 index 000000000..0e68677dd --- /dev/null +++ b/templates/admin/default/customers.html @@ -0,0 +1,108 @@ +{extends file="admin-layout.tpl"} + +{block name="page-title"}{intl l='Customer'}{/block} + +{block name="check-permissions"}admin.customer.view{/block} + +{block name="main-content"} +
| + {intl l="customer ref"} + | + ++ {intl l="company"} + | + + {module_include location='category_list_header'} + ++ {intl l="firstname & lastname"} + | + ++ {intl l="last order"} + | + +{intl l='order amount'} | + +{intl l='Actions'} | +
|---|---|---|---|---|---|
| {#REF} | + ++ {#COMPANY} + | + ++ {#FIRSTNAME} {#LASTNAME} + | + + {module_include location='customer_list_row'} + ++ {format_date date=#LASTORDER_DATE} + | + ++ {format_number number=#LASTORDER_AMOUNT} + | +
+
+
+ {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.customer.edit"}
+
+ {/loop}
+ {loop type="auth" name="can_send_mail" roles="ADMIN" permissions="admin.customer.sendMail"}
+
+ {/loop}
+ {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.customer.delete"}
+
+ {/loop}
+
+ |
+
+