function productlistingsanddeals() { global $mainframe; $db =& JFactory::getDBO(); $filter_order = $mainframe->getUserStateFromRequest($option . 'filter_order', 'filter_order', 'id', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_state = $mainframe->getUserStateFromRequest($option . 'filter_state', 'filter_state', '', 'word'); $vendors = $mainframe->getUserStateFromRequest($option . 'vendors', 'vendors', '', 'string'); //$search = JString::strtolower( $search ); $products = $mainframe->getUserStateFromRequest($option . 'products', 'products', '', 'string'); $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int'); $where = array(); if ($vendors) { $where[] = 'vendor_id =' . $db->getEscaped($vendors); } if ($products) { $where[] = 'product_id = ' . $db->getEscaped($products); } $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : ''; if ($filter_order == 'id') { $orderby = ' ORDER BY id'; } else { $orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir . ', id'; } // get the total number of records $query = 'SELECT COUNT(*)' . ' FROM #__deal_productslisting_deals' . $where; $db->setQuery($query); $total = $db->loadResult(); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); $query = "SELECT * FROM #__deal_productslisting_deals" . $where . $orderby; $db->setQuery($query, $pageNav->limitstart, $pageNav->limit); $rows = $db->loadObjectList(); if ($db->getErrorNum()) { echo $db->stderr(); return false; } // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['vendors'] = $vendors; $lists['products'] = $products; DealCatalogHTML::productlistingsanddeals(&$rows, &$pageNav, &$lists); // Calling the products list and deals in html }