Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
$this->dao->orderBy('s_name', 'ASC');
меняем на
$this->dao->orderBy('new_column', 'ASC');
и
$this->dao->orderBy('s_name', 'ASC');
на
$this->dao->orderBy('new_column', 'ASC');
товарищ подсказал, спасибо ему.
Решение, добавляем в таблицу _t_region поле INT и там вписываем нужный порядок и в файле /oc-includes/osclass/model/Region.php
PHP:$this->dao->orderBy('s_name', 'ASC'); меняем на $this->dao->orderBy('new_column', 'ASC'); и $this->dao->orderBy('s_name', 'ASC'); на $this->dao->orderBy('new_column', 'ASC');
<?php
/**
* Created by PhpStorm.
* User: safeacid
* Date: 3/29/22
* Time: 11:12 PM
*/
class RegionExtension extends Region
{
private static $instance;
public static function newInstance() {
if( !self::$instance instanceof self ) {
self::$instance = new self;
}
return self::$instance;
}
function __construct() {
parent::__construct();
}
public function findByCountry($countryId)
{
if(trim($countryId) == '') {
return array();
}
$this->dao->select();
$this->dao->from($this->getTableName());
$this->dao->where('fk_c_country_code', $countryId);
$this->dao->orderBy('new_column', 'ASC'); // ТУТ ТВОЙ ДОПОЛНИТЕЛЬНЫЙ НОВЫЙ СТОЛБИК В ТАБЛИЦЕ БАЗЫ - region
$result = $this->dao->get();
if($result == false) {
return array();
}
return $result->result();
}
}
<?php
/**
* Created by PhpStorm.
* User: safeacid
* Date: 3/29/22
* Time: 11:16 PM
*/
class CityExtension extends City
{
private static $instance;
public static function newInstance() {
if( !self::$instance instanceof self ) {
self::$instance = new self;
}
return self::$instance;
}
function __construct() {
parent::__construct();
}
public function findByRegion($regionId)
{
if($regionId <= 0) {
return array();
}
$this->dao->select($this->getFields());
$this->dao->from($this->getTableName());
$this->dao->where('fk_i_region_id', $regionId);
$this->dao->orderBy('new_column', 'ASC'); // ТУТ ТВОЙ ДОПОЛНИТЕЛЬНЫЙ НОВЫЙ СТОЛБИК В ТАБЛИЦЕ БАЗЫ - city
$result = $this->dao->get();
if( $result == false ) {
return array();
}
return $result->result();
}
}
require_once osc_base_path().'oc-content/themes/delta/model/RegionExtension.php';
require_once osc_base_path().'oc-content/themes/delta/model/CityExtension.php';
//regions
$regions = RegionExtension::newInstance()->findByCountry($country);
//cities
$cities = CityExtension::newInstance()->findByRegion($region);