Powerful and easy to use cms to build websites, blogs or ecommerce stores.
HTML backendblogblog-engineblog-platformbloggingcmscontent-managementcontent-management-systemecommerceecommerce-platformno-codepage-builderphpphp-cmsphp7php8self-hostedshopping-cartweb-applicationwebsite-builder
Clear template cache on plugin activate/deactivate. Order log list for order page.
givanze7262c1f3d29
diff --git a/admin/controller/content/comment.php b/admin/controller/content/comment.phpindex 1e0fa2b..80c4eb2 100755--- a/admin/controller/content/comment.php+++ b/admin/controller/content/comment.php@@ -34,9 +34,14 @@ class Comment extends Base {$comment_id = $this->request->get[$type . '_id'] ?? false;$comment = $this->request->post[$type] ?? false;- if ($comment_id && $comment) {+ if ($comment) {$comments = model($type);- $result = $comments->edit([$type => $comment, $type . '_id' => $comment_id]);++ if ($comment_id) {+ $result = $comments->edit([$type => $comment, $type . '_id' => $comment_id]);+ } else {+ $result = $comments->add([$type => $comment]);+ }if ($result && isset($result[$type])) {$this->view->success[] = __('Saved!');diff --git a/admin/controller/content/edit.php b/admin/controller/content/edit.phpindex 11880fb..60dcb3e 100644--- a/admin/controller/content/edit.php+++ b/admin/controller/content/edit.php@@ -31,6 +31,7 @@ use function Vvveb\slugify;use Vvveb\Sql\categorySQL;use Vvveb\System\CacheManager;use Vvveb\System\Core\View;+use Vvveb\System\Event;use Vvveb\System\Images;use Vvveb\System\Sites;use Vvveb\System\Validator;@@ -115,9 +116,11 @@ class Edit extends Base {if ($this->object == 'product') {$route = "product/{$this->type}/index";+ $altRoute = "product/{$this->object}/index";$controller = 'product';} else {$route = "content/{$this->type}/index";+ $altRoute = "content/{$this->object}/index";$controller = 'content';}@@ -129,6 +132,9 @@ class Edit extends Base {foreach ($post[$this->object . '_content'] as &$content) {if (! isset($post['url'])) {$post['url'] = \Vvveb\url($route, ['slug'=> $content['slug']]);+ if (!$post['url']) {+ $post['url'] = \Vvveb\url($altRoute, ['slug'=> $content['slug']]);+ }}$language = [];@@ -143,6 +149,9 @@ class Edit extends Base {$content['url'] = \Vvveb\url($route, $content + $language);$content['revision_count'] = 0;+ if (!$content['url']) {+ $content['url'] = \Vvveb\url($altRoute, $content + $language);+ }if ($revisions) {$revision = $revisions->getAll([$this->object . '_id' => $post_id, 'language_id' => $content['language_id']]);@@ -178,6 +187,8 @@ class Edit extends Base {$view->taxonomies = $this->taxonomies($post[$this->object . '_id'] ?? false);}+ list($post, $post_id) = Event :: trigger(__CLASS__,__FUNCTION__, $post, $post_id);+$object = $this->object;$view->$object = $post;$view->status = ['publish' => 'Publish', 'draft' => 'Draft', 'pending' => 'Pending', 'private' => 'Private', 'password' => 'Password'];@@ -322,6 +333,8 @@ class Edit extends Base {$posts->$productImage([$this->object . '_id' => $post_id ? $post_id : 0, $this->object . '_image' => $post[$this->object . '_image']]);}+ list($post, $post_id, $this->type) = Event :: trigger(__CLASS__,__FUNCTION__, $post, $post_id, $this->type);+if ($new) {$this->redirect(['module'=>$this->module, $this->object . '_id' => $id, 'type' => $this->type, 'success' => $message], [], false);}diff --git a/admin/controller/content/posts.php b/admin/controller/content/posts.phpindex d5e80f1..6cdc782 100755--- a/admin/controller/content/posts.php+++ b/admin/controller/content/posts.php@@ -133,21 +133,23 @@ class Posts extends Base {$defaultTemplate = "content/{$this->type}.html";- foreach ($results['posts'] as $id => &$post) {- if (isset($post['image'])) {- $post['image'] = Images::image($post['image'], 'post');- }+ if ($results && isset($results['posts'])) {+ foreach ($results['posts'] as $id => &$post) {+ if (isset($post['image'])) {+ $post['image'] = Images::image($post['image'], 'post');+ }- $url = ['module' => 'content/post', 'post_id' => $post['post_id'], 'type' => $post['type']];- $admin_path = \Vvveb\adminPath();- $template = $post['template'] ? $post['template'] : $defaultTemplate;- $post['url'] = \Vvveb\url($url);- $post['edit-url'] = $post['url'];+ $url = ['module' => 'content/post', 'post_id' => $post['post_id'], 'type' => $post['type']];+ $admin_path = \Vvveb\adminPath();+ $template = $post['template'] ? $post['template'] : $defaultTemplate;+ $post['url'] = \Vvveb\url($url);+ $post['edit-url'] = $post['url'];- $post['admin-url'] = \Vvveb\url(['module' => 'content/posts']) . '&filter[admin_id_text]=' . $post['username'] . ' &filter[admin_id]=' . $post['admin_id'];- $post['delete-url'] = \Vvveb\url(['module' => 'content/posts', 'action' => 'delete'] + $url + ['post_id[]' => $post['post_id']]);- $post['view-url'] = \Vvveb\url("content/{$this->type}/index", $post);- $post['design-url'] = $admin_path . \Vvveb\url(['module' => 'editor/editor', 'url' => $post['view-url'], 'template' => $template], false, false);+ $post['admin-url'] = \Vvveb\url(['module' => 'content/posts']) . '&filter[admin_id_text]=' . $post['username'] . ' &filter[admin_id]=' . $post['admin_id'];+ $post['delete-url'] = \Vvveb\url(['module' => 'content/posts', 'action' => 'delete'] + $url + ['post_id[]' => $post['post_id']]);+ $post['view-url'] = \Vvveb\url("content/{$this->type}/index", $post);+ $post['design-url'] = $admin_path . \Vvveb\url(['module' => 'editor/editor', 'url' => $post['view-url'], 'template' => $template], false, false);+ }}//archives for filterdiff --git a/admin/controller/order/order.php b/admin/controller/order/order.phpindex e5eeb50..ab01866 100755--- a/admin/controller/order/order.php+++ b/admin/controller/order/order.php@@ -27,6 +27,7 @@ use Vvveb\Controller\Base;use Vvveb\Controller\Content\AutocompleteTrait;use function Vvveb\orderStatusBadgeClass;use function Vvveb\prefixArrayKeys;+use Vvveb\Sql\Order_LogSQL;use Vvveb\Sql\OrderSQL;use Vvveb\System\Cart\Cart;use Vvveb\System\Cart\Currency;@@ -40,7 +41,7 @@ use function Vvveb\url;class Order extends Base {use AutocompleteTrait;-+protected $type = 'order';function index() {@@ -79,7 +80,8 @@ class Order extends Base {//$product['images'][] = ['image' => Images::image($product['image'], 'product')];}- $product['tax_formatted'] = $currency->format($product['tax']);+ $product['price_formatted'] = $currency->format($product['price']);+ $product['tax_formatted'] = $currency->format($product['tax']);}}@@ -92,7 +94,7 @@ class Order extends Base {$order['total_formatted'] = $currency->format($order['total']);$order['shipping_data'] = json_decode($order['shipping_data'] ?? '', true);$order['payment_data'] = json_decode($order['payment_data'] ?? '', true);- $order['class'] = orderStatusBadgeClass($order['order_status_id']);+ $order['class'] = orderStatusBadgeClass($order['order_status_id']);$order += prefixArrayKeys('shipping_', $order['shipping_data']) ?? [];$order += prefixArrayKeys('payment_', $order['payment_data']) ?? [];@@ -124,6 +126,46 @@ class Order extends Base {return $this->index();}+ function cart() {+ $order_id = $this->request->get['order_id'] ?? false;+ $product_id = $this->request->post['product_id'] ?? false;+ $quantity = $this->request->post['quantity'] ?? 1;++ if ($order_id && $product_id) {+ $order = new OrderSQL();+ $order->addProducts(['order_id' => $order_id, 'products' => [['product_id' => $product_id, 'quantity' => $quantity]]]);+ }++ $this->index();+ }++ function saveLog() {+ $order_id = $this->request->get['order_id'] ?? false;+ $log = $this->request->post['log'] ?? [];+ $view = $this->view;++ if ($order_id && $log) {+ // update order status with the last log status+ $order = new OrderSQL();+ $result = $order->edit(['order_id' => $order_id, 'order' => ['order_status_id' => $log['order_status_id']]]);++ if (isset($result['order'])/* && $result['order']*/) {+ $orderLog = new Order_LogSQL();+ $result = $orderLog->add(['order_id' => $order_id, 'order_log' => $log]);++ if (isset($result['order_log']) && $result['order_log']) {+ $view->success = [__('Order status saved!')];+ } else {+ $view->errors = [$orderLog->error];+ }+ } else {+ $view->errors = [$order->error];+ }+ }++ return $this->index();+ }+function save() {$validator = new Validator(['order']);$view = view :: getInstance();@@ -146,7 +188,7 @@ class Order extends Base {$orders = new OrderSQL();if ($order_id) {- $result = $orders->edit(['order_id' => $order_id, 'order' => $order]);+ $result = $orders->edit(['order_id' => $order_id, 'order' => $order]);if ($result >= 0) {$view->success = [__('Order saved')];diff --git a/admin/controller/order/orders.php b/admin/controller/order/orders.phpindex 9b38d03..3c878e7 100755--- a/admin/controller/order/orders.php+++ b/admin/controller/order/orders.php@@ -26,8 +26,8 @@ use function Vvveb\__;use Vvveb\Controller\Base;use function Vvveb\orderStatusBadgeClass;use Vvveb\Sql\OrderSQL;-use Vvveb\System\Core\View;use Vvveb\System\Cart\Currency;+use Vvveb\System\Core\View;class Orders extends Base {//check for order save permissiondiff --git a/admin/controller/plugin/plugins.php b/admin/controller/plugin/plugins.phpindex 218712f..c68b461 100755--- a/admin/controller/plugin/plugins.php+++ b/admin/controller/plugin/plugins.php@@ -30,6 +30,7 @@ use Vvveb\System\Core\FrontController;use Vvveb\System\Core\View;use Vvveb\System\Extensions\Plugins as PluginsList;use Vvveb\System\User\Admin;+use Vvveb\System\CacheManager;class Plugins extends Base {function init() {@@ -43,6 +44,7 @@ class Plugins extends Base {if (PluginsList::deactivate($this->plugin, $this->global['site_id'])) {$this->view->success[] = sprintf(__('Plugin `%s` deactivated!'), \Vvveb\humanReadable($this->plugin));+ CacheManager::clearCompiledFiles();}return $this->index();@@ -160,6 +162,8 @@ class Plugins extends Base {ignore_user_abort(1);clearstatcache(true);++ CacheManager::clearCompiledFiles();if (defined('CLI')) {$this->view->success = [$success];diff --git a/admin/controller/product/products.php b/admin/controller/product/products.phpindex 80537d9..895e809 100755--- a/admin/controller/product/products.php+++ b/admin/controller/product/products.php@@ -28,6 +28,7 @@ use function Vvveb\humanReadable;use Vvveb\Sql\ProductSQL;use Vvveb\System\Core\View;use Vvveb\System\Images;+use function Vvveb\url;class Products extends Base {protected $type = 'product';@@ -79,26 +80,28 @@ class Products extends Base {$defaultTemplate = "product/{$this->type}.html";- foreach ($results['products'] as $id => &$product) {- if (isset($product['images'])) {- $product['images'] = json_decode($product['images'], 1);-- foreach ($product['images'] as &$image) {- $image = Images::image($image, 'product');- }- } else {- if (isset($product['image'])) {- $product['image'] = Images::image($product['image'], 'product');+ if ($results && isset($results['products'])) {+ foreach ($results['products'] as $id => &$product) {+ if (isset($product['images'])) {+ $product['images'] = json_decode($product['images'], 1);++ foreach ($product['images'] as &$image) {+ $image = Images::image($image, 'product');+ }+ } else {+ if (isset($product['image'])) {+ $product['image'] = Images::image($product['image'], 'product');+ }}- }- $template = (isset($product['template']) && $product['template']) ? $product['template'] : $defaultTemplate;- $product['url'] = \Vvveb\url(['module' => 'product/product', 'product_id' => $product['product_id'], 'type' => $product['type']]);- $product['edit-url'] = \Vvveb\url(['module' => 'product/product', 'product_id' => $product['product_id'], 'type' => $product['type']]);- $product['delete-url'] = \Vvveb\url(['module' => 'product/products', 'action' => 'delete', 'product_id[]' => $product['product_id'], 'type' => $product['type']]);- $product['view-url'] = \Vvveb\url('product/product/index', $product);- $admin_path = \Vvveb\config('admin.path', 'admin') . '/';- $product['design-url'] = '/' . $admin_path . \Vvveb\url(['module' => 'editor/editor', 'url' => $product['view-url'], 'template' => $template], false, false);+ $template = (isset($product['template']) && $product['template']) ? $product['template'] : $defaultTemplate;+ $product['url'] = url(['module' => 'product/product', 'product_id' => $product['product_id'], 'type' => $product['type']]);+ $product['edit-url'] = url(['module' => 'product/product', 'product_id' => $product['product_id'], 'type' => $product['type']]);+ $product['delete-url'] = url(['module' => 'product/products', 'action' => 'delete', 'product_id[]' => $product['product_id'], 'type' => $product['type']]);+ $product['view-url'] = url('product/product/index', $product);+ $admin_path = \Vvveb\config('admin.path', 'admin') . '/';+ $product['design-url'] = '/' . $admin_path . url(['module' => 'editor/editor', 'url' => $product['view-url'], 'template' => $template], false, false);+ }}$view->set($results);@@ -107,7 +110,7 @@ class Products extends Base {$view->type = $this->type;$view->limit = $options['limit'];$view->type = $this->type;- $view->addUrl = \Vvveb\url(['module' => 'product/product', 'type' => $this->type]);+ $view->addUrl = url(['module' => 'product/product', 'type' => $this->type]);$view->type_name = humanReadable(__($this->type));$view->type_name_plural = humanReadable(__($view->type . 's'));}diff --git a/admin/controller/tools/update.php b/admin/controller/tools/update.phpindex 8f30e13..113e55e 100755--- a/admin/controller/tools/update.php+++ b/admin/controller/tools/update.php@@ -87,15 +87,15 @@ class Update extends Base {$url = [];- if (isset($this->view->errors)) {+ if (isset($this->view->errors[0])) {$url['error'] = $this->view->errors[0];}- if (isset($this->view->success)) {+ if (isset($this->view->success[0])) {$url['success'] = $this->view->success[0];}- if (isset($this->view->info)) {+ if (isset($this->view->info[0])) {$url['success'] = $this->view->info[0];}diff --git a/admin/controller/user/login.php b/admin/controller/user/login.phpindex a4ca8aa..97c41cf 100755--- a/admin/controller/user/login.php+++ b/admin/controller/user/login.php@@ -25,6 +25,7 @@ namespace Vvveb\Controller\User;use \Vvveb\System\Functions\Str;use function Vvveb\__;use function Vvveb\setLanguage;+use Vvveb\System\Event;use Vvveb\System\User\Admin;use Vvveb\System\Validator;@@ -82,6 +83,7 @@ class Login {if (($this->request->method == 'POST') &&($this->view->errors = $validator->validate($this->request->post)) === true) {$user = $this->request->post['user'];+$safemode = $this->request->post['safemode'] ?? false;$flags = [];@@ -97,20 +99,24 @@ class Login {$flags['safemode'] = true;}- if ($userInfo = Admin::login($loginData, $flags)) {- $this->view->success[] = __('Login successful!');+ list($loginData) = Event :: trigger(__CLASS__, __FUNCTION__ , $loginData);++ if ($loginData) {+ if ($userInfo = Admin::login($loginData, $flags)) {+ $this->view->success[] = __('Login successful!');- if (isset($this->request->post['redir']) && $this->request->post['redir'] && $_SERVER['REQUEST_URI'] != $this->request->post['redir']) {- $url = parse_url($this->request->post['redir']);- $this->redirect($url['path'] . '?' . ($url['query'] ?? '') . '#' . ($url['fragment'] ?? ''));- //$this->redirect($this->request->post['redirect']);+ if (isset($this->request->post['redir']) && $this->request->post['redir'] && $_SERVER['REQUEST_URI'] != $this->request->post['redir']) {+ $url = parse_url($this->request->post['redir']);+ $this->redirect($url['path'] . '?' . ($url['query'] ?? '') . '#' . ($url['fragment'] ?? ''));+ //$this->redirect($this->request->post['redirect']);+ } else {+ $this->redirect($admin_path);+ }} else {- $this->redirect($admin_path);+ //user not found or wrong password+ $this->view->errors = [__('Authentication failed, wrong email or password!')];+ $this->session->set('csrf', Str::random());}- } else {- //user not found or wrong password- $this->view->errors = [__('Authentication failed, wrong email or password!')];- $this->session->set('csrf', Str::random());}} else {//return $this->redirect($admin_path);diff --git a/admin/sql/mysqli/order.sql b/admin/sql/mysqli/order.sqlindex ef6d98b..15d939a 100755--- a/admin/sql/mysqli/order.sql+++ b/admin/sql/mysqli/order.sql@@ -140,9 +140,11 @@WHERE products.order_id = :order_id;- -- history- SELECT * FROM order_log as history- WHERE history.order_id = :order_id;+ -- log+ SELECT *,os.name as order_status+ FROM order_log as log+ LEFT JOIN order_status AS os ON (log.order_status_id = os.order_status_id AND os.language_id = :language_id)+ WHERE log.order_id = :order_id;-- metaSELECT * FROM order_meta as meta@@ -312,4 +314,31 @@WHERE order_id = :order_id;- END\ No newline at end of file+ END++ CREATE PROCEDURE addProducts(+ IN products ARRAY,+ IN product_options ARRAY,+ IN order_id INT,+ OUT insert_id,+ OUT insert_id+ )+ BEGIN++ :products = @FILTER(:products, order_product, false, true);+ :product_options = @FILTER(:product_options, order_product_option, false, true);++ -- insert products+ @EACH(:products)+ INSERT INTO order_product+ ( order_id, @KEYS(:each) )+ VALUES ( :order_id, :each );++ -- insert product options+ @EACH(:product_options)+ INSERT INTO order_product_option+ ( order_id, @KEYS(:each) )+ VALUES ( :order_id, 0, :each );++ END+\ No newline at end of filediff --git a/admin/sql/mysqli/order_log.sql b/admin/sql/mysqli/order_log.sqlnew file mode 100644index 0000000..3c0d0c1--- /dev/null+++ b/admin/sql/mysqli/order_log.sql@@ -0,0 +1,94 @@+-- Order log++ -- get all order log++ PROCEDURE getAll(+ IN order_id INT,+ IN start INT,+ IN limit INT,+ OUT fetch_all,+ OUT fetch_one,+ )+ BEGIN+ -- order_log+ SELECT *+ FROM order_log AS order_log WHERE 1 = 1++ @IF !empty(:order_id)+ THEN+ AND order_id = :order_id+ END @IF++ @SQL_LIMIT(:start, :limit);++ SELECT count(*) FROM (++ @SQL_COUNT(order_log.order_log_id, order_log) -- this takes previous query removes limit and replaces select columns with parameter product_id++ ) as count;++ END++ -- get order log++ PROCEDURE get(+ IN order_log_id INT,+ OUT fetch_row,+ )+ BEGIN+ -- order_log+ SELECT *+ FROM order_log as _ WHERE order_log_id = :order_log_id;+ END++ -- add order_log++ PROCEDURE add(+ IN order_log ARRAY,+ IN order_id INT,+ OUT insert_id+ )+ BEGIN++ -- allow only table fields and set defaults for missing values+ :order_log_data = @FILTER(:order_log, order_log);+++ INSERT INTO order_log++ ( @KEYS(:order_log_data), order_id )++ VALUES ( :order_log_data, :order_id );++ END++ -- edit order_log+ CREATE PROCEDURE edit(+ IN order_log ARRAY,+ IN order_log_id INT,+ OUT affected_rows+ )+ BEGIN++ -- allow only table fields and set defaults for missing values+ @FILTER(:order_log, order_log);++ UPDATE order_log++ SET @LIST(:order_log)++ WHERE order_log_id = :order_log_id+++ END++ -- delete order_log++ PROCEDURE delete(+ IN order_log_id ARRAY,+ OUT affected_rows,+ )+ BEGIN+ -- order_log+ DELETE FROM order_log WHERE order_log_id IN (:order_log_id);+ ENDdiff --git a/admin/sql/mysqli/product_question.sql b/admin/sql/mysqli/product_question.sqlindex 46d48c2..f6f476f 100755--- a/admin/sql/mysqli/product_question.sql+++ b/admin/sql/mysqli/product_question.sql@@ -69,7 +69,7 @@-- questionSELECT *FROM product_question as _ -- (underscore) _ means that data will be kept in main array- INNER JOIN user on user.user_id = product_question.user_id+ INNER JOIN user on user.user_id = _.user_idWHERE product_question_id = :product_question_id LIMIT 1;ENDdiff --git a/admin/sql/mysqli/product_review.sql b/admin/sql/mysqli/product_review.sqlindex 4abda45..7bcc2ca 100755--- a/admin/sql/mysqli/product_review.sql+++ b/admin/sql/mysqli/product_review.sql@@ -75,7 +75,7 @@-- reviewSELECT *FROM product_review as _ -- (underscore) _ means that data will be kept in main array- INNER JOIN user on user.user_id = product_review.user_id+ INNER JOIN user on user.user_id = _.user_idWHERE product_review_id = :product_review_id LIMIT 1;ENDdiff --git a/admin/sql/pgsql/order.sql b/admin/sql/pgsql/order.sqlindex 321af31..8ea056c 100755--- a/admin/sql/pgsql/order.sql+++ b/admin/sql/pgsql/order.sql@@ -140,9 +140,11 @@WHERE products.order_id = :order_id;- -- history- SELECT * FROM order_log as history- WHERE history.order_id = :order_id;+ -- log+ SELECT *,os.name as order_status+ FROM order_log as log+ LEFT JOIN order_status AS os ON (log.order_status_id = os.order_status_id AND os.language_id = :language_id)+ WHERE log.order_id = :order_id;-- metaSELECT * FROM order_meta as metadiff --git a/admin/sql/pgsql/order_log.sql b/admin/sql/pgsql/order_log.sqlnew file mode 100644index 0000000..3c0d0c1--- /dev/null+++ b/admin/sql/pgsql/order_log.sql@@ -0,0 +1,94 @@+-- Order log++ -- get all order log++ PROCEDURE getAll(+ IN order_id INT,+ IN start INT,+ IN limit INT,+ OUT fetch_all,+ OUT fetch_one,+ )+ BEGIN+ -- order_log+ SELECT *+ FROM order_log AS order_log WHERE 1 = 1++ @IF !empty(:order_id)+ THEN+ AND order_id = :order_id+ END @IF++ @SQL_LIMIT(:start, :limit);++ SELECT count(*) FROM (++ @SQL_COUNT(order_log.order_log_id, order_log) -- this takes previous query removes limit and replaces select columns with parameter product_id++ ) as count;++ END++ -- get order log++ PROCEDURE get(+ IN order_log_id INT,+ OUT fetch_row,+ )+ BEGIN+ -- order_log+ SELECT *+ FROM order_log as _ WHERE order_log_id = :order_log_id;+ END++ -- add order_log++ PROCEDURE add(+ IN order_log ARRAY,+ IN order_id INT,+ OUT insert_id+ )+ BEGIN++ -- allow only table fields and set defaults for missing values+ :order_log_data = @FILTER(:order_log, order_log);+++ INSERT INTO order_log++ ( @KEYS(:order_log_data), order_id )++ VALUES ( :order_log_data, :order_id );++ END++ -- edit order_log+ CREATE PROCEDURE edit(+ IN order_log ARRAY,+ IN order_log_id INT,+ OUT affected_rows+ )+ BEGIN++ -- allow only table fields and set defaults for missing values+ @FILTER(:order_log, order_log);++ UPDATE order_log++ SET @LIST(:order_log)++ WHERE order_log_id = :order_log_id+++ END++ -- delete order_log++ PROCEDURE delete(+ IN order_log_id ARRAY,+ OUT affected_rows,+ )+ BEGIN+ -- order_log+ DELETE FROM order_log WHERE order_log_id IN (:order_log_id);+ ENDdiff --git a/admin/sql/pgsql/product_question.sql b/admin/sql/pgsql/product_question.sqlindex 7a8cca9..5fde8eb 100755--- a/admin/sql/pgsql/product_question.sql+++ b/admin/sql/pgsql/product_question.sql@@ -69,7 +69,7 @@-- questionSELECT *FROM product_question as _ -- (underscore) _ means that data will be kept in main array- INNER JOIN user on user.user_id = product_question.user_id+ INNER JOIN user on user.user_id = _.user_idWHERE product_question_id = :product_question_id LIMIT 1;ENDdiff --git a/admin/sql/pgsql/product_review.sql b/admin/sql/pgsql/product_review.sqlindex c1d69ad..e482bac 100755--- a/admin/sql/pgsql/product_review.sql+++ b/admin/sql/pgsql/product_review.sql@@ -75,7 +75,7 @@-- reviewSELECT *FROM product_review as _ -- (underscore) _ means that data will be kept in main array- INNER JOIN user on user.user_id = product_review.user_id+ INNER JOIN user on user.user_id = _.user_idWHERE product_review_id = :product_review_id LIMIT 1;ENDdiff --git a/admin/sql/sqlite/order.sql b/admin/sql/sqlite/order.sqlindex 642d536..0dd0d28 100755--- a/admin/sql/sqlite/order.sql+++ b/admin/sql/sqlite/order.sql@@ -140,9 +140,11 @@WHERE products.order_id = :order_id;- -- history- SELECT * FROM order_log as history- WHERE history.order_id = :order_id;+ -- log+ SELECT *,os.name as order_status+ FROM order_log as log+ LEFT JOIN order_status AS os ON (log.order_status_id = os.order_status_id AND os.language_id = :language_id)+ WHERE log.order_id = :order_id;-- metaSELECT * FROM order_meta as metadiff --git a/admin/sql/sqlite/order_log.sql b/admin/sql/sqlite/order_log.sqlnew file mode 100644index 0000000..3c0d0c1--- /dev/null+++ b/admin/sql/sqlite/order_log.sql@@ -0,0 +1,94 @@+-- Order log++ -- get all order log++ PROCEDURE getAll(+ IN order_id INT,+ IN start INT,+ IN limit INT,+ OUT fetch_all,+ OUT fetch_one,+ )+ BEGIN+ -- order_log+ SELECT *+ FROM order_log AS order_log WHERE 1 = 1++ @IF !empty(:order_id)+ THEN+ AND order_id = :order_id+ END @IF++ @SQL_LIMIT(:start, :limit);++ SELECT count(*) FROM (++ @SQL_COUNT(order_log.order_log_id, order_log) -- this takes previous query removes limit and replaces select columns with parameter product_id++ ) as count;++ END++ -- get order log++ PROCEDURE get(+ IN order_log_id INT,+ OUT fetch_row,+ )+ BEGIN+ -- order_log+ SELECT *+ FROM order_log as _ WHERE order_log_id = :order_log_id;+ END++ -- add order_log++ PROCEDURE add(+ IN order_log ARRAY,+ IN order_id INT,+ OUT insert_id+ )+ BEGIN++ -- allow only table fields and set defaults for missing values+ :order_log_data = @FILTER(:order_log, order_log);+++ INSERT INTO order_log++ ( @KEYS(:order_log_data), order_id )++ VALUES ( :order_log_data, :order_id );++ END++ -- edit order_log+ CREATE PROCEDURE edit(+ IN order_log ARRAY,+ IN order_log_id INT,+ OUT affected_rows+ )+ BEGIN++ -- allow only table fields and set defaults for missing values+ @FILTER(:order_log, order_log);++ UPDATE order_log++ SET @LIST(:order_log)++ WHERE order_log_id = :order_log_id+++ END++ -- delete order_log++ PROCEDURE delete(+ IN order_log_id ARRAY,+ OUT affected_rows,+ )+ BEGIN+ -- order_log+ DELETE FROM order_log WHERE order_log_id IN (:order_log_id);+ ENDdiff --git a/admin/sql/sqlite/product_question.sql b/admin/sql/sqlite/product_question.sqlindex a2adec2..2fa2b42 100755--- a/admin/sql/sqlite/product_question.sql+++ b/admin/sql/sqlite/product_question.sql@@ -69,7 +69,7 @@-- questionSELECT *FROM product_question as _ -- (underscore) _ means that data will be kept in main array- INNER JOIN user on user.user_id = product_question.user_id+ INNER JOIN user on user.user_id = _.user_idWHERE product_question_id = :product_question_id LIMIT 1;ENDdiff --git a/admin/sql/sqlite/product_review.sql b/admin/sql/sqlite/product_review.sqlindex 3a9b96b..e823fe9 100755--- a/admin/sql/sqlite/product_review.sql+++ b/admin/sql/sqlite/product_review.sql@@ -75,7 +75,7 @@-- reviewSELECT *FROM product_review as _ -- (underscore) _ means that data will be kept in main array- INNER JOIN user on user.user_id = product_review.user_id+ INNER JOIN user on user.user_id = _.user_idWHERE product_review_id = :product_review_id LIMIT 1;ENDdiff --git a/admin/template/order/order.tpl b/admin/template/order/order.tplindex eef3f8f..0f11a5e 100755--- a/admin/template/order/order.tpl+++ b/admin/template/order/order.tpl@@ -38,21 +38,22 @@ if(is_array($totals)) foreach ($totals as $index => $total) {@total|after = <?php }?>-@history = [data-v-order] [data-v-order-history]+@log = [data-v-order] [data-v-order-log]-@history|deleteAllButFirstChild-@history|before = <?php+@log|deleteAllButFirstChild+@log|before = <?php-$histories = $this->history ?? [];-if(is_array($histories)) foreach ($histories as $index => $history) {+$logs = $this->log ?? [];+if(is_array($logs)) foreach ($logs as $index => $log) {?>//catch all data attributes- @history [data-v-order-history-*]|innerText = $history['@@__data-v-order-history-(*)__@@']- @history a[data-v-order-history-*]|href = $history['@@__data-v-order-history-(*)__@@']- @history input[data-v-order-history-*]|value = $history['@@__data-v-order-history-(*)__@@']+ @log [data-v-order-log-*]|innerText = $log['@@__data-v-order-log-(*)__@@']+ @log a[data-v-order-log-*]|href = $log['@@__data-v-order-log-(*)__@@']+ @log input[data-v-order-log-*]|value = $log['@@__data-v-order-log-(*)__@@']+ @log .badge[data-v-order-log-order_status]|addClass = <?php echo Vvveb\orderStatusBadgeClass($log['order_status_id']);?>-@history|after = <?php }?>+@log|after = <?php }?>[data-v-order] [data-v-order-*]|innerText = $this->order['@@__data-v-order-(*)__@@']diff --git a/admin/template/product/product.tpl b/admin/template/product/product.tplindex 65090a4..e773624 100755--- a/admin/template/product/product.tpl+++ b/admin/template/product/product.tpl@@ -30,8 +30,12 @@ import(product/product/digital_asset.tpl)[data-v-product] [data-v-design_url]|href = $this->product['design_url']-[data-v-template_missing] = <?php echo $this->template_missing;?>-[data-v-product] input[type="checkbox"][data-v-product-*]|addNewAttribute = <?phpif ($value) echo 'checked';-?>\ No newline at end of file+?>++[data-v-template_missing] = <?php echo $this->template_missing;?>+[data-v-type_name_plural] = $this->type_name_plural+[data-v-type-name] = $this->type_name+[data-v-type] = $this->type+[data-v-products-list-url]|href = $this->posts_list_urldiff --git a/admin/template/theme/themes_list.tpl b/admin/template/theme/themes_list.tplindex bfeaa73..fbd61af 100755--- a/admin/template/theme/themes_list.tpl+++ b/admin/template/theme/themes_list.tpl@@ -11,7 +11,7 @@ if(isset($this->themes) && is_array($this->themes)) {[data-v-themes] [data-v-theme] [data-v-theme-activate-url]|href = <?php echo Vvveb\url(['module' => 'theme/themes', 'action' => 'activate', 'theme' => $theme['folder']]);?>[data-v-themes] [data-v-theme] [data-v-theme-delete-url]|href = <?php echo Vvveb\url(['module' => 'theme/themes', 'action' => 'delete', 'theme' => $theme['folder']]);?>- [data-v-themes] [data-v-theme] [data-v-theme-preview-url]|href = <?php echo Vvveb\url('index/index') . '&theme=' . $theme['folder'];?>+ [data-v-themes] [data-v-theme] [data-v-theme-preview-url]|href = <?php echo Vvveb\url('index/index') . '?theme=' . $theme['folder'];?>[data-v-themes] [data-v-theme] [data-v-theme-edit-url]|href = <?php echo Vvveb\url(['module' => 'editor/editor']) . '&url=/&template=index.html&theme=' . $theme['folder'];?>[data-v-themes] [data-v-theme] [data-v-theme-code-url]|href = <?php echo Vvveb\url(['module' => 'editor/code']) . '&type=themes#%2F' . $theme['folder'];?>[data-v-themes] [data-v-theme]|after = <?phpdiff --git a/install/sql/pgsql/schema/order/order_product.sql b/install/sql/pgsql/schema/order/order_product.sqlindex baabf74..4848692 100755--- a/install/sql/pgsql/schema/order/order_product.sql+++ b/install/sql/pgsql/schema/order/order_product.sql@@ -14,7 +14,7 @@ CREATE TABLE order_product ("price" decimal(15,4) NOT NULL DEFAULT 0.0000,"total" decimal(15,4) NOT NULL DEFAULT 0.0000,"tax" decimal(15,4) NOT NULL DEFAULT 0.0000,- "points" int NOT NULL,+ "points" int NOT NULL DEFAULT 0,PRIMARY KEY ("order_product_id"));diff --git a/install/sql/sqlite/schema/order/order_product.sql b/install/sql/sqlite/schema/order/order_product.sqlindex e58b0fe..082758e 100755--- a/install/sql/sqlite/schema/order/order_product.sql+++ b/install/sql/sqlite/schema/order/order_product.sql@@ -10,7 +10,7 @@ CREATE TABLE `order_product` (`price` decimal(15,4) NOT NULL DEFAULT '0.0000',`total` decimal(15,4) NOT NULL DEFAULT '0.0000',`tax` decimal(15,4) NOT NULL DEFAULT '0.0000',-`points` INTEGER NOT NULL+`points` INTEGER NOT NULL DEFAULT 0-- PRIMARY KEY (`order_product_id`));