Jump to content
Sign in to follow this  
sigur

Лимиты latest на главной странице сайта.

Recommended Posts

На главной выводится последний товар, нужно изменить лимит вывода товара.

Изменение лимитов в файле model/catalog/product.php  не дало результатов.

для Leaders лимиты  меняются а для Latest нет.

 

Я сделал правки в файлах home.tpl и home.php

 

было

 

/*home.tpl*/
<? if ($latest): ?>
...         
<?php echo $latest['name']; ?>
<?php echo $latest['code']; ?>
...
<? endif; ?> 
 
/*home.php*/
$result = $this->model_catalog_product->getLatestProduct();
if ($results) {
$category = $this->model_catalog_product->getCategories($result['product_id']);
if ($category) {
$result['category_name'] = $category[0]['name'];
$result['category_href'] = $this->url->link('product/category', 'path=' . $category[0]['category_id']);
} else {
$result['category_name'] = null;
$result['category_href'] = null;
}
$result['price'] = $price;
$result['price_old'] = $price_old;
$result['image'] = $this->model_tool_image->resize($image, 177, 177);
$result['href'] = $this->url->link('product/product', 'product_id=' . $result['product_id']);
$data['latest'] = $result;
} else {
$data['latest'] = null;
}
 
в этих файлах сделал изменения:
 
/*home.tpl*/
<? if ($latest): ?>         
<? foreach ($latest as $lt): ?>
...         
<?php echo $lt['name']; ?>
<?php echo $lt['code']; ?>
...
<? endforeach; ?>
<? endif; ?>
 
/*home.php*/
$result = $this->model_catalog_product->getLatestProduct();
if ($results) {
foreach ($results as $result) { 
$category = $this->model_catalog_product->getCategories($result['product_id']);
if ($category) {
$result['category_name'] = $category[0]['name'];
$result['category_href'] = $this->url->link('product/category', 'path=' . $category[0]['category_id']);
} else {
$result['category_name'] = null;
$result['category_href'] = null;
}
$result['price'] = $price;
$result['price_old'] = $price_old;
$result['image'] = $this->model_tool_image->resize($image, 177, 177);
$result['href'] = $this->url->link('product/product', 'product_id=' . $result['product_id']);
$data['latest'][] = $result;
}
} else {
$data['latest'] = null;
}
 
в результаты вместо Latest  выводятся акции, подскажите где копать и в каких файлах искать решение данной проблемы. И как изменить лимиты  latest на главной..
Edited by sigur

Share this post


Link to post
Share on other sites

А разве это не просто в настройках модуля в админке указывается?

Share this post


Link to post
Share on other sites

Проблема в том, что модули в админке отключены. :-)

Share this post


Link to post
Share on other sites

Вопрос не решен, возможно кто-то подскажет в каких файлах искать решения данного вопроса.

Share this post


Link to post
Share on other sites

Попробуйте вместо 

$result = $this->model_catalog_product->getLatestProduct();
 
написать
$result = $this->model_catalog_product->getLatestProduct(1);
где 1 - кол-во товаров

Share this post


Link to post
Share on other sites

 

Попробуйте вместо 

$result = $this->model_catalog_product->getLatestProduct();
 
написать
$result = $this->model_catalog_product->getLatestProduct(1);
где 1 - кол-во товаров

 

 

Изменил index.php, обновил модификаторы - не помогло.

возможно здесь проблема - product.php :

 
public function getLatestProduct($category_id = null) {
$and = null;
 
    if ($category_id) {
    $and = ' AND p2c.category_id = '.intval($category_id);
    }
 
$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, p.stock_status_id, m.name AS manufacturer, ss.name AS stock
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 (p2c.product_id = p.product_id)
WHERE 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 p.date_available <= NOW()
AND p.stock_status_id = '7'
AND p.status = '1' " . $and . "
GROUP BY p.product_id
ORDER BY p.date_added DESC
LIMIT 12
");
 
return $query->row;
}
 
 
 
public function getLatestProducts($limit) {
$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $this->config->get('config_customer_group_id') . '.' . (int)$limit);
 
if (!$product_data) {
$query = $this->db->query("SELECT p.product_id FROM " . DB_PREFIX . "product p 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') . "' ORDER BY p.date_added DESC LIMIT " . (int)$limit);
 
foreach ($query->rows as $result) {$product_data[$result['product_id']] = $this->getProduct($result['product_id']);}
 
$this->cache->set('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $this->config->get('config_customer_group_id') . '.' . (int)$limit, $product_data);
}
 
return $product_data;
}
Edited by sigur

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.