| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/catalog/administrator/components/com_djcatalog2/models/ |
Upload File : |
<?php
/**
* @package DJ-Catalog2
* @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email contact@dj-extensions.com
*/
// no direct access
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\MVC\Model\ListModel;
jimport('joomla.application.component.modellist');
class Djcatalog2ModelTaxrules extends ListModel
{
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'name', 'a.name', 'a.tax_rate_id', 'c.country_name', 'c.country_id'
);
}
parent::__construct($config);
}
protected function populateState($ordering = null, $direction = null)
{
// List state information.
parent::populateState('a.name', 'asc');
// Initialise variables.
$app = Factory::getApplication();
$session = Factory::getSession();
$tax_rate = $this->getUserStateFromRequest($this->context.'.filter.tax_rate_id', 'tax_rate_id', false);
$this->setState('filter.tax_rate_id', $tax_rate);
// Load the parameters.
$params = ComponentHelper::getParams('com_djcatalog2');
$this->setState('params', $params);
}
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.*'
)
);
$query->from('#__djc2_tax_rules AS a');
if ($rate_id = $this->getState('filter.tax_rate_id')) {
$query->where('tax_rate_id='.(int)$rate_id);
}
$query->select('c.country_name, c.country_2_code as code');
$query->join('left', '#__djc2_countries as c on c.id = a.country_id');
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
$query->order($db->escape($orderCol.' '.$orderDirn));
return $query;
}
public function getParent() {
$tax_rate_id = Factory::getApplication()->input->get('tax_rate_id', $this->state->get('filter.tax_rate_id'));
$tax_rate = null;
if ($tax_rate_id > 0) {
$this->_db->setQuery('select * from #__djc2_tax_rates where id ='.(int)$tax_rate_id);
$tax_rate = $this->_db->loadObject();
}
return $tax_rate;
}
}