Issue #191 fixed
This commit is contained in:
parent
639d4b1581
commit
49ddcd0256
|
|
@ -20,8 +20,17 @@ class OrderDataGrid extends DataGrid
|
|||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('orders')
|
||||
->select('id', 'base_sub_total', 'base_grand_total', 'created_at', 'channel_name', 'status')
|
||||
->addSelect(DB::raw('CONCAT(customer_first_name, " ", customer_last_name) as full_name'));
|
||||
->leftJoin('order_address as order_address_shipping', function($leftJoin) {
|
||||
$leftJoin->on('order_address_shipping.order_id', '=', 'orders.id')
|
||||
->where('order_address_shipping.address_type', 'shipping');
|
||||
})
|
||||
->leftJoin('order_address as order_address_billing', function($leftJoin) {
|
||||
$leftJoin->on('order_address_billing.order_id', '=', 'orders.id')
|
||||
->where('order_address_billing.address_type', 'billing');
|
||||
})
|
||||
->addSelect('orders.id', 'base_sub_total', 'base_grand_total', 'orders.created_at', 'channel_name', 'status')
|
||||
->addSelect(DB::raw('CONCAT(order_address_billing.first_name, " ", order_address_billing.last_name) as billed_to'))
|
||||
->addSelect(DB::raw('CONCAT(order_address_shipping.first_name, " ", order_address_shipping.last_name) as shipped_to'));
|
||||
|
||||
$this->addFilter('full_name', DB::raw('CONCAT(customer_first_name, " ", customer_last_name)'));
|
||||
|
||||
|
|
@ -96,12 +105,20 @@ class OrderDataGrid extends DataGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'full_name',
|
||||
'index' => 'billed_to',
|
||||
'label' => trans('admin::app.datagrid.billed-to'),
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'shipped_to',
|
||||
'label' => trans('admin::app.datagrid.shipped-to'),
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function prepareActions() {
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ return [
|
|||
'order-date' => 'Order Date',
|
||||
'channel-name' => 'Channel Name',
|
||||
'billed-to' => 'Billed To',
|
||||
'shipped-to' => 'Shipped To',
|
||||
'order-id' => 'Order Id',
|
||||
'invoice-date' => 'Invoice Date',
|
||||
'total-qty' => 'Total Qty',
|
||||
|
|
|
|||
|
|
@ -822,6 +822,7 @@ class Cart {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -833,7 +834,8 @@ class Cart {
|
|||
*/
|
||||
public function calculateItemsTax()
|
||||
{
|
||||
$cart = $this->getCart();
|
||||
if (! $cart = $this->getCart())
|
||||
return false;
|
||||
|
||||
if (! $shippingAddress = $cart->shipping_address)
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue