gestione categorie interne & fix
This commit is contained in:
@ -21,9 +21,9 @@ class Router extends RouterView
|
||||
$category->setKey('id')->setNestable();
|
||||
$this->registerView($category);
|
||||
|
||||
// Child: circolare (lega la category tramite catid)
|
||||
// Child: circolare (lega la category tramite categoria_id)
|
||||
$circolare = new RouterViewConfiguration('circolare');
|
||||
$circolare->setKey('id')->setParent($category, 'catid', 'id');
|
||||
$circolare->setKey('id')->setParent($category, 'categoria_id', 'id');
|
||||
$this->registerView($circolare);
|
||||
|
||||
parent::__construct($app, $menu);
|
||||
@ -48,7 +48,7 @@ class Router extends RouterView
|
||||
$path = (string) $db->setQuery(
|
||||
$db->getQuery(true)
|
||||
->select('path')
|
||||
->from('#__categories')
|
||||
->from('#__circolari_categorie')
|
||||
->where('id = ' . $id)
|
||||
->where("extension = 'com_content'")
|
||||
)->loadResult();
|
||||
@ -73,7 +73,7 @@ class Router extends RouterView
|
||||
|
||||
/* ---------------- PARSE ---------------- */
|
||||
|
||||
// Ricava catid accumulando i segmenti e risolvendo per PATH completo
|
||||
// Ricava categoria_id accumulando i segmenti e risolvendo per PATH completo
|
||||
public function getCategoryId($segment, $query)
|
||||
{
|
||||
static $segments = [];
|
||||
@ -86,7 +86,7 @@ class Router extends RouterView
|
||||
$id = (int) $db->setQuery(
|
||||
$db->getQuery(true)
|
||||
->select('id')
|
||||
->from('#__categories')
|
||||
->from('#__circolari_categorie')
|
||||
->where('path = ' . $db->quote($path))
|
||||
->where("extension = 'com_content'")
|
||||
)->loadResult();
|
||||
@ -99,7 +99,7 @@ class Router extends RouterView
|
||||
$id = (int) $db->setQuery(
|
||||
$db->getQuery(true)
|
||||
->select('id')
|
||||
->from('#__categories')
|
||||
->from('#__circolari_categorie')
|
||||
->where('alias = ' . $db->quote($segment))
|
||||
->where("extension = 'com_content'")
|
||||
->order('level DESC')
|
||||
@ -108,10 +108,10 @@ class Router extends RouterView
|
||||
return $id ?: 0;
|
||||
}
|
||||
|
||||
// Alias circolare (+ catid già risolto) → id
|
||||
// Alias circolare (+ categoria_id già risolto) → id
|
||||
public function getCircolareId($segment, $query)
|
||||
{
|
||||
$catid = (int) ($query['catid'] ?? 0);
|
||||
$categoria_id = (int) ($query['categoria_id'] ?? 0);
|
||||
|
||||
$db = Factory::getContainer()->get('DatabaseDriver');
|
||||
$q = $db->getQuery(true)
|
||||
@ -119,8 +119,8 @@ class Router extends RouterView
|
||||
->from('#__circolari')
|
||||
->where('alias = ' . $db->quote($segment));
|
||||
|
||||
if ($catid > 0) {
|
||||
$q->where('catid = ' . $catid);
|
||||
if ($categoria_id > 0) {
|
||||
$q->where('categoria_id = ' . $categoria_id);
|
||||
}
|
||||
|
||||
$db->setQuery($q);
|
||||
|
||||
Reference in New Issue
Block a user