Skip to content

armgit / Vvveb

Public Imported from GitHub
0

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

Removed type parameter for model get to fetch custom posts/products also

givanz09c2c53632a5
diff --git a/app/controller/content/post.php b/app/controller/content/post.php
index 3ae0ae5..d9bebbd 100755
--- a/app/controller/content/post.php
+++ b/app/controller/content/post.php
@@ -52,7 +52,7 @@ class Post extends Base {
if ($post_id || $slug) {
$contentSql = new PostSQL();
- $options = $this->global + ['post_id' => $post_id, 'slug' => $slug, 'type' => $this->type];
+ $options = $this->global + ['post_id' => $post_id, 'slug' => $slug/*, 'type' => $this->type*/];
$content = $contentSql->getContent($options) ?? [];
$class = __NAMESPACE__ . '\\' . ucfirst($this->type); //__CLASS__ is always Post
diff --git a/app/controller/product/product.php b/app/controller/product/product.php
index cee9de9..660bcf1 100755
--- a/app/controller/product/product.php
+++ b/app/controller/product/product.php
@@ -51,13 +51,13 @@ class Product extends Base {
}
}
- $language = $this->request->get['language'] ?? $this->global['language'] ?? $this->global['default_language'];
- $product_id = $this->request->get['product_id'] ?? '';
- $slug = $this->request->get['slug'] ?? '';
+ $language = $this->request->get['language'] ?? $this->global['language'] ?? $this->global['default_language'];
+ $product_id = $this->request->get['product_id'] ?? '';
+ $slug = $this->request->get['slug'] ?? '';
if ($slug) {
$contentSql = new ProductSQL();
- $options = $this->global + ['product_id' => $product_id, 'slug' => $slug, 'type' => $this->type, 'status' => 1];
+ $options = $this->global + ['product_id' => $product_id, 'slug' => $slug, /*'type' => $this->type, */'status' => 1];
$content = $contentSql->getContent($options);
list($content, $language, $slug) = Event :: trigger(__CLASS__,__FUNCTION__, $content, $language, $slug);
@@ -86,10 +86,10 @@ class Product extends Base {
//$this->session->set('language', $languageContent['code']);
//$this->session->set('language_id', $languageContent['language_id']);
- $this->request->get['product_id'] = $languageContent['product_id'];
- $this->request->request['product_id'] = $languageContent['product_id'];
- $this->request->get['name'] = $languageContent['name'];
- $this->request->request['name'] = $languageContent['name'];
+ $this->request->get['product_id'] = $languageContent['product_id'];
+ $this->request->request['product_id'] = $languageContent['product_id'];
+ $this->request->get['name'] = $languageContent['name'];
+ $this->request->request['name'] = $languageContent['name'];
$this->request->request['code'] = $languageContent['code'];
$this->request->request['language_id'] = $languageContent['language_id'];