Skip to content

armgit / Vvveb

Public Imported from GitHub
0

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

Model entity name renamed to singular for templates

givanz67524f76aa5c
diff --git a/admin/template/components/notifications.tpl b/admin/template/components/notifications.tpl
index 8fabf11..8ce97a8 100644
--- a/admin/template/components/notifications.tpl
+++ b/admin/template/components/notifications.tpl
@@ -34,7 +34,7 @@ $count = $notificationComponent['count'] ?? 0;
?>
- @notifications [data-v-group-notification-count]|addClass = $notification['badge']
+ @notifications [data-v-group-notification-count]|addClass = <?php if (isset($notification['badge'])) echo $notification['badge'];?>
@notifications [data-v-group-icon]|class = $notification['icon']
diff --git a/admin/template/components/posts.tpl b/admin/template/components/posts.tpl
index f30aaec..be4a222 100755
--- a/admin/template/components/posts.tpl
+++ b/admin/template/components/posts.tpl
@@ -15,10 +15,10 @@ $_pagination_limit = isset($this->_component['posts'][$_posts_idx]['limit'])? $t
//$post = [data-v-component-posts] [data-v-post]
[data-v-component-posts] [data-v-post]|before = <?php
-if(isset($this->_component['posts']) && is_array($this->_component['posts'][$_posts_idx]['posts']))
+if(isset($this->_component['posts']) && is_array($this->_component['posts'][$_posts_idx]['post']))
{
//$pagination = $this->posts[$_posts_idx]['pagination'];
- foreach ($this->_component['posts'][$_posts_idx]['posts'] as $index => $post)
+ foreach ($this->_component['posts'][$_posts_idx]['post'] as $index => $post)
{
?>
diff --git a/admin/template/components/products.tpl b/admin/template/components/products.tpl
index 71a8139..c9d470b 100755
--- a/admin/template/components/products.tpl
+++ b/admin/template/components/products.tpl
@@ -20,9 +20,9 @@ $_pagination_limit = $products['limit'] ?? 5;
[data-v-component-products] [data-v-product]|before = <?php
-if(is_array($products['products'])) {
+if(is_array($products['product'])) {
$index = 0;
- foreach ($products['products'] as $index => $product) { ?>
+ foreach ($products['product'] as $index => $product) { ?>
@product [data-v-product-image]|src = $product['image']
@product [data-v-product-image-url] = $product['image']
diff --git a/app/template/components/categories/pages.tpl b/app/template/components/categories/pages.tpl
index 480c140..3826c7c 100755
--- a/app/template/components/categories/pages.tpl
+++ b/app/template/components/categories/pages.tpl
@@ -40,7 +40,7 @@ $generate_menu = function ($parent) use (&$_categories, &$generate_menu) {
@post|before = <?php
- if (isset($category['posts']) && $category['posts'])
+ if (isset($category['posts']) && $category['post'])
foreach($category['posts'] as $key => $post) {?>
//catch all data attributes
@post [data-v-post-*]|innerText = $post['@@__data-v-post-(*)__@@']
diff --git a/app/template/components/checkout/payment.tpl b/app/template/components/checkout/payment.tpl
index 284f950..84ccbc1 100755
--- a/app/template/components/checkout/payment.tpl
+++ b/app/template/components/checkout/payment.tpl
@@ -27,7 +27,7 @@ if($payments && is_array($payments['payment'])) {
@payment input[data-v-payment-key][type=radio]|addNewAttribute = <?php if ($payment_method == $key) echo 'checked';?>
- @payment .collapse|addClass = <?php if ($payment_method == $key) echo 'show';?>
+ @payment .collapse|addClass = <?php if (($payment_method == $key) && !$vvveb_is_page_edit) echo 'show';?>
@payment img[data-v-payment-*]|src = $payment['@@__data-v-payment-(*)__@@']
diff --git a/app/template/components/checkout/shipping.tpl b/app/template/components/checkout/shipping.tpl
index eb27947..00cef64 100755
--- a/app/template/components/checkout/shipping.tpl
+++ b/app/template/components/checkout/shipping.tpl
@@ -27,7 +27,7 @@ if($shippings && is_array($shippings['shipping'])) {
@shipping input[data-v-shipping-key]|addNewAttribute = <?php if ($shipping_method == $key) echo 'checked';?>
- @shipping .collapse|addClass = <?php if ($shipping_method == $key) echo 'show';?>
+ @shipping .collapse|addClass = <?php if (($shipping_method == $key) && !$vvveb_is_page_edit) echo 'show';?>
@shipping img[data-v-shipping-*]|src = $shipping['@@__data-v-shipping-(*)__@@']
diff --git a/app/template/components/comments.tpl b/app/template/components/comments.tpl
index d9764dc..5cee6e1 100755
--- a/app/template/components/comments.tpl
+++ b/app/template/components/comments.tpl
@@ -24,9 +24,9 @@ if($_comments && is_array($_comments)) {
@comment|data-comment_id = $comment['comment_id']
- @comment|addClass = <?php echo 'level-' . ($comment['level'] ?? 0);?>
+ @comment|addClass = <?php if (!$vvveb_is_page_edit) echo 'level-' . ($comment['level'] ?? 0);?>
- @comment|id = <?php echo 'comment-' . $comment['comment_id'];?>
+ @comment|id = <?php if (!$vvveb_is_page_edit) echo 'comment-' . $comment['comment_id'];?>
@comment [data-v-comment-content] = <?php echo($comment['content']);?>
diff --git a/app/template/components/currency.tpl b/app/template/components/currency.tpl
index 1af18df..641ed9b 100755
--- a/app/template/components/currency.tpl
+++ b/app/template/components/currency.tpl
@@ -27,7 +27,7 @@ if($currencies) {
@currency [data-v-currency-*]|innerText = $currency['@@__data-v-currency-(*)__@@']
@currency button[data-v-currency-code]|value = $currency['code']
- @currency .dropdown-item|addClass = <?php if ($currency['code'] == $current_component['current']) echo 'active'?>
+ @currency .dropdown-item|addClass = <?php if (($currency['code'] == $current_component['current']) && !$vvveb_is_page_edit) echo 'active'?>
@currency [data-v-currency-url] = <?php
echo Vvveb\url(['module' => 'currency/currency', 'currency_id' => $currency['currency_id']]);
diff --git a/app/template/components/language.tpl b/app/template/components/language.tpl
index c044d84..62235fb 100755
--- a/app/template/components/language.tpl
+++ b/app/template/components/language.tpl
@@ -21,7 +21,10 @@ $language['language'] = empty($language['language']) ? $_default : $language['la
@language .dropdown-item|addClass = <?php
if (isset($lang['code']) && isset($language['active']['code']) &&
- ($lang['code'] == $language['active']['code'])) echo 'active';
+ ($lang['code'] == $language['active']['code']) &&
+ !$vvveb_is_page_edit) {
+ echo 'active';
+ }
?>
@language [data-v-language-name] = $lang['name']
diff --git a/app/template/components/menu.tpl b/app/template/components/menu.tpl
index df5f96d..077ad0b 100755
--- a/app/template/components/menu.tpl
+++ b/app/template/components/menu.tpl
@@ -16,7 +16,7 @@ $_categories = [];
if (isset($this->_component['menu']) && isset($this->_component['menu'][$_menu_idx])) {
//$_pagination_count = $this->menu[$_menu_idx]['count'];
//$_pagination_limit = $this->categories[$_menu_idx]['limit'];
- $_categories = $this->_component['menu'][$_menu_idx]['menus'] ?? [];
+ $_categories = $this->_component['menu'][$_menu_idx]['menu'] ?? [];
if (isset($vvveb_is_page_edit) && $vvveb_is_page_edit) {
$_categories = [
['menu_item_id' => 1, 'parent_id' => 0, 'children' => 1, 'class' => 'vvveb-hidden'],
@@ -37,7 +37,7 @@ if (isset($this->_component['menu']) && isset($this->_component['menu'][$_menu_i
@category|before = <?php
foreach($_categories as $id => $category) {
- if ($category['parent_id'] == $parent_id) {
+ if (isset($category['parent_id']) && ($category['parent_id'] == $parent_id)) {
?>
//catch all data attributes
@@ -60,10 +60,11 @@ if (isset($this->_component['menu']) && isset($this->_component['menu'][$_menu_i
?>
-@category|addClass = <?php if (isset($category['class'])) echo $category['class'];?>
+@category|addClass = <?php if (isset($category['class']) && !$vvveb_is_page_edit) echo $category['class'];?>
@category-recursive|before = <?php
$generate_menu = function ($parent_id) use (&$_categories, &$generate_menu, &$parents) {
+ global $vvveb_is_page_edit;
?>
@category-recursive|after = <?php
diff --git a/app/template/components/posts.tpl b/app/template/components/posts.tpl
index a21ef6d..3d3ebd9 100755
--- a/app/template/components/posts.tpl
+++ b/app/template/components/posts.tpl
@@ -30,7 +30,7 @@
//if no posts available and page is loaded in editor then set an empty post to show post content for the editor
$_default = (isset($vvveb_is_page_edit) && $vvveb_is_page_edit ) ? [0 => []] : [];
$_default = [0 => []];
-$_posts = empty($posts['posts']) ? $_default : $posts['posts'];
+$_posts = empty($posts['post']) ? $_default : $posts['post'];
//$pagination = $this->posts[$_posts_idx]['pagination'];
$count = 0;
foreach ($_posts as $index => $post) {?>
diff --git a/app/template/components/product.tpl b/app/template/components/product.tpl
index 783d7ae..f200a72 100755
--- a/app/template/components/product.tpl
+++ b/app/template/components/product.tpl
@@ -50,7 +50,7 @@ if($_images) {
$i = 1;
foreach ($_images as $index => $_image) { ?>
- @images [data-bs-slide-to]|data-bs-slide-to = <?php echo $i;?>
+ @images [data-bs-slide-to]|data-bs-slide-to = <?php echo $i ?? 1;?>
@images img[data-v-product-image-src]|src = $_image['image']
@images [data-v-product-image-src] = $_image['image']
[data-v-product-image-src]@images = $_image['image']
@@ -68,4 +68,4 @@ $component = $previous_component;
?>
-
\ No newline at end of file
+
diff --git a/app/template/components/products.tpl b/app/template/components/products.tpl
index 0cce1da..1056ba2 100755
--- a/app/template/components/products.tpl
+++ b/app/template/components/products.tpl
@@ -23,7 +23,7 @@
//to render an empty product to avoid losing the html on edit
$_default = (isset($vvveb_is_page_edit) && $vvveb_is_page_edit ) ? [0 => []] : false;
//$_default = [0 => []];
- $_products = empty($products['products']) ? $_default : $products['products'];
+ $_products = empty($products['product']) ? $_default : $products['product'];
?>
@products [data-v-products-category] = <?php $_category = current($products);echo $_category['category'];?>
diff --git a/app/template/components/questions.tpl b/app/template/components/questions.tpl
index 4f1bdf8..8d16085 100644
--- a/app/template/components/questions.tpl
+++ b/app/template/components/questions.tpl
@@ -24,9 +24,9 @@ if($questions && is_array($questions)) {
@question|data-question_id = $question['question_id']
- @question|addClass = <?php echo 'level-' . ($question['level'] ?? 0);?>
+ @question|addClass = <?php if (!$vvveb_is_page_edit) echo 'level-' . ($question['level'] ?? 0);?>
- @question|id = <?php echo 'question-' . $question['product_question_id'];?>
+ @question|id = <?php if (!$vvveb_is_page_edit) echo 'question-' . $question['product_question_id'];?>
@question [data-v-question-content] = <?php echo($question['content']);?>
diff --git a/app/template/components/reviews.tpl b/app/template/components/reviews.tpl
index 5c44e3f..561d79a 100755
--- a/app/template/components/reviews.tpl
+++ b/app/template/components/reviews.tpl
@@ -27,9 +27,9 @@ if($reviews && is_array($reviews)) {
@review|data-review_id = $review['review_id']
- @review|addClass = <?php echo 'level-' . ($review['level'] ?? 0);?>
+ @review|addClass = <?php if (!$vvveb_is_page_edit) echo 'level-' . ($review['level'] ?? 0);?>
- @review|id = <?php echo 'review-' . $review['product_review_id'];?>
+ @review|id = <?php if (!$vvveb_is_page_edit) echo 'review-' . $review['product_review_id'];?>
@review [data-v-review-content] = <?php echo $review['content'];?>
@review img[data-v-review-avatar]|width = <?php echo $review['size'] ?? '60';?>