Skip to content

armgit / Vvveb

Public Imported from GitHub
0

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

products component author flag to include product admin user info

givanz9dfaa27da207
diff --git a/admin/sql/mysqli/product.sql b/admin/sql/mysqli/product.sql
index 129f542..b01bed6 100755
--- a/admin/sql/mysqli/product.sql
+++ b/admin/sql/mysqli/product.sql
@@ -797,6 +797,7 @@
LOCAL length_type INT, -- include length type
LOCAL rating INT, -- include rating average
LOCAL reviews INT, -- include reviews count
+ LOCAL author INT, -- include author/admin info
-- return array of products for products query
@@ -814,6 +815,13 @@
END @IF
+ -- include author info
+
+ @IF !empty(:author)
+ THEN
+ ,ad.display_name, ad.first_name, ad.last_name, ad.email, ad.last_name, ad.phone_number, ad.phone_number, ad.url, ad.avatar, ad.bio, ad.status, ad.created_at
+ END @IF
+
-- include image gallery
@IF !empty(:product_image)
@@ -1011,7 +1019,11 @@
INNER JOIN product_attribute pa ON (pa.product_id = product.product_id)
END @IF
-
+ @IF !empty(:author) AND !empty(:author)
+ THEN
+ LEFT JOIN admin ad ON (product.admin_id = ad.admin_id)
+ END @IF
+
WHERE p2s.site_id = :site_id
-- search
diff --git a/admin/sql/pgsql/product.sql b/admin/sql/pgsql/product.sql
index 5d8a450..485d5c1 100755
--- a/admin/sql/pgsql/product.sql
+++ b/admin/sql/pgsql/product.sql
@@ -796,6 +796,7 @@
LOCAL length_type INT, -- include length type
LOCAL rating INT, -- include rating average
LOCAL reviews INT, -- include reviews count
+ LOCAL author INT, -- include author/admin info
-- return array of products for products query
@@ -813,6 +814,13 @@
END @IF
+ -- include author info
+
+ @IF !empty(:author)
+ THEN
+ ,ad.display_name, ad.first_name, ad.last_name, ad.email, ad.last_name, ad.phone_number, ad.phone_number, ad.url, ad.avatar, ad.bio, ad.status, ad.created_at
+ END @IF
+
-- include image gallery
@IF !empty(:product_image)
@@ -1006,6 +1014,11 @@
INNER JOIN product_attribute pa ON (pa.product_id = product.product_id)
END @IF
+ @IF !empty(:author) AND !empty(:author)
+ THEN
+ LEFT JOIN admin ad ON (product.admin_id = ad.admin_id)
+ END @IF
+
WHERE p2s.site_id = :site_id
-- search
diff --git a/admin/sql/sqlite/product.sql b/admin/sql/sqlite/product.sql
index 93362b4..e00cbbb 100755
--- a/admin/sql/sqlite/product.sql
+++ b/admin/sql/sqlite/product.sql
@@ -801,6 +801,7 @@
LOCAL length_type INT, -- include length type
LOCAL rating INT, -- include rating average
LOCAL reviews INT, -- include reviews count
+ LOCAL author INT, -- include author/admin info
-- return array of products for products query
@@ -818,6 +819,13 @@
END @IF
+ -- include author info
+
+ @IF !empty(:author)
+ THEN
+ ,ad.display_name, ad.first_name, ad.last_name, ad.email, ad.last_name, ad.phone_number, ad.phone_number, ad.url, ad.avatar, ad.bio, ad.status, ad.created_at
+ END @IF
+
-- include image gallery
@IF !empty(:product_image)
@@ -1006,6 +1014,10 @@
JOIN product_content_search pcs ON (pcs.ROWID = pd.ROWID)
END @IF
+ @IF !empty(:author) AND !empty(:author)
+ THEN
+ LEFT JOIN admin ad ON (product.admin_id = ad.admin_id)
+ END @IF
WHERE p2s.site_id = :site_id
diff --git a/app/component/products.php b/app/component/products.php
index 5b31cc8..41eb6e1 100755
--- a/app/component/products.php
+++ b/app/component/products.php
@@ -58,6 +58,7 @@ class Products extends ComponentBase {
'length_type' => null, //[true, false] include length type info
'rating' => null, //[true, false] include rating average
'reviews' => null, //[true, false] include reviews count
+ 'author' => null, //[true, false] include author/admin info
'image_size' => 'medium',
'filter' => null, //[true, false] include variants
'order_by' => NULL,
@@ -132,7 +133,7 @@ class Products extends ComponentBase {
$this->options['search'] .= '*';
}
- $results = $products->getAll($this->options) + $this->options;
+ $results = $products->getAll($this->options) + $this->options;
if ($results && isset($results['product'])) {
$this->products($results['product'], $this->options);