Jump to content

Edit History

ps8modules

ps8modules

In the list of orders, you can display your own column and values by embedding four hooks.

actionOrderGridDefinitionModifier, actionOrderGridQueryBuilderModifier, actionOrderGridDataModifier, actionAdminOrdersListingFieldsModifier.

You can define your changes in the hookActionAdminOrdersListingFieldsModifier.

E.g:

public function hookActionAdminOrdersListingFieldsModifier(array $params)
{

    if (isset($params['select'])) {
        $params['select'] .= ', DATE_FORMAT(DATE_ADD(op.`date_add`,INTERVAL 7 + IF((WEEKDAY(DATE_ADD(op.`date_add`, INTERVAL 7 DAY)) IN (5)), 2, 0) + IF((WEEKDAY(DATE_ADD(op.`date_add`, INTERVAL 7 DAY)) IN (6)), 1, 0) DAY), "%W, %e of %M") as `DayOfDelivery`';
    }

    if (isset($params['join'])) {
        $params['join'] .= 'LEFT JOIN ' . _DB_PREFIX_ . 'order_payment AS op ON (a.reference = op.order_reference)';
    }

    $params['fields']['DayOfDelivery']['callback'] = 'getIsDayOfDelivery';
    $params['fields']['DayOfDelivery']['callback_object'] = $this;

}

public function getIsDayOfDelivery($a, $order)
{
    if ($order['note']) {
        return '<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="'.$order['note'].'" data-html="true" data-placement="top"><i class="icon-truck"></i></span>';
    } else {
        return '<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="'.$order['DayOfDelivery'].'" data-html="true" data-placement="top"><i class="icon-truck"></i></span>';
    }
}

 

Or another way.
Capture the change in order status when it is written into the ps_order_payment table and fill your date into ps_orders and the DayOfDelivery column. Alternatively, override ./classes/order/Order.php and the addOrderPayment function.
Then you can see the data straight away in your new column.

 

ps8modules

ps8modules

In the list of orders, you can display your own column and values by embedding four hooks.

actionOrderGridDefinitionModifier, actionOrderGridQueryBuilderModifier, actionOrderGridDataModifier, actionAdminOrdersListingFieldsModifier.

You can define your changes in the hookActionAdminOrdersListingFieldsModifier.

E.g:

public function hookActionAdminOrdersListingFieldsModifier(array $params)
{

    if (isset($params['select'])) {
        $params['select'] .= ', DATE_FORMAT(DATE_ADD(op.`date_add`,INTERVAL 7 + IF((WEEKDAY(DATE_ADD(op.`date_add`, INTERVAL 7 DAY)) IN (5)), 2, 0) + IF((WEEKDAY(DATE_ADD(op.`date_add`, INTERVAL 7 DAY)) IN (6)), 1, 0) DAY), "%W, %e of %M") as `DayOfDelivery`';
    }

    if (isset($params['join'])) {
        $params['join'] .= 'LEFT JOIN ' . _DB_PREFIX_ . 'order_payment AS op ON (a.reference = op.order_reference)';
    }

    $params['fields']['DayOfDelivery']['callback'] = 'getIsDayOfDelivery';
    $params['fields']['DayOfDelivery']['callback_object'] = $this;

}

public function getIsDayOfDelivery($a, $order)
{
    if ($order['note']) {
        return '<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="'.$order['note'].'" data-html="true" data-placement="top"><i class="icon-truck"></i></span>';
    } else {
        return '<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="'.$order['DayOfDelivery'].'" data-html="true" data-placement="top"><i class="icon-truck"></i></span>';
    }
}

 

 

×
×
  • Create New...