• Главная
  • Поиск
    •  
  • Здравствуйте, Гость

Автор Тема: City Area селект  (Прочитано 1981 раз)
  • *
  • Сообщений: 1
« : 13 Октябрь 2016, 16:41:20 »
Нужно сделать city area select
в таблицу city_area в mysql ввел данные fk_i_city_id и s_name
в файле oc-include/osclass/frm/Item.form.class.php дописал вот так
static public function city_area_select($citi_area = null, $item = null) {
            if( Session::newInstance()->_getForm('cityArea') != ''){
                $citi_area = null;
            } else {
                if($citi_area==null) { $citi_area = array(); };
            }
            if($item==null) { $item = osc_item(); };
            if( count($citi_area) >= 1 ) {
                if( Session::newInstance()->_getForm('cityAreaId') != "" ) {
                    $item['fk_i_city_area_id'] = Session::newInstance()->_getForm('cityAreaId');
                }
if( Session::newInstance()->_getForm('cityId') != "" ) {
                    $item['fk_i_city_id'] = Session::newInstance()->_getForm('cityId');
                }
               
                parent::generic_select('cityAreaId', $citi_area, 'pk_i_id', 's_name', __('Select a city area..'), (isset($item['fk_i_city_area_id'])) ? $item['fk_i_city_area_id'] : null) ;
                return true ;
            } else {
                if( Session::newInstance()->_getForm('cityArea') != "" ) {
                    $item['s_city_area'] = Session::newInstance()->_getForm('cityArea');
                }
                parent::generic_input_text('cityArea', (isset($item['s_city_area'])) ? $item['s_city_area'] : null) ;
                return true ;
            }
        }
в файле темы item-post.php изменил строку city_area на ItemForm::city_area_select( CityArea::newInstance()) ;
и в файле hDefines.php дописал выборку
/**
     * Gets list of cities_area (from a city)
     *
     * @param int $city
     * @return string
     */
    function osc_get_cities_area($city = '') {
        if (View::newInstance()->_exists('city_area')) {
            return View::newInstance()->_get('city_area');
        } else {
            if($city=='') {
                return CityArea::newInstance()->listAll();
            } else {
                return CityArea::newInstance()->findByCity($city);
            }
        }

все вроде должно работать но при заполнении всех полей в бд smk_t_item_location в fk_i_city_id вводиться NULL вместо id города а s_city пустое
ПОМОГИТЕ НАЙТИ ОШИБКУ

 


test