Статьи в меню

vQmod позволяет выводить статьи не только в позицию "Bottom" - футер страниц , а так-же в горизонтальное меню.

 

подходит для версий - v1.5.3, v1.5.4, v1.5.4.1, v1.5.5, v1.5.5.1, v1.5.6, v1.5.6.1

вывод статей в шапку сайта, ручная правка файлов если vQmod вам не знаком.

catalog/controller/common/header.php

перед
$this->children = array(

добавить
$this->load->model('catalog/information');
foreach ($this->model_catalog_information->getInformations(true) as $result) {
if ($result['top']) {
$this->data['pages'][] = array(
'title' => $result['title'],
'href'  => $this->url->link('information/information', 'information_id=' . $result['information_id'])
);
}
}
if(!isset($this->data['pages'])){
$this->data['pages'] = '';
}


catalog/model/catalog/information.php

заменить
public function getInformations() {

на
public function getInformations($filter = false) {
if($filter == false){
$fields = mysql_list_fields(DB_DATABASE, DB_PREFIX.'information');
$columns = mysql_num_fields($fields);
for ($i = 0; $i < $columns; $i++) {
$field[] = mysql_field_name($fields, $i);
}
if (!in_array('top', $field))
{
$this->db->query("ALTER TABLE ".DB_PREFIX."information ADD COLUMN top INT(1) NOT NULL DEFAULT 0  AFTER `information_id`");
}
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "information i LEFT JOIN " . DB_PREFIX . "information_description id ON (i.information_id = id.information_id) LEFT JOIN " . DB_PREFIX . "information_to_store i2s ON (i.information_id = i2s.information_id) WHERE id.language_id = '" . (int)$this->config->get('config_language_id') . "' AND i2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND i.status = '1' ORDER BY i.sort_order, LCASE(id.title) ASC");
}else{
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "information i LEFT JOIN " . DB_PREFIX . "information_description id ON (i.information_id = id.information_id) LEFT JOIN " . DB_PREFIX . "information_to_store i2s ON (i.information_id = i2s.information_id) WHERE id.language_id = '" . (int)$this->config->get('config_language_id') . "' AND i2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND i.status = '1' AND i.top = '1' ORDER BY i.sort_order, LCASE(id.title) ASC");
}


catalog/view/theme/default/template/common/header.tpl

заменить
<?php if ($categories) { ?>

на
<?php if ($categories || $pages) { ?>


перед
<?php foreach ($categories as $category) { ?>

добавить
<?php if ($categories) { ?>

перед вторым с начала
</ul>

добавить
<?php } ?>
<?php if($pages){ ?>
<?php foreach($pages as $page){ ?>
<li><a href="<?php echo $page['href']; ?>"><?php echo $page['title']; ?></a></li>
<?php } ?>
<?php } ?>


админская часть

admin/controller/catalog/information.php

перед
$this->data['entry_bottom'] = $this->language->get('entry_bottom');

добавить
$this->data['entry_top'] = $this->language->get('entry_top');

перед
if (isset($this->request->post['bottom'])) {

добавить
if (isset($this->request->post['top'])) {
$this->data['top'] = $this->request->post['top'];
} elseif (!empty($information_info) && isset($information_info['top'])) {
$this->data['top'] = $information_info['top'];
} else {
$this->data['top'] = 0;
}

admin/model/catalog/information.php

заменить
$this->db->query("INSERT INTO " . DB_PREFIX . "information SET sort_order = '" . (int)$data['sort_order'] . "', bottom = '" . (isset($data['bottom']) ? (int)$data['bottom'] : 0) . "', status = '" . (int)$data['status'] . "'");


на
$fields = mysql_list_fields(DB_DATABASE, DB_PREFIX.'information');
$columns = mysql_num_fields($fields);
for ($i = 0; $i < $columns; $i++) {
$field[] = mysql_field_name($fields, $i);
}
if (!in_array('top', $field))
{
$this->db->query("ALTER TABLE ".DB_PREFIX."information ADD COLUMN top INT(1) NOT NULL DEFAULT 0  AFTER `information_id`");
}
$this->db->query("INSERT INTO " . DB_PREFIX . "information SET sort_order = '" . (int)$data['sort_order'] . "', top = '" . (isset($data['top']) ? (int)$data['top'] : 0) . "', bottom = '" . (isset($data['bottom']) ? (int)$data['bottom'] : 0) . "', status = '" . (int)$data['status'] . "'");


назти
$this->db->query("UPDATE " . DB_PREFIX . "information SET sort_order = '" . (int)$data['sort_order'] . "', bottom = '" . (isset($data['bottom']) ? (int)$data['bottom'] : 0) . "', status = '" . (int)$data['status'] . "' WHERE information_id = '" . (int)$information_id . "'");

заменить
$fields = mysql_list_fields(DB_DATABASE, DB_PREFIX.'information');
$columns = mysql_num_fields($fields);
for ($i = 0; $i < $columns; $i++) {
$field[] = mysql_field_name($fields, $i);
}
if (!in_array('top', $field))
{
$this->db->query("ALTER TABLE ".DB_PREFIX."information ADD COLUMN top INT(1) NOT NULL DEFAULT 0  AFTER `information_id`");
}
$this->db->query("UPDATE " . DB_PREFIX . "information SET sort_order = '" . (int)$data['sort_order'] . "', top = '" . (isset($data['top']) ? (int)$data['top'] : 0) . "', bottom = '" . (isset($data['bottom']) ? (int)$data['bottom'] : 0) . "', status = '" . (int)$data['status'] . "' WHERE information_id = '" . (int)$information_id . "'");



admin/language/english/catalog/information.php
перед
$_['entry_bottom']      = 'Bottom:<br/><span class="help">Display in the bottom footer.</span>';

добавить
$_['entry_top']      = 'Top:<br/><span class="help">Display in the top navigation bar.</span>';

admin/language/russian/catalog/information.php
перед
$_['entry_bottom']      =

добавить
$_['entry_top']      = 'Верхнее меню:<br/><span class="help">http://cartopen.ru/</span>';


admin/view/template/catalog/information_form.tpl

перед
<td><?php echo $entry_bottom; ?></td>


добавить
<tr>
  <td><?php echo $entry_top; ?></td>
  <td><?php if ($top) { ?>
<input type="checkbox" name="top" value="1" checked="checked" />
<?php } else { ?>
<input type="checkbox" name="top" value="1" />
<?php } ?></td>
</tr>

Скачать