Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Сортировка поля Главная категория при редактировании товара


 Share

Recommended Posts

Здравствуйте.

 

Подскажите как сгделать, чтобы при выпотому чторе в поле главной категории значения были отсортированы, т.к. без сортировки им просто не найти нужну категорию.

Сейчас как на скришоте, дико не удобно.

Link to comment
Share on other sites


Откройте файл  admin\view\template\catalog\product_form.twig

В самом низу перед 

{{ footer }}

добавьте

<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2-bootstrap-css/1.4.6/select2-bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/i18n/ru.js"></script>
<script type="text/javascript">
		$(document).ready(function() {
		   $("select").select2();
		   language: "ru"
		});
</script>
<style type="text/css">
.select2-dropdown { z-index: : 1 !Important;}
.select2-container {width:100% !Important;}
.select2-container .select2-selection--single {height: 35px !Important;}
.select2-container--default .select2-selection--single {border: 1px solid #ccc !Important;border-radius: 3px !Important;}
.select2-container--default .select2-selection--single .select2-selection__arrow b {margin-top: 1px!Important;}
}</style>

Сохраните и олистите все кэши.

Link to comment
Share on other sites

Спасипотому что за решение.

 

Попропотому чтовал еещё, в файле admin/model/catalog/category.php

 

public function getCategories($data = array()) {

...

        if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
            $sql .= " ORDER BY " . $data['sort'];
        } else {
            $sql .= " ORDER BY sort_order";          
        }

заменил на 

        if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
            $sql .= " ORDER BY " . $data['sort'];
        } else {
            $sql .= " ORDER BY name";   
        }

 

Категории сортируются как нужно.

Насколько правильно икое решение?

Link to comment
Share on other sites


  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

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.