Skip to content

armgit / Vvveb

Public Imported from GitHub
0

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

Fixed post component content update

givanz55489d8988cd
diff --git a/app/component/post.php b/app/component/post.php
index 84c50c3..10844e8 100755
--- a/app/component/post.php
+++ b/app/component/post.php
@@ -45,6 +45,8 @@ class Post extends ComponentBase {
//'type' => 'post',
];
+ public $cacheExpire = 0; //no cache
+
//called when fetching data, when cache expires
function results() {
$post = new PostSQL();
@@ -61,7 +63,7 @@ class Post extends ComponentBase {
}
if (isset($results['avatar'])) {
- $results['avatar'] = Images::image($results['avatar'], 'admin');
+ $results['avatar_url'] = Images::image($results['avatar'], 'admin');
}
//comments translations
@@ -144,7 +146,7 @@ class Post extends ComponentBase {
if ($post || $post_content) {
$post['post_id'] = $id;
- $result = $posts->edit(['post' => $post, /* 'post_content' => [$post_content],*/ 'post_id' => $id]);
+ $result = $posts->edit(['post' => $post, 'post_content' => [], /* 'post_content' => [$post_content],*/ 'post_id' => $id]);
}
}
}
diff --git a/app/component/product.php b/app/component/product.php
index 0703761..923b40e 100755
--- a/app/component/product.php
+++ b/app/component/product.php
@@ -55,9 +55,11 @@ class Product extends ComponentBase {
'rating' => null, //[true, false] include rating average
'reviews' => null, //[true, false] include reviews count
- 'image_size' => '',
+ 'image_size' => 'large',
];
+ public $cacheExpire = 0; //no cache
+
function results() {
$product = new ProductSQL();
$results = $product->get($this->options);
@@ -80,14 +82,18 @@ class Product extends ComponentBase {
$results['manufacturer_url'] = url('product/manufacturer/index', ['slug' => $results['manufacturer_slug']]);
$results['vendor_url'] = url('product/vendor/index', ['slug' => $results['vendor_slug']]);
- $variantSql = new Product_VariantSQL();
- $voptions = ['product_id' => $this->options['product_id'], 'start' => 0, 'limit' => 1];
+ $variants = [];
- if ($this->options['product_variant_id']) {
- $voptions['product_variant_id'] = [$this->options['product_variant_id']];
- }
+ if (isset($this->options['product_id'])) {
+ $variantSql = new Product_VariantSQL();
+ $voptions = ['product_id' => $this->options['product_id'], 'start' => 0, 'limit' => 1];
- $variants = $variantSql->getAll($voptions);
+ if (isset($this->options['product_variant_id'])) {
+ $voptions['product_variant_id'] = [$this->options['product_variant_id']];
+ }
+
+ $variants = $variantSql->getAll($voptions);
+ }
$defaultVariant = [];
$defaultVariantId = null;
@@ -205,7 +211,7 @@ class Product extends ComponentBase {
if ($product) {
$product['product_id'] = $id;
- $result = $products->edit(['product' => $product, /*'product_content' => [$product_content],*/ 'product_id' => $id]);
+ $result = $products->edit(['product' => $product, 'product_content' => [], /*'product_content' => [$product_content],*/ 'product_id' => $id]);
}
}
}