Мы несколько о разном говорим...
Ну да ладно, вот вам решение:
Открываем
catalog/controller/module/latest.php
1. После
$this->data['products'] = array();вставляем
/* webme - latest ALL - mod - part_#1 - start */
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
$w_startFrom = ($page - 1) * $this->config->get('latest_limit'); /* start from */
$w_limit = $this->config->get('latest_limit'); /* products per page */
$latest_total = $this->model_catalog_product->w_getTotalLatestProducts();
/* webme - latest ALL - mod - part_#1 - end */
2. Меняем
$results = $this->model_catalog_product->getLatestProducts($this->config->get('latest_limit'));на
//$results = $this->model_catalog_product->getLatestProducts($this->config->get('latest_limit'));
$results = $this->model_catalog_product->w_getLatestProducts($w_startFrom, $w_limit);
3. Перед
if ($this->config->get('latest_position') == 'home') {
$this->data['heading_title'] .= (' ' . $this->language->get('text_products'));вставляем
/* webme - latest ALL - mod - part_#3 - start */
$pagination = new Pagination();
$pagination->total = $latest_total;
$pagination->page = $page;
$pagination->limit = $this->config->get('latest_limit');
$pagination->text = $this->language->get('text_pagination');
$pagination->url = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?page={page}');
$this->data['pagination'] = $pagination->render();
/* webme - latest ALL - mod - part_#3 - end */
Открываем
catalog/view/theme/default/template/module/latest_home.tpl
4. Вставляем
<div class="pagination"><?php echo $pagination; ?></div>у меня так
</tr>
<?php } ?>
</table>
<div class="pagination"><?php echo $pagination; ?></div>
</div>
<div class="bottom">
<div class="left"></div>
<div class="right"></div>
<div class="center"></div>
</div>
<?php } ?>
Открываем
catalog/model/catalog/product.php
5. После
public function getLatestProducts($limit) {
$product_data = $this->cache->get('product.latest.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $limit);
if (!$product_data) {
$query = $this->db->query("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) 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') . "' ORDER BY p.date_added DESC LIMIT " . (int)$limit);
$product_data = $query->rows;
$this->cache->set('product.latest.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $limit, $product_data);
}
return $product_data;
}вставляем
/* webme - latest ALL - mod - part_#1 - start */
public function w_getTotalLatestProducts() {
$wTotalLatest = $this->cache->get('product.wTotalLatest.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'));
if (!$wTotalLatest) {
$query = $this->db->query("SELECT COUNT(*) AS wTotalLatest 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) 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') . "' ORDER BY p.date_added DESC");
$wTotalLatest = $query->row["wTotalLatest"];
$this->cache->set('product.wTotalLatest.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'), $wTotalLatest);
}
return $wTotalLatest;
}
public function w_getLatestProducts($start=0, $limit=8) {
$product_data = $this->cache->get('product.wLatest.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.'.$start.'.'.$limit);
if (!$product_data) {
$query = $this->db->query("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) 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') . "' ORDER BY p.date_added DESC LIMIT " . (int)$start .", ". (int)$limit);
$product_data = $query->rows;
$this->cache->set('product.wLatest.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.'.$start.'.'.$limit, $product_data);
}
return $product_data;
}
/* webme - latest ALL - mod - part_#1 - end */
Все равно считаю это дикостью... https://opencartforum.com/public/style_emoticons/default/dry.gif