ADD filter/search to manufacturers and stocks
This commit is contained in:
@ -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;
|
||||
|
||||
@ -58,6 +59,13 @@ class StocksModel extends ListModel
|
||||
)
|
||||
->from($db->quoteName('#__depot_stock', 's'))
|
||||
->join('LEFT', $db->quoteName('#__users', 'u'), $db->quoteName('u.id') . ' = ' . $db->quoteName('s.checked_out'));
|
||||
// filter: like / search
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search)) {
|
||||
$like = $db->quote('%' . $search . '%');
|
||||
$query->where('(' . $db->quoteName('s.name') . ' LIKE ' . $like . ' OR ' .
|
||||
$db->quoteName('s.description') . ' LIKE ' . $like . ')');
|
||||
}
|
||||
|
||||
// Filter by published state
|
||||
$published = (string) $this->getState('filter.published');
|
||||
|
Reference in New Issue
Block a user