A
A
Arthur Strezhinov2018-12-06 23:16:07
opencart
Arthur Strezhinov, 2018-12-06 23:16:07

Sort by time in opencart?

In the product table, there are two columns departure_time and arrival_time, the type is set to time, it is not possible to sort. It records the time of departure and the time of arrival of the bus.
if the sorting is sorted, but it’s strange ... let’s say the bus leaves at 10:40 there are five such applications, and after five there is a time of 09:30, but this time is at the bottom of
controller/product/category.php

if (isset($this->request->get['sort'])) {
            $sort = $this->request->get['sort'];
        } else {
            $sort = 'p.departure_time';
        }

        if (isset($this->request->get['order'])) {
            $order = $this->request->get['order'];
        } else {
            $order = 'ASC';
        }


            $data['sorts'][] = array(
                'text'  => $this->language->get('text_departure_time'),
                'value' => 'p.departure_time-ASC',
                'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=departure_time&order=ASC' . $url)
            );

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladislav Marudenko, 2018-12-07
@INPVLSA

Describe in a little more detail what happens, and I will help, I just don’t quite understand what exactly you get after what is displayed

E
Eugene, 2018-12-07
@Eugeny1987

In your case, I would have a separate field that indicates the time the bus was on the route and double sorted by the time of departure and the time the bus was on the route.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question