Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Changed posts to post alia for taxonomy queries and categories component

givanza6cb0d2be5cd
diff --git a/admin/sql/mysqli/category.sql b/admin/sql/mysqli/category.sql
index 26aebc7..fb7c1b2 100644
--- a/admin/sql/mysqli/category.sql
+++ b/admin/sql/mysqli/category.sql
@@ -172,7 +172,7 @@
LEFT JOIN post p ON (pc.post_id = p.post_id)
LEFT JOIN post_to_taxonomy_item ptt ON (ptt.taxonomy_item_id = @taxonomy_item_id AND ptt.post_id = p.post_id)
WHERE ptt.taxonomy_item_id = @taxonomy_item_id ORDER by p.sort_order
- ) AS posts
+ ) AS post
FROM taxonomy_item AS categories
diff --git a/admin/sql/mysqli/menu.sql b/admin/sql/mysqli/menu.sql
index 935ca87..da1d00d 100644
--- a/admin/sql/mysqli/menu.sql
+++ b/admin/sql/mysqli/menu.sql
@@ -1,5 +1,5 @@
-- Menus
-
+
-- get menu
CREATE PROCEDURE getMenu(
@@ -96,8 +96,6 @@
IN language_id INT,
IN menu_id INT,
IN site_id INT,
- IN post_id INT,
- IN search CHAR,
IN type CHAR,
-- pagination
@@ -113,11 +111,20 @@
SELECT *, menu.menu_id as array_key
- FROM menu
+ FROM menu
+
+ @IF isset(:menu_id)
+ THEN
+ WHERE menu.menu_id IN (:menu_id)
+ END @IF
+
+ -- limit
+ @IF isset(:limit)
+ THEN
+ @SQL_LIMIT(:start, :limit)
+ END @IF;
- @SQL_LIMIT(:start, :limit);
-
SELECT count(*) FROM (
@SQL_COUNT(menu.menu_id, menu) -- this takes previous query removes limit and replaces select columns with parameter menu_id
diff --git a/admin/sql/pgsql/category.sql b/admin/sql/pgsql/category.sql
index 6680f19..855c329 100755
--- a/admin/sql/pgsql/category.sql
+++ b/admin/sql/pgsql/category.sql
@@ -171,7 +171,7 @@
LEFT JOIN post p ON (pc.post_id = p.post_id)
LEFT JOIN post_to_taxonomy_item ptt ON (ptt.taxonomy_item_id = categories.taxonomy_item_id AND ptt.post_id = p.post_id)
WHERE ptt.taxonomy_item_id = categories.taxonomy_item_id ORDER by p.sort_order
- ) AS posts
+ ) AS post
FROM taxonomy_item AS categories
diff --git a/admin/sql/pgsql/menu.sql b/admin/sql/pgsql/menu.sql
index a87cc7c..05abd7a 100755
--- a/admin/sql/pgsql/menu.sql
+++ b/admin/sql/pgsql/menu.sql
@@ -96,8 +96,6 @@
IN language_id INT,
IN menu_id INT,
IN site_id INT,
- IN post_id INT,
- IN search CHAR,
IN type CHAR,
-- pagination
@@ -115,8 +113,17 @@
FROM menu
+ @IF isset(:menu_id)
+ THEN
+ WHERE menu.menu_id IN (:menu_id)
+ END @IF
- @SQL_LIMIT(:start, :limit);
+ -- limit
+ @IF isset(:limit)
+ THEN
+ @SQL_LIMIT(:start, :limit)
+ END @IF;
+
SELECT count(*) FROM (
diff --git a/admin/sql/sqlite/category.sql b/admin/sql/sqlite/category.sql
index 651e9b3..f7f1a19 100755
--- a/admin/sql/sqlite/category.sql
+++ b/admin/sql/sqlite/category.sql
@@ -171,7 +171,7 @@
LEFT JOIN post p ON (pc.post_id = p.post_id)
LEFT JOIN post_to_taxonomy_item ptt ON (ptt.taxonomy_item_id = categories.taxonomy_item_id AND ptt.post_id = p.post_id)
WHERE ptt.taxonomy_item_id = categories.taxonomy_item_id ORDER by p.sort_order
- ) AS posts
+ ) AS post
FROM taxonomy_item AS categories
diff --git a/admin/sql/sqlite/menu.sql b/admin/sql/sqlite/menu.sql
index 0c695be..9bcf1f7 100755
--- a/admin/sql/sqlite/menu.sql
+++ b/admin/sql/sqlite/menu.sql
@@ -96,8 +96,6 @@
IN language_id INT,
IN menu_id INT,
IN site_id INT,
- IN post_id INT,
- IN search CHAR,
IN type CHAR,
-- pagination
@@ -115,8 +113,17 @@
FROM menu
+ @IF isset(:menu_id)
+ THEN
+ WHERE menu.menu_id IN (:menu_id)
+ END @IF
- @SQL_LIMIT(:start, :limit);
+ -- limit
+ @IF isset(:limit)
+ THEN
+ @SQL_LIMIT(:start, :limit)
+ END @IF;
+
SELECT count(*) FROM (
diff --git a/app/component/categories/pages.php b/app/component/categories/pages.php
index c43beb4..a63f9a4 100755
--- a/app/component/categories/pages.php
+++ b/app/component/categories/pages.php
@@ -58,7 +58,6 @@ class Pages extends ComponentBase {
break;
}
-
//count the number of child categories (subcategories) for each category
if (isset($results['categories'])) {
foreach ($results['categories'] as $taxonomy_item_id => &$category) {
@@ -74,11 +73,11 @@ class Pages extends ComponentBase {
$category['children'] = 0;
}
- if (isset($category['posts']) && $category['posts'] && $category['posts'][0] = '[') {
- $category['posts'] = json_decode($category['posts'], true);
+ if (isset($category['post']) && $category['post'] && $category['post'][0] = '[') {
+ $category['post'] = json_decode($category['post'], true);
- if (is_array($category['posts'])) {
- $category['posts_count'] = count($category['posts']);
+ if (is_array($category['post'])) {
+ $category['posts_count'] = count($category['post']);
}
}