function itemsupdate($userid, $ordercode)
 {
     $query = 'UPDATE #__ticketmaster_orders' . ' SET userid = ' . (int) $userid . ' WHERE ordercode =  ' . $ordercode . ' ';
     ## Do the query now
     $this->_db->setQuery($query);
     ## When query goes wrong.. Show message with error.
     if (!$this->_db->query()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $db = JFactory::getDBO();
     ## Check if waiting list is turned on:
     $sql = "SELECT show_waitinglist \n\t\t\t\t\tFROM #__ticketmaster_config \n\t\t\t\t\tWHERE configid = 1";
     $db->setQuery($sql);
     $config = $db->loadObject();
     if ($config->show_waitinglist == 1) {
         $query = 'UPDATE #__ticketmaster_waitinglist' . ' SET userid = ' . (int) $userid . ' WHERE ordercode =  ' . $ordercode . ' ';
         ## Do the query now
         $this->_db->setQuery($query);
         ## When query goes wrong.. Show message with error.
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         $path_include = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_ticketmaster' . DS . 'classes' . DS . 'confirmation.php';
         include_once $path_include;
         $sendconfirmation = new confirmation((int) $ordercode);
         $sendconfirmation->SendWaitingList();
     }
     return true;
 }
 function itemsupdate($userid, $ordercode)
 {
     $query = 'UPDATE #__ticketmaster_orders' . ' SET userid = ' . (int) $userid . ' WHERE ordercode =  ' . $ordercode . ' ';
     ## Do the query now
     $this->_db->setQuery($query);
     ## When query goes wrong.. Show message with error.
     if (!$this->_db->query()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     ## TRIGGER INVOICING PLUGIN AND RELATED onAfterCheckout
     JPluginHelper::importPlugin('rdmediahelpers');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('OnAfterCheckout', array($vars));
     $db = JFactory::getDBO();
     ## Check if waiting list is turned on:
     $sql = "SELECT show_waitinglist\n\t\t\t\t\tFROM #__ticketmaster_config\n\t\t\t\t\tWHERE configid = 1";
     $db->setQuery($sql);
     $config = $db->loadObject();
     if ($config->show_waitinglist == 1) {
         $query = 'UPDATE #__ticketmaster_waitinglist' . ' SET userid = ' . (int) $userid . ' WHERE ordercode =  ' . $ordercode . ' ';
         ## Do the query now
         $this->_db->setQuery($query);
         ## When query goes wrong.. Show message with error.
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         $path_include = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_ticketmaster' . DS . 'classes' . DS . 'confirmation.php';
         include_once $path_include;
         $sendconfirmation = new confirmation((int) $ordercode);
         $sendconfirmation->SendWaitingList();
     }
     return true;
 }
    function getConfig()
    {
        if (empty($this->_data)) {
            $db = JFactory::getDBO();
            ## Making the query for showing all the cars in list function
            $sql = 'SELECT * FROM #__ticketmaster_config WHERE configid = 1';
            $db->setQuery($sql);
            $data = $db->loadObject();
            if ($data->show_waitinglist == 1) {
                ## Check if waiting list is turned on:
                $sql = 'SELECT COUNT(id) AS total 
						FROM #__ticketmaster_waitinglist 
						WHERE sent = 0
						AND ordercode = ' . (int) $this->ordercode . '';
                $db->setQuery($sql);
                $waiters = $db->loadObject();
                if ($waiters->total != 0) {
                    $path_include = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_ticketmaster' . DS . 'classes' . DS . 'confirmation.php';
                    include_once $path_include;
                    $sendconfirmation = new confirmation((int) $this->ordercode);
                    $sendconfirmation->SendWaitingList();
                }
            }
        }
        return $data;
    }