function _buildQuery() { $ehelper = new OnepageTemplateHelper(); if ($ehelper->columnExists('#__virtuemart_orders', 'track_num')) { $ups = 'o.track_num, '; } else { $ups = ''; } $keyword = JRequest::getVar('keyword', ''); $show = JRequest::getVar('show', ''); $list = "SELECT o.virtuemart_order_id as order_id, o.order_status, o.order_pass, " . $ups . " o.order_number, o.created_on, o.modified_on, o.order_total, o.order_currency, o.virtuemart_user_id as user_id,"; $list .= "u.first_name, u.last_name FROM #__virtuemart_orders as o LEFT JOIN #__virtuemart_order_userinfos as u ON o.virtuemart_order_id = u.virtuemart_order_id WHERE "; $count = "SELECT count(*) as num_rows FROM #__virtuemart_orders, #__virtuemart_order_userinfos WHERE "; $q = " u.address_type = 'BT' "; if (!empty($keyword)) { $q .= " AND (#__virtuemart_orders.order_id LIKE '%{$keyword}%' "; $q .= "OR #__virtuemart_orders.order_status LIKE '%{$keyword}%' "; $q .= "OR first_name LIKE '%{$keyword}%' "; $q .= "OR last_name LIKE '%{$keyword}%' "; $q .= "OR CONCAT(`first_name`, ' ', `last_name`) LIKE '%{$keyword}%' "; $q .= ") "; } if (!empty($show)) { $q .= " AND order_status = '{$show}' "; } // $q .= "(#__vm_orders.order_id=#__vm_order_user_info.order_id) "; //$q .= " o.vendor_id='".$_SESSION['ps_vendor_id']."' "; $q .= "ORDER BY o.created_on DESC "; $list .= $q; // . " LIMIT $limitstart, " . $limit; //$count .= $q; $query = $list; //.$limit; return $query; /* $this->_db->setQuery($query); $this->_data = $this->_db->loadObjectList(); $this->_total = count( $this->_data ) ; */ }