Вначале выполняем запрос в базу данных
ALTER TABLE `product_description` ADD `description_mini` TEXT NOT NULL AFTER `name` ;Затем открываем admin/model/catalog/product.phpИщем функцию getProductDescriptions() (~434 строка)
После
'description' => $result['description'],
Дописываем
'description_mini' => $result['description_mini'],
В этом же файле в функции addProduct() (~3 строка)
Запрос
foreach ($data['product_description'] as $language_id => $value) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "'"); }
Модицицируем и получаем
foreach ($data['product_description'] as $language_id => $value) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "', description_mini = '" . $this->db->escape($value['description_mini']) . "'");
}
Теперь необходимо в функции editProduct() (~ 130 строка) сделать практически тоже самое
Это
foreach ($data['product_description'] as $language_id => $value) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "'");
}
Меняем на это
foreach ($data['product_description'] as $language_id => $value) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "', description_mini = '" . $this->db->escape($value['description_mini']) . "'"); }
Затем, открываем admin\view\template\catalog\product_form.tpl
Ищем
<tr>
<td><?php echo $entry_description; ?></td>
<td><textarea name="product_description[<?php echo $language['language_id']; ?>][description]" id="description<?php echo $language['language_id']; ?>"><?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['description'] : ''; ?></textarea></td>
</tr>
До или после добавляем
<tr>
<td><?php echo $entry_description; ?></td>
<td><textarea name="product_description[<?php echo $language['language_id']; ?>][description_mini]" id="description<?php echo $language['language_id']; ?>"><?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['description_mini'] : ''; ?></textarea></td>
</tr>
ВСЕ! С Админкой закончили
Теперь перейдем на фронт
Открываем catalog\model\product\category.php
Ищем функцию getProduct() ~7 строка
после
'description' => $query->row['description'],
Добавляем
'description_mini' => $query->row['description_mini'],Открываем catalog\controller\catalog\category.phpИщем
$descr_plaintext = strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'));До или после дописываем
$descr_mini = strip_tags(html_entity_decode($result['description_mini'], ENT_QUOTES, 'UTF-8'));И чуть ниже в массив добавляем
description_mini' => $descr_mini,Открываем файл \catalog\view\theme\default\template\product\category.tplИв нужном месте пишем
<?php echo $product['description_mini']; ?>
ВОТ И ВСЕ!!!
p.s. Это описание для OpenCart 1.5.x