public function aliasCallback($pattern, $path, $alias)
    {
        if (!empty($alias['entity']) && !empty($alias['entity_id'])) {
            if (strpos($pattern, "{$alias['entity']}/") === 0) {
                $this->callController($pattern, array($alias['entity_id']));
            }
        }

        if (!isset($alias)) {

            $arguments = array();

            if (gplcart_path_match($path, $pattern, $arguments)) {
                $conditions = array(strtok($pattern, '/'), reset($arguments));
                $sql = 'SELECT alias FROM alias WHERE entity=? AND entity_id=?';
                $alias_path = $this->db->fetchColumn($sql, $conditions);
            }

            if (!empty($alias_path)) {
                $this->url->redirect($alias_path);
            }
        }
    }