Может кому-то пригодится
у меня OC 2.3
Вывод столбца Вес (weight) в админке:
1. в /admin/view/template/catalog/product_list.tpl в <thead>
добавляем:
<td class="text-left"><?php if ($sort == 'p.weight') { ?>
<a href="<?php echo $sort_weight; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_weight; ?></a>
<?php } else { ?>
<a href="<?php echo $sort_weight; ?>"><?php echo $column_weight; ?></a>
<?php } ?></td>
в <tbody> после <td class="text-left"><?php echo $product['model']; ?></td>
добавляем:
<td class="text-left"><?php echo $product['weight']; ?></td>
в строке <td class="text-center" colspan="8"><?php echo $text_no_results; ?></td>
заменяем colspan="8" на colspan="9"
2. в /admin/controller/catalog/product.php
после $data['column_model'] = $this->language->get('column_model');
добавляем:
$data['column_weight'] = $this->language->get('column_weight');
после $data['sort_model'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.model' . $url, true);
добавляем:
$data['sort_weight'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.weight' . $url, true);
после 'model' => $result['model'],
добавляем:
'weight' => $result['weight'],
3. в /admin/language/ru-ru/catalog/product.php
после $_['column_model'] = 'Модель';
добавляем:
$_['column_weight'] = 'Вес';
4. в /admin/model/catalog/product.php
после: 'p.model',
добавляем:
'p.weight',
Вывод фильтра Вес (weight) в админке:
1. в /admin/controller/catalog/product.php делаем по аналогии фильтра filter_model дублируем все блоки с filter_model и заменяем на filter_weight
например дублируем if (isset($this->request->get['filter_model'])) {
$url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
}
заменяем filter_model на filter_weight
if (isset($this->request->get['filter_weight'])) {
$url .= '&filter_weight=' . urlencode(html_entity_decode($this->request->get['filter_weight'], ENT_QUOTES, 'UTF-8'));
}
и т.д у меня получилось 11 блоков
В конце в public function autocomplete() не добавляем filter_weight !
2. /admin/model/catalog/product.php аналогично как и в 1 пункте
в public function getProducts после:
if (!empty($data['filter_model'])) {
$sql .= " AND p.model LIKE '" . $this->db->escape($data['filter_model']) . "%'";
}
добавляем:
if (!empty($data['filter_weight'])) {
$sql .= " AND p.weight LIKE '" . $this->db->escape($data['filter_weight']) . "%'";
}
в public function getTotalProducts после:
if (!empty($data['filter_model'])) {
$sql .= " AND p.model LIKE '" . $this->db->escape($data['filter_model']) . "%'";
}
добавляем:
if (!empty($data['filter_weight'])) {
$sql .= " AND p.weight LIKE '" . $this->db->escape($data['filter_weight']) . "%'";
}
3. в /admin/view/template/catalog/product_list.tpl
после:
<div class="col-sm-4">
<div class="form-group">
<label class="control-label" for="input-status"><?php echo $entry_status; ?></label>
<select name="filter_status" id="input-status" class="form-control">
<option value="*"></option>
<?php if ($filter_status) { ?>
<option value="1" selected="selected"><?php echo $text_enabled; ?></option>
<?php } else { ?>
<option value="1"><?php echo $text_enabled; ?></option>
<?php } ?>
<?php if (!$filter_status && !is_null($filter_status)) { ?>
<option value="0" selected="selected"><?php echo $text_disabled; ?></option>
<?php } else { ?>
<option value="0"><?php echo $text_disabled; ?></option>
<?php } ?>
</select>
</div>
Добавляем:
<div class="form-group">
<label class="control-label" for="input-weight"><?php echo 'Bec:'; ?></label>
<input type="text" name="filter_weight" value="<?php echo $filter_weight; ?>" placeholder="<?php echo 'Bec:'; ?>" id="input-weight" class="form-control" />
</div>
в конце после
var filter_quantity = $('input[name=\'filter_quantity\']').val();
if (filter_quantity) {
url += '&filter_quantity=' + encodeURIComponent(filter_quantity);
}
добавляем:
var filter_weight = $('input[name=\'filter_weight\']').val();
if (filter_weight) {
url += '&filter_weight=' + encodeURIComponent(filter_weight);
}
готово