Back to PhocacartOrderStatus class

Method setHistory

public static
setHistory
(mixed $id, mixed $statusId, mixed $notify, mixed $comment)

Method setHistory - Source code

public static function setHistory($id, $statusId, $notify, $comment)
{
    $db = Factory::getDBO();
    //$user 		= PhocacartUser::getUser();
    $user = JFactory::getUser();
    // Logged in user, does not matter if customer|vendor|admin
    $userId = 0;
    if (isset($user->id) && (int) $user->id > 0) {
        $userId = (int) $user->id;
    }
    $date = Factory::getDate()->toSql();
    $valuesString = '(' . (int) $id . ', ' . (int) $statusId . ', ' . (int) $notify . ', ' . $db->quote($comment) . ', ' . $db->quote($date) . ', ' . (int) $userId . ')';
    $query = ' INSERT INTO #__phocacart_order_history (order_id, order_status_id, notify, comment, date, user_id)' . ' VALUES ' . (string) $valuesString;
    $db->setQuery($query);
    $db->execute();
    return true;
}