Новая стилизация статей блога и категорий блога

This commit is contained in:
Konstantin
2026-05-30 10:28:22 +03:00
parent 95ac0ef898
commit 373c575181
5 changed files with 1012 additions and 485 deletions
+36 -6
View File
@@ -180,21 +180,30 @@ class ControllerBlogArticle extends Controller {
$data['rating'] = (int)$article_info['rating'];
$data['gstatus'] = (int)$article_info['gstatus'];
$data['description'] = html_entity_decode($article_info['description'], ENT_QUOTES, 'UTF-8');
$this->load->model('tool/image');
if ($article_info['image']) {
$data['thumb'] = $this->model_tool_image->resize($article_info['image'], 1200, 760);
} else {
$data['thumb'] = false;
}
$data['date_added'] = date($this->language->get('date_format_short'), strtotime($article_info['date_added']));
$data['viewed'] = (int)$article_info['viewed'];
$data['articles'] = array();
$data['button_more'] = $this->language->get('button_more');
$data['text_views'] = $this->language->get('text_views');
$this->load->model('tool/image');
$results = $this->model_blog_article->getArticleRelated($this->request->get['article_id']);
foreach ($results as $result) {
if ($result['image']) {
$image = $this->model_tool_image->resize($result['image'], $this->config->get('configblog_image_related_width'), $this->config->get('configblog_image_related_height'));
} else {
$image = false;
$image = $this->model_tool_image->resize('placeholder.png', $this->config->get('configblog_image_related_width'), $this->config->get('configblog_image_related_height'));
}
if ($this->config->get('configblog_review_status')) {
@@ -216,17 +225,25 @@ class ControllerBlogArticle extends Controller {
);
}
$this->load->model('tool/image');
$data['products'] = array();
$results = $this->model_blog_article->getArticleRelatedProduct($this->request->get['article_id']);
foreach ($results as $result) {
if ($result['image']) {
$image = $this->model_tool_image->resize($result['image'], $this->config->get('configblog_image_related_width'), $this->config->get('configblog_image_related_height'));
$image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height'));
} else {
$image = false;
$image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height'));
}
$product_images = $this->model_catalog_product->getProductImages($result['product_id']);
if ($product_images) {
$additional_image = $this->model_tool_image->resize($product_images[0]['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height'));
} else {
$additional_image = false;
}
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
} else {
@@ -244,6 +261,12 @@ class ControllerBlogArticle extends Controller {
} else {
$tax = false;
}
$rent_prices = array_filter([$result['price'], $result['price_2']], function($price) {
return (float)$price > 0;
});
$min_price = $rent_prices ? min($rent_prices) : 0;
if ($this->config->get('configblog_review_status')) {
$rating = (int)$result['rating'];
@@ -256,6 +279,13 @@ class ControllerBlogArticle extends Controller {
$data['products'][] = array(
'product_id' => $result['product_id'],
'thumb' => $image,
'additional_thumb' => $additional_image,
'price_n' => $result['price'],
'price_2' => $this->currency->format($this->tax->calculate($result['price_2'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']),
'price_2_n' => $result['price_2'],
'price_3' => $this->currency->format($this->tax->calculate($result['price_3'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']),
'price_3_n' => $result['price_3'],
'min_price' => $this->currency->format($this->tax->calculate($min_price, $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']),
'name' => $result['name'],
'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('configblog_article_description_length')) . '..',
'price' => $price,