ADD filter/search to manufacturers and stocks

This commit is contained in:
2023-10-26 16:42:11 +02:00
parent e69f2af6b0
commit add4b362ac
9 changed files with 132 additions and 4 deletions

View File

@ -11,7 +11,8 @@
namespace KW4NZ\Component\Depot\Administrator\Model;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Table\Table;
// use Joomla\CMS\Table\Table;
use Joomla\Database\ParameterType;
\defined('_JEXEC') or die;
@ -60,6 +61,14 @@ class ManufacturersModel extends ListModel
->from($db->quoteName('#__depot_manufacturer', 'm'))
->join('LEFT', $db->quoteName('#__users', 'u'), $db->quoteName('u.id') . ' = ' . $db->quoteName('m.checked_out'));
// filter: like / search
$search = $this->getState('filter.search');
if (!empty($search)) {
$like = $db->quote('%' . $search . '%');
$query->where('(' . $db->quoteName('m.name_long') . ' LIKE ' . $like . ' OR ' .
$db->quoteName('m.name_short') . ' LIKE ' . $like . ')');
}
// Filter by published state
$published = (string) $this->getState('filter.published');
if (is_numeric($published)) {