Divyaadz
Divyaadz

Reputation: 175

Osclass how to fetch the city area information of an item

I'm using Osclass for classified website http://adzhome.com, I want to display the the title as "Apartment For Sale in City Area, City, Region". I'm able to get the region and city information for an Item but not able to fetch the city area. Can anyone let me know the function I can make use to fetch the city area?

Upvotes: 0

Views: 1158

Answers (1)

user3828242
user3828242

Reputation: 1

Paste below function in oc-include/osclass/frm/Item.form.class.php and call the function as

<?php ItemForm::city_area_select( CityArea::newInstance()->findByCity('3')) ; ?>.

This is how I am able to achieve the city area in my classifieds http://aclassifieds.in

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 ;
        }
    }

Upvotes: 0

Related Questions