create admin customer view and add output info in customer loop
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
108
templates/admin/default/customers.html
Normal file
108
templates/admin/default/customers.html
Normal file
@@ -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"}
|
||||
<div class="catalog">
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
|
||||
{module_include location='customer_top'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator">
|
||||
<table class="table table-striped table-condensed" id="customer_list">
|
||||
<caption>
|
||||
{intl l="Customers list"}
|
||||
|
||||
{module_include location='customer_list_caption'}
|
||||
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.customers.create"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new category'}" href="#add_category_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</caption>
|
||||
|
||||
{ifloop rel="customer_list"}
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="object-title">
|
||||
{intl l="customer ref"}
|
||||
</th>
|
||||
|
||||
<th class="object-title">
|
||||
{intl l="company"}
|
||||
</th>
|
||||
|
||||
{module_include location='category_list_header'}
|
||||
|
||||
<th>
|
||||
{intl l="firstname & lastname"}
|
||||
</th>
|
||||
|
||||
<th>
|
||||
{intl l="last order"}
|
||||
</th>
|
||||
|
||||
<th>{intl l='order amount'}</th>
|
||||
|
||||
<th>{intl l='Actions'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="customer_list" type="customer" visible="*" last_order="1" backend_context="1"}
|
||||
<tr>
|
||||
<td>{#REF}</td>
|
||||
|
||||
<td>
|
||||
{#COMPANY}
|
||||
</td>
|
||||
|
||||
<td class="object-title">
|
||||
{#FIRSTNAME} {#LASTNAME}
|
||||
</td>
|
||||
|
||||
{module_include location='customer_list_row'}
|
||||
|
||||
<td>
|
||||
{format_date date=#LASTORDER_DATE}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{format_number number=#LASTORDER_AMOUNT}
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.customer.edit"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this customer'}" href="{url path="/admin/customer/update/{$ID}" }"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_send_mail" roles="ADMIN" permissions="admin.customer.sendMail"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l="Send a mail to this customer"}" href="mailto:{#EMAIL}"><span class="glyphicon glyphicon-envelope"></span></a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.customer.delete"}
|
||||
<a class="btn btn-default btn-xs customer-delete" title="{intl l='Delete this customer and all his orders'}" href="#delete_customer_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
{/ifloop}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{module_include location='customer_bottom'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/block}
|
||||
Reference in New Issue
Block a user