Skip to content

armgit / Vvveb

Public Imported from GitHub
0

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

Product and product content meta api and post api model fixes

givanz1bb86a1d8c2d
diff --git a/admin/sql/mysqli/post_content_meta.sql b/admin/sql/mysqli/post_content_meta.sql
index 891fc24..516f5b8 100644
--- a/admin/sql/mysqli/post_content_meta.sql
+++ b/admin/sql/mysqli/post_content_meta.sql
@@ -50,13 +50,13 @@
)
BEGIN
- INSERT INTO post_content_meta
- (post_id, namespace, `key`, value, language_id)
+ INSERT INTO post_content_meta
+ (post_id, language_id, namespace, `key`, value )
- VALUES (:post_id, :namespace, :key, :language_id, :value )
+ VALUES (:post_id, :language_id, :namespace, :key , :value )
- ON DUPLICATE KEY
- UPDATE value = values(value);
+ ON DUPLICATE KEY
+ UPDATE value = values(value);
END
@@ -115,7 +115,7 @@
VALUES ( :each, :post_id )
ON DUPLICATE KEY
- UPDATE value = VALUES(value);
+ UPDATE value = VALUES(value);
END
diff --git a/admin/sql/pgsql/post_content_meta.sql b/admin/sql/pgsql/post_content_meta.sql
index 5f80bbc..84f5dec 100644
--- a/admin/sql/pgsql/post_content_meta.sql
+++ b/admin/sql/pgsql/post_content_meta.sql
@@ -50,13 +50,12 @@
)
BEGIN
- INSERT INTO post_content_meta
- (post_id, namespace, "key", language_id, value )
-
- VALUES (:post_id, :namespace, :key, :language_id, :value )
-
-
- ON CONFLICT("post_id", "language_id","namespace", "key") DO UPDATE SET "value" = :each;
+ INSERT INTO post_content_meta
+ (post_id, language_id, namespace, "key", value )
+
+ VALUES (:post_id, :language_id, :namespace, :key , :value )
+
+ ON CONFLICT("post_id", "language_id","namespace", "key") DO UPDATE SET "value" = :value;
END
diff --git a/admin/sql/pgsql/product_content_meta.sql b/admin/sql/pgsql/product_content_meta.sql
index 0648ebb..c9c8a4b 100644
--- a/admin/sql/pgsql/product_content_meta.sql
+++ b/admin/sql/pgsql/product_content_meta.sql
@@ -55,7 +55,7 @@
VALUES (:product_id, :namespace, :key, :value, :language_id )
- ON CONFLICT("product_id", "language_id","namespace", "key") DO UPDATE SET "value" = :each;
+ ON CONFLICT("product_id", "language_id","namespace", "key") DO UPDATE SET "value" = :value;
END
@@ -114,7 +114,7 @@
VALUES ( :each, :product_id )
- ON CONFLICT("product_id", "language_id","namespace", "key") DO UPDATE SET "value" = :each;
+ ON CONFLICT("product_id", "language_id","namespace", "key") DO UPDATE SET "value" = :each.value;
END
diff --git a/admin/sql/sqlite/post_content_meta.sql b/admin/sql/sqlite/post_content_meta.sql
index 8f0add3..d7c84ee 100644
--- a/admin/sql/sqlite/post_content_meta.sql
+++ b/admin/sql/sqlite/post_content_meta.sql
@@ -50,13 +50,12 @@
)
BEGIN
- INSERT INTO post_content_meta
- (post_id, namespace, `key`, language_id, value )
-
- VALUES (:post_id, :namespace, :key, :language_id, :value )
+ INSERT INTO post_content_meta
+ (post_id, language_id, namespace, `key`, value )
+ VALUES (:post_id, :language_id, :namespace, :key , :value )
- ON CONFLICT(`post_id`, `language_id`,`namespace`, `key`) DO UPDATE SET `value` = :each;
+ ON CONFLICT(`post_id`, `language_id`,`namespace`, `key`) DO UPDATE SET `value` = :value;
END
diff --git a/admin/sql/sqlite/product_content_meta.sql b/admin/sql/sqlite/product_content_meta.sql
index 887ca75..a700fc3 100644
--- a/admin/sql/sqlite/product_content_meta.sql
+++ b/admin/sql/sqlite/product_content_meta.sql
@@ -55,7 +55,7 @@
VALUES (:product_id, :namespace, :key, :value, :language_id )
- ON CONFLICT(`product_id`, `language_id`,`namespace`, `key`) DO UPDATE SET `value` = :each;
+ ON CONFLICT(`product_id`, `language_id`,`namespace`, `key`) DO UPDATE SET `value` = :value;
END
@@ -114,7 +114,7 @@
VALUES ( :each, :product_id )
- ON CONFLICT(`product_id`, `language_id`,`namespace`, `key`) DO UPDATE SET `value` = :each;
+ ON CONFLICT(`product_id`, `language_id`,`namespace`, `key`) DO UPDATE SET value = :each.value;
END
diff --git a/system/meta/product-content-meta.php b/system/meta/product-content-meta.php
new file mode 100644
index 0000000..bda1fcb
--- /dev/null
+++ b/system/meta/product-content-meta.php
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * Vvveb
+ *
+ * Copyright (C) 2022 Ziadin Givan
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Vvveb\System\Meta;
+
+class ProductContentMeta extends Meta {
+ protected $modelName = 'product_content_meta';
+
+ protected $item_id = 'product_id';
+}
diff --git a/system/meta/product-meta.php b/system/meta/product-meta.php
new file mode 100644
index 0000000..559799e
--- /dev/null
+++ b/system/meta/product-meta.php
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * Vvveb
+ *
+ * Copyright (C) 2022 Ziadin Givan
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Vvveb\System\Meta;
+
+class ProductMeta extends Meta {
+ protected $modelName = 'product_meta';
+
+ protected $item_id = 'product_id';
+}