Доброго времени суток, попробовал модуль WebMe Категории на главной , вроде ничего, но в нем нету таких вещей как вывод описания и веса товара, которые ОЧЕНЬ нужны. возможно кто-то подскажет похожий модуль которые это умеет? или возможно кто-то подскажит как сделать вывод в этом? дополнительные поля необязательны т.к. вроде все есть в обычной сборке и выводится на детальной странице продукта сборка оригинальная OperCart 1.5.6 от 25го июля 13го года. контролер в каталоге:
<?php
class ControllerModuleWebmeCategoriesAtHomepage extends Controller {
protected function index($setting) {
$this->id = 'webme_categories_at_homepage';
$this->data['button_cart'] = $this->language->get('button_cart');
/* ===================================== */
$this->load->model('catalog/category');
$category_ids = explode("_", $this->config->get('webme_categories_at_homepage_category'));
foreach ($category_ids as $cat_id) {
$category_id = $cat_id;
$category_info = $this->model_catalog_category->getCategory($category_id);
if ($category_info) {
$this->data['w_categories'][$category_id]['heading_title'] = $category_info['name'];
$this->data['w_categories'][$category_id]['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
$this->data['w_categories'][$category_id]['href'] = $this->url->link('product/category', 'path='.$category_id);
$this->load->model('tool/image');
if ($category_info['image']) {
$image = $category_info['image'];
} else {
$image = '';
}
$this->data['w_categories'][$category_id]['thumb'] = $this->model_tool_image->resize($image, $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
$this->load->model('catalog/webme_categories_at_homepage');
$this->load->model('catalog/product');
$this->load->model('catalog/review');
$product_total = $this->model_catalog_webme_categories_at_homepage->getTotalProductsByCategoryId($category_id);
if ($product_total) {
$this->data['w_categories'][$category_id]['button_add_to_cart'] = $this->language->get('button_add_to_cart');
$this->data['w_categories'][$category_id]['products'] = array();
$w_sort_order = explode("-", $this->config->get('webme_categories_at_homepage_sort_by'));
$sort = $w_sort_order["0"];
$order = $w_sort_order["1"];
$wProdLimit = $this->config->get('webme_categories_at_homepage_limit');
$data = array(
'filter_category_id' => $category_id,
'sort' => $sort,
'order' => $order,
'start' => 0,
'limit' => 4
);
if ($wProdLimit > 0) {
if ($this->config->get('webme_categories_at_homepage_limit') > 0) {
$data['limit'] = $this->config->get('webme_categories_at_homepage_limit');
}
$results = $this->model_catalog_product->getProducts($data);
} else {
$results = $this->model_catalog_product->getProducts($data);
}
foreach ($results as $result) {
if ($result['image']) {
$image = $result['image'];
} else {
$image = 'no_image.jpg';
}
if (($this->config->get('config_customer_price') && $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')));
} else {
$price = false;
}
if ((float)$result['special']) {
$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$special = false;
}
if ($this->config->get('config_review_status')) {
$rating = $result['rating'];
} else {
$rating = false;
}
$options = $this->model_catalog_product->getProductOptions($result['product_id']);
if ($options) {
$add = $this->url->link('product/product', 'path='.$category_id.'&product_id='.$result['product_id']);
} else {
$add = $this->url->link('checkout/cart', 'product_id='.$result['product_id']);
}
$this->data['w_categories'][$category_id]['products'][] = array(
'product_id' => $result['product_id'],
'name' => $result['name'],
'model' => $result['model'],
'rating' => $rating,
'stars' => sprintf($this->language->get('text_stars'), $rating),
'thumb' => $this->model_tool_image->resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
'price' => $price,
'options' => $options,
'special' => $special,
'href' => $this->url->link('product/product', 'path='.$category_id.'&product_id='.$result['product_id']),
'add' => $add
);
}
if (!$this->config->get('config_customer_price')) {
$this->data['w_categories'][$category_id]['display_price'] = TRUE;
} elseif ($this->customer->isLogged()) {
$this->data['w_categories'][$category_id]['display_price'] = TRUE;
} else {
$this->data['w_categories'][$category_id]['display_price'] = FALSE;
}
}
}
/* ===================================== */
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/webme_categories_at_homepage.tpl')) {
$this->template = $this->config->get('config_template') . '/template/module/webme_categories_at_homepage.tpl';
} else {
$this->template = 'default/template/module/webme_categories_at_homepage.tpl';
}
$this->render();
}
}
}
?>
модель:
<?php
class ModelCatalogWebmeCategoriesAtHomepage extends Model {
public function getTotalProductsByCategoryId($category_id = 0) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product p ON (p2c.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2c.category_id = '" . (int)$category_id . "'");
return $query->row['total'];
}
public function getProductsByCategoryId($category_id, $sort = 'p.sort_order', $order = 'ASC', $start = 0, $limit = 4) {
$sql = "SELECT *, pd.name AS name, p.image, m.name AS manufacturer, ss.name AS stock, (SELECT AVG(r.rating) FROM " . DB_PREFIX . "review r WHERE p.product_id = r.product_id GROUP BY r.product_id) AS rating FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "stock_status ss ON (p.stock_status_id = ss.stock_status_id) LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p2c.category_id = '" . (int)$category_id . "'";
$sort_data = array(
'pd.name',
'p.sort_order',
'special',
'rating',
'p.price',
'p.model',
'p.date_added'
);
$show_random_products = $this->config->get('webme_categories_at_homepage_random');
if ($show_random_products == 1) {
$sql .= " ORDER BY RAND()";
} else {
if (in_array($sort, $sort_data)) {
if ($sort == 'pd.name' || $sort == 'p.model') {
$sql .= " ORDER BY LCASE(" . $sort . ")";
} else {
$sql .= " ORDER BY " . $sort;
}
} else {
$sql .= " ORDER BY p.sort_order";
}
if ($order == 'DESC') {
$sql .= " DESC";
} else {
$sql .= " ASC";
}
}
if ($start < 0) {
$start = 0;
}
$sql .= " LIMIT " . (int)$start . "," . (int)$limit;
$query = $this->db->query($sql);
return $query->rows;
}
}
?>
tpl:
<?php
if (isset($w_categories)) {
foreach ($w_categories as $w_category) {
?>
<?php if (isset($w_category["products"])) { ?>
<div class="box">
<div class="box-heading"><a href="<?php echo $w_category["href"]; ?>"><?php echo $w_category["heading_title"]; ?></a></div>
<div class="box-content">
<div class="box-product">
<?php foreach ($w_category["products"] as $product) { ?>
<div>
<?php if ($product['thumb']) { ?>
<div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
<?php } ?>
<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
<?php if ($product['price']) { ?>
<div class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
<?php } ?>
</div>
<?php } ?>
<?php if ($product['rating']) { ?>
<div class="rating"><img src="catalog/view/theme/default/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div>
<?php } ?>
<div class="cart"><input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" /></div>
</div>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
<?php
} // foreach ($w_categories as $w_category) {
} // if (isset($w_categories)) {
?>
буду ОЧЕНЬ благодарен за помощь и по возможности отблагодарю чем смогу