Back to PhocacartOrder class

Method saveOrderHistory

public
saveOrderHistory
(mixed $statusId, mixed $notify, mixed $userId, mixed $orderId)

Method saveOrderHistory - Source code

public function saveOrderHistory($statusId, $notify, $userId, $orderId)
{
    $app = Factory::getApplication();
    $db = Factory::getDbo();
    $row = Table::getInstance('PhocacartOrderHistory', 'Table', array());
    $d = array();
    $d['order_status_id'] = (int) $statusId;
    $d['notify'] = (int) $notify;
    $d['user_id'] = (int) $userId;
    $d['order_id'] = (int) $orderId;
    $d['date'] = gmdate('Y-m-d H:i:s');
    if (!$row->bind($d)) {
        //throw new Exception($row->getError());
        $msg = Text::_($row->getError());
        $app->enqueueMessage($msg, 'error');
        return false;
    }
    if (!$row->check()) {
        //throw new Exception($row->getError());
        $msg = Text::_($row->getErrorMsg());
        $app->enqueueMessage($msg, 'error');
        return false;
    }
    if (!$row->store()) {
        //throw new Exception($row->getError());
        $msg = Text::_($row->getErrorMsg());
        $app->enqueueMessage($msg, 'error');
        return false;
    }
    return true;
}