Loading

Author Topic: All cities not showing on the side pane  (Read 353 times)

leech

  • Newbie
  • *
  • Posts: 16
All cities not showing on the side pane
« on: February 05, 2012, 10:20:19 pm »
Hi all
I am getting started with the OS class classifieds and I installed the OS class 2.3.5 with the Bcute theme. But the problem I am facing is that under Locations on right side pane only those cities are listed that have an ad posted. How can I make it to default all the cities regardless of the ads? All help/suggestions are appreciated.
Thank you.
« Last Edit: February 05, 2012, 10:23:08 pm by leech »

garciademarina

  • Administrator
  • Sr. Member
  • *****
  • Posts: 403
    • OSClass
    • Email
Re: All cities not showing on the side pane
« Reply #1 on: February 06, 2012, 12:46:01 pm »
Hi,

You need to edit some helpers functions, located at oc-includes/osclass/helpers/hSearch.php

and one parameter ">="

osc_count_list_cities()

   
Code: [Select]
function osc_count_list_cities($region = '%%%%') {
        if ( !View::newInstance()->_exists('list_cities') ) {
            View::newInstance()->_exportVariableToView('list_cities', Search::newInstance()->listCities($region, ">=") ) ;
        }
        return View::newInstance()->_count('list_cities') ;
    }

osc_has_list_cities()

 
Code: [Select]
function osc_has_list_cities($region = '%%%%') {
        if ( !View::newInstance()->_exists('list_cities') ) {
            View::newInstance()->_exportVariableToView('list_cities', Search::newInstance()->listCities($region,'>=') ) ;
        }
        $result = View::newInstance()->_next('list_cities');

        if (!$result) View::newInstance()->_erase('list_cities') ;
        return $result;
    }

This will list all cities with and without items.

Regards
Carlos García de Marina
carlos@osclass.org
Twitter: @osclass
http://www.osclass.org/

OSClass - Open Source Classifieds

keyboard

  • Jr. Member
  • **
  • Posts: 64
    • Brill Deal
Re: All cities not showing on the side pane
« Reply #2 on: February 06, 2012, 03:30:23 pm »
Hi, I tried to follow your instructions but failed ..could you please simplify them ...by saying what to remove and what to replace it with...thanks in advance

garciademarina

  • Administrator
  • Sr. Member
  • *****
  • Posts: 403
    • OSClass
    • Email
Re: All cities not showing on the side pane
« Reply #3 on: February 06, 2012, 04:55:07 pm »
Hi,

find into hSearch.php this function call, Search::newInstance()->listCities($region) inside osc_count_list_cities() and osc_has_list_cities(),
and replace it for Search::newInstance()->listCities($region,'>=').

Regards
Carlos García de Marina
carlos@osclass.org
Twitter: @osclass
http://www.osclass.org/

OSClass - Open Source Classifieds

keyboard

  • Jr. Member
  • **
  • Posts: 64
    • Brill Deal
Re: All cities not showing on the side pane
« Reply #4 on: February 06, 2012, 05:50:48 pm »
Hi again garcia,

sorry if I am asking too much.. :-[.here is the file after I modified it.

<?php

    /*
     *      OSCLass – software for creating and publishing online classified
     *                           advertising platforms
     *
     *                        Copyright (C) 2010 OSCLASS
     *
     *       This program is free software: you can redistribute it and/or
     *     modify it under the terms of the GNU Affero General Public License
     *     as published by the Free Software Foundation, either version 3 of
     *            the License, or (at your option) any later version.
     *
     *     This program is distributed in the hope that it will be useful, but
     *         WITHOUT ANY WARRANTY; without even the implied warranty of
     *        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *             GNU Affero General Public License for more details.
     *
     *      You should have received a copy of the GNU Affero General Public
     * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */

    /**
    * Helper Search
    * @package OSClass
    * @subpackage Helpers
    * @author OSClass
    */

    /**
     * Gets search object
     *
     * @return mixed
     */
    function osc_search() {
        if(View::newInstance()->_exists('search')) {
            return View::newInstance()->_get('search');
        } else {
            $search = new Search();
            View::newInstance()->_exportVariableToView('search', $search);
            return $search;
        }
    }

    /**
     * Gets available search orders
     *
     * @return array
     */
    function osc_list_orders() {
        return  array(
                     __('Newly listed')       => array('sOrder' => 'dt_pub_date', 'iOrderType' => 'desc')
                    ,__('Lower price first')  => array('sOrder' => 'i_price', 'iOrderType' => 'asc')
                    ,__('Higher price first') => array('sOrder' => 'i_price', 'iOrderType' => 'desc')
                );
    }
   
    /**
     * Gets current search page
     *
     * @return int
     */
    function osc_search_page() {
        return View::newInstance()->_get('search_page');
    }
   
    /**
     * Gets total pages of search
     *
     * @return int
     */
    function osc_search_total_pages() {
        return View::newInstance()->_get('search_total_pages');
    }
   
    /**
     * Gets if "has pic" option is enabled or not in the search
     *
     * @return boolean
     */
    function osc_search_has_pic() {
        return View::newInstance()->_get('search_has_pic');
    }
   
    /**
     * Gets current search order
     *
     * @return string
     */
    function osc_search_order() {
        return View::newInstance()->_get('search_order');
    }
   
    /**
     * Gets current search order type
     *
     * @return string
     */
    function osc_search_order_type() {
        return View::newInstance()->_get('search_order_type');
    }
   
    /**
     * Gets current search pattern
     *
     * @return string
     */
    function osc_search_pattern() {
        if(View::newInstance()->_exists('search_pattern')) {
            return View::newInstance()->_get('search_pattern');
        } else {
            return '';
        }
    }

    /**
     * Gets current search region
     *
     * @return string
     */
    function osc_search_region() {
        return View::newInstance()->_get('search_region');
    }

    /**
     * Gets current search city
     *
     * @return string
     */
    function osc_search_city() {
        return View::newInstance()->_get('search_city');
    }
   
    /**
     * Gets current search max price
     *
     * @return float
     */
    function osc_search_price_max() {
        return View::newInstance()->_get('search_price_max');
    }
   
    /**
     * Gets current search min price
     *
     * @return float
     */
    function osc_search_price_min() {
        return View::newInstance()->_get('search_price_min');
    }
   
    /**
     * Gets current search total items
     *
     * @return int
     */
    function osc_search_total_items() {
        return View::newInstance()->_get('search_total_items');
    }
   
    /**
     * Gets current search "show as" variable (show the items as a list or as a gallery)
     *
     * @return string
     */
    function osc_search_show_as() {
        return View::newInstance()->_get('search_show_as');
    }
   
    /**
     * Gets current search start item record
     *
     * @return int
     */
    function osc_search_start() {
        return View::newInstance()->_get('search_start');
    }
   
    /**
     * Gets current search end item record
     *
     * @return int
     */
    function osc_search_end() {
        return View::newInstance()->_get('search_end');
    }
   
    /**
     * Gets current search category
     *
     * @return array
     */
    function osc_search_category() {
        if (View::newInstance()->_exists('search_subcategories')) {
            $category = View::newInstance()->_current('search_subcategories') ;
        } elseif (View::newInstance()->_exists('search_categories')) {
            $category = View::newInstance()->_current('search_categories') ;
        } else {
            $category = View::newInstance()->_get('search_category') ;
        }
        return($category) ;
    }

    /**
     * Gets current search category id
     *
     * @return int
     */
    function osc_search_category_id() {
        $categories = osc_search_category() ;
        $category   = array() ;
        $where      = array() ;

        foreach($categories as $cat) {
            if( is_numeric($cat) ) {
                $where[] = "a.pk_i_id = " . $cat ;
            } else {
                $slug_cat = explode( "/", trim($cat, "/") ) ;
                $where[]  = "b.s_slug = '" . addslashes( $slug_cat[count($slug_cat)-1] ) . "'" ;
            }
        }

        if( empty($where) ) {
            return null ;
        }

        // TODO: not the best way to do it
        $categories = Category::newInstance()->listWhere( implode(" OR ", $where) ) ;
        foreach($categories as $cat) {
            $category[] = $cat['pk_i_id'] ;
        }

        return $category ;
    }

    /**
     * Update the search url with new options
     *
     * @return string
     */
    function osc_update_search_url($params, $delimiter = '&amp;') {
        $request = Params::getParamsAsArray('get');
        unset($request['osclass']);
        if(isset($request['sCategory[0]'])) {
            unset($request['sCategory']);
        }
        unset($request['sCategory[]']);
        $merged = array_merge($request, $params);
        return osc_base_url(true) ."?" . http_build_query($merged, '', $delimiter);
    }

    /**
     * Load the form for the alert subscription
     *
     * @return void
     */
    function osc_alert_form() {
        if( !View::newInstance()->_exists('search_alert') ) {
            $search = osc_search() ;
            $search->order() ;
            $search->limit() ;
            View::newInstance()->_exportVariableToView('search_alert', base64_encode(serialize($search))) ;
        }

        osc_current_web_theme_path('alert-form.php') ;
    }
   
    /**
     * Gets alert of current search
     *
     * @return string
     */
    function osc_search_alert() {
        return View::newInstance()->_get('search_alert');
    }

    /**
     * Gets for a default search (all categories, noother option)
     *
     * @return string
     */
    function osc_search_show_all_url( ) {
        if(osc_rewrite_enabled ()) {
            return osc_base_url() . 'search/';
        } else {
            return osc_base_url(true) . '?page=search';
        }
    }

    /**
     * Gets search url given params
     *
     * @params array $params
     * @return string
     */
    function osc_search_url($params = null) {
        $url = osc_base_url(true) . '?page=search';
        if($params!=null) {
            foreach($params as $k => $v) {
                $url .= "&" . $k . "=" . $v;
            }
        }
        return $url;
    }
   
    /**
     * Gets list of countries with items
     *
     * @return array
     */
    function osc_list_country() {
        if (View::newInstance()->_exists('list_countries')) {
            return View::newInstance()->_current('list_countries') ;
        } else {
            return null;
        }
    }

    /**
     * Gets list of regions with items
     *
     * @return array
     */
    function osc_list_region() {
        if (View::newInstance()->_exists('list_regions')) {
            return View::newInstance()->_current('list_regions') ;
        } else {
            return null;
        }
    }

    /**
     * Gets list of cities with items
     *
     * @return array
     */
    function osc_list_city() {
        if (View::newInstance()->_exists('list_cities')) {
            return View::newInstance()->_current('list_cities') ;
        } else {
            return null;
        }
    }
   
    /**
     * Gets the next country in the list_countries list
     *
     * @return array
     */
    function osc_has_list_countries() {
        if ( !View::newInstance()->_exists('list_countries') ) {
            View::newInstance()->_exportVariableToView('list_countries', Search::newInstance()->listCountries('>=') ) ;
        }
        return View::newInstance()->_next('list_countries') ;
    }

    /**
     * Gets the next region in the list_regions list
     *
     * @param string $country
     * @return array
     */
    function osc_has_list_regions($country = '%%%%') {
        if ( !View::newInstance()->_exists('list_regions') ) {
            View::newInstance()->_exportVariableToView('list_regions', Search::newInstance()->listRegions($country, '>') ) ;
        }
        return View::newInstance()->_next('list_regions') ;
    }

    /**
     * Gets the next city in the list_cities list
     *
     * @param string $region
     * @return array
     */




    function osc_count_list_cities($region = '%%%%') {
        if ( !View::newInstance()->_exists('list_cities') ) {
            View::newInstance()->_exportVariableToView('list_cities', Search::newInstance()->listCities($region,'>=')  ) ;
        }
        return View::newInstance()->_count('list_cities') ;
    }







    /**
     * Gets the total number of countries in list_countries
     *
     * @return int
     */
    function osc_count_list_countries() {
        if ( !View::newInstance()->_exists('list_countries') ) {
            View::newInstance()->_exportVariableToView('list_countries', Search::newInstance()->listCountries() ) ;
        }
        return View::newInstance()->_count('list_countries') ;
    }

    /**
     * Gets the total number of regions in list_regions
     *
     * @param string $country
     * @return int
     */
    function osc_count_list_regions($country = '%%%%') {
        if ( !View::newInstance()->_exists('list_regions') ) {
            View::newInstance()->_exportVariableToView('list_regions', Search::newInstance()->listRegions($country) ) ;
        }
        return View::newInstance()->_count('list_regions') ;
    }

    /**
     * Gets the total number of cities in list_cities
     *
     * @param string $region
     * @return int
     */




    function osc_has_list_cities($region = '%%%%') {
        if ( !View::newInstance()->_exists('list_cities') ) {
            View::newInstance()->_exportVariableToView('list_cities', Search::newInstance()->listCities($region,'>=') ) ;
        }
        $result = View::newInstance()->_next('list_cities');

        if (!$result) View::newInstance()->_erase('list_cities') ;
        return $result;
    }







    /**
     * Gets the the name of current "list region"
     *
     * @return string
     */
    function osc_list_region_name() {
        return osc_field(osc_list_region(), 'region_name', '') ;
    }
   
    /**
     * Gets the number of items of current "list region"
     *
     * @return int
     */
    function osc_list_region_items() {
        return osc_field(osc_list_region(), 'items', '') ;
    }

    /**
     * Gets the the name of current "list city""
     *
     * @return string
     */
    function osc_list_city_name() {
        return osc_field(osc_list_city(), 'city_name', '') ;
    }

    /**
     * Gets the number of items of current "list city"
     *
     * @return int
     */
    function osc_list_city_items() {
        return osc_field(osc_list_city(), 'items', '') ;
    }
   
    /**
     * Gets the url of current "list country""
     *
     * @return string
     */
    function osc_list_country_url() {
        return osc_search_url(array('sCountry' => osc_list_country_name()));
    }

    /**
     * Gets the url of current "list region""
     *
     * @return string
     */
    function osc_list_region_url() {
        return osc_search_url(array('sRegion' => osc_list_region_name()));
    }

    /**
     * Gets the url of current "list city""
     *
     * @return string
     */
    function osc_list_city_url() {
        return osc_search_url(array('sCity' => osc_list_city_name()));
    }

    /**********************
     ** LATEST SEARCHES **
     **********************/
    /**
     * Gets the latest searches done in the website
     *
     * @param int $limit
     * @return array
     */
    function osc_get_latest_searches($limit = 20) {
        if ( !View::newInstance()->_exists('latest_searches') ) {
            View::newInstance()->_exportVariableToView('latest_searches', LatestSearches::newInstance()->getSearches($limit) ) ;
        }
        return View::newInstance()->_count('latest_searches') ;
    }

    /**
     * Gets the total number of latest searches done in the website
     *
     * @return int
     */
    function osc_count_latest_searches() {
        if ( !View::newInstance()->_exists('latest_searches') ) {
            View::newInstance()->_exportVariableToView('latest_searches', LatestSearches::newInstance()->getSearches() ) ;
        }
        return View::newInstance()->_count('latest_searches') ;
    }
   
    /**
     * Gets the next latest search
     *
     * @return array
     */
    function osc_has_latest_searches() {
        if ( !View::newInstance()->_exists('latest_searches') ) {
            View::newInstance()->_exportVariableToView('latest_searches', LatestSearches::newInstance()->getSearches() ) ;
        }
        return View::newInstance()->_next('latest_searches') ;
    }

    /**
     * Gets the current latest search
     *
     * @return array
     */
    function osc_latest_search() {
        if (View::newInstance()->_exists('latest_searches')) {
            return View::newInstance()->_current('latest_searches') ;
        }
        return null;
    }
   
    /**
     * Gets the current latest search pattern
     *
     * @return string
     */
    function osc_latest_search_text() {
        return osc_field(osc_latest_search(), 's_search', '');
    }

    /**
     * Gets the current latest search date
     *
     * @return string
     */
    function osc_latest_search_date() {
        return osc_field(osc_latest_search(), 'd_date', '');
    }

    /**
     * Gets the current latest search total
     *
     * @return string
     */
    function osc_latest_search_total() {
        return osc_field(osc_latest_search(), 'i_total', '');
    }

?>



You can see on my website under location that there are no cities showing at all. why is that?

Thanks

leech

  • Newbie
  • *
  • Posts: 16
Re: All cities not showing on the side pane
« Reply #5 on: February 07, 2012, 06:11:06 am »
Thanks. Now i can see the city list on the right side Home page.
Thanks again!

garciademarina

  • Administrator
  • Sr. Member
  • *****
  • Posts: 403
    • OSClass
    • Email
Re: All cities not showing on the side pane
« Reply #6 on: February 07, 2012, 12:05:54 pm »
Hi @leech , glad to hear that works.

What theme are you using ?

Regards
Carlos García de Marina
carlos@osclass.org
Twitter: @osclass
http://www.osclass.org/

OSClass - Open Source Classifieds

leech

  • Newbie
  • *
  • Posts: 16
Re: All cities not showing on the side pane
« Reply #7 on: February 07, 2012, 09:40:26 pm »
Hi
I am using Bcute

garciademarina

  • Administrator
  • Sr. Member
  • *****
  • Posts: 403
    • OSClass
    • Email
Re: All cities not showing on the side pane
« Reply #8 on: February 08, 2012, 02:53:50 pm »
@leech , @keyboard is using Bcute too but without success.

May be if you can upload your hSearch.php with the your changes, can help @keyboard.

Thanks and regards
Carlos García de Marina
carlos@osclass.org
Twitter: @osclass
http://www.osclass.org/

OSClass - Open Source Classifieds

leech

  • Newbie
  • *
  • Posts: 16
Re: All cities not showing on the side pane
« Reply #9 on: February 08, 2012, 04:00:40 pm »
Try this  : OC-Includes/OSClass/Helpers/h.search

<?php

    /*
     *      OSCLass – software for creating and publishing online classified
     *                           advertising platforms
     *
     *                        Copyright (C) 2010 OSCLASS
     *
     *       This program is free software: you can redistribute it and/or
     *     modify it under the terms of the GNU Affero General Public License
     *     as published by the Free Software Foundation, either version 3 of
     *            the License, or (at your option) any later version.
     *
     *     This program is distributed in the hope that it will be useful, but
     *         WITHOUT ANY WARRANTY; without even the implied warranty of
     *        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *             GNU Affero General Public License for more details.
     *
     *      You should have received a copy of the GNU Affero General Public
     * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */

    /**
    * Helper Search
    * @package OSClass
    * @subpackage Helpers
    * @author OSClass
    */

    /**
     * Gets search object
     *
     * @return mixed
     */
    function osc_search() {
        if(View::newInstance()->_exists('search')) {
            return View::newInstance()->_get('search');
        } else {
            $search = new Search();
            View::newInstance()->_exportVariableToView('search', $search);
            return $search;
        }
    }

    /**
     * Gets available search orders
     *
     * @return array
     */
    function osc_list_orders() {
        return  array(
                     __('Newly listed')       => array('sOrder' => 'dt_pub_date', 'iOrderType' => 'desc')
                    ,__('Lower price first')  => array('sOrder' => 'i_price', 'iOrderType' => 'asc')
                    ,__('Higher price first') => array('sOrder' => 'i_price', 'iOrderType' => 'desc')
                );
    }
   
    /**
     * Gets current search page
     *
     * @return int
     */
    function osc_search_page() {
        return View::newInstance()->_get('search_page');
    }
   
    /**
     * Gets total pages of search
     *
     * @return int
     */
    function osc_search_total_pages() {
        return View::newInstance()->_get('search_total_pages');
    }
   
    /**
     * Gets if "has pic" option is enabled or not in the search
     *
     * @return boolean
     */
    function osc_search_has_pic() {
        return View::newInstance()->_get('search_has_pic');
    }
   
    /**
     * Gets current search order
     *
     * @return string
     */
    function osc_search_order() {
        return View::newInstance()->_get('search_order');
    }
   
    /**
     * Gets current search order type
     *
     * @return string
     */
    function osc_search_order_type() {
        return View::newInstance()->_get('search_order_type');
    }
   
    /**
     * Gets current search pattern
     *
     * @return string
     */
    function osc_search_pattern() {
        if(View::newInstance()->_exists('search_pattern')) {
            return View::newInstance()->_get('search_pattern');
        } else {
            return '';
        }
    }

    /**
     * Gets current search region
     *
     * @return string
     */
    function osc_search_region() {
        return View::newInstance()->_get('search_region');
    }

    /**
     * Gets current search city
     *
     * @return string
     */
    function osc_search_city() {
        return View::newInstance()->_get('search_city');
    }
   
    /**
     * Gets current search max price
     *
     * @return float
     */
    function osc_search_price_max() {
        return View::newInstance()->_get('search_price_max');
    }
   
    /**
     * Gets current search min price
     *
     * @return float
     */
    function osc_search_price_min() {
        return View::newInstance()->_get('search_price_min');
    }
   
    /**
     * Gets current search total items
     *
     * @return int
     */
    function osc_search_total_items() {
        return View::newInstance()->_get('search_total_items');
    }
   
    /**
     * Gets current search "show as" variable (show the items as a list or as a gallery)
     *
     * @return string
     */
    function osc_search_show_as() {
        return View::newInstance()->_get('search_show_as');
    }
   
    /**
     * Gets current search start item record
     *
     * @return int
     */
    function osc_search_start() {
        return View::newInstance()->_get('search_start');
    }
   
    /**
     * Gets current search end item record
     *
     * @return int
     */
    function osc_search_end() {
        return View::newInstance()->_get('search_end');
    }
   
    /**
     * Gets current search category
     *
     * @return array
     */
    function osc_search_category() {
        if (View::newInstance()->_exists('search_subcategories')) {
            $category = View::newInstance()->_current('search_subcategories') ;
        } elseif (View::newInstance()->_exists('search_categories')) {
            $category = View::newInstance()->_current('search_categories') ;
        } else {
            $category = View::newInstance()->_get('search_category') ;
        }
        return($category) ;
    }

    /**
     * Gets current search category id
     *
     * @return int
     */
    function osc_search_category_id() {
        $categories = osc_search_category() ;
        $category   = array() ;
        $where      = array() ;

        foreach($categories as $cat) {
            if( is_numeric($cat) ) {
                $where[] = "a.pk_i_id = " . $cat ;
            } else {
                $slug_cat = explode( "/", trim($cat, "/") ) ;
                $where[]  = "b.s_slug = '" . addslashes( $slug_cat[count($slug_cat)-1] ) . "'" ;
            }
        }

        if( empty($where) ) {
            return null ;
        }

        // TODO: not the best way to do it
        $categories = Category::newInstance()->listWhere( implode(" OR ", $where) ) ;
        foreach($categories as $cat) {
            $category[] = $cat['pk_i_id'] ;
        }

        return $category ;
    }

    /**
     * Update the search url with new options
     *
     * @return string
     */
    function osc_update_search_url($params, $delimiter = '&amp;') {
        $request = Params::getParamsAsArray('get');
        unset($request['osclass']);
        if(isset($request['sCategory[0]'])) {
            unset($request['sCategory']);
        }
        unset($request['sCategory[]']);
        $merged = array_merge($request, $params);
        return osc_base_url(true) ."?" . http_build_query($merged, '', $delimiter);
    }

    /**
     * Load the form for the alert subscription
     *
     * @return void
     */
    function osc_alert_form() {
        if( !View::newInstance()->_exists('search_alert') ) {
            $search = osc_search() ;
            $search->order() ;
            $search->limit() ;
            View::newInstance()->_exportVariableToView('search_alert', base64_encode(serialize($search))) ;
        }

        osc_current_web_theme_path('alert-form.php') ;
    }
   
    /**
     * Gets alert of current search
     *
     * @return string
     */
    function osc_search_alert() {
        return View::newInstance()->_get('search_alert');
    }

    /**
     * Gets for a default search (all categories, noother option)
     *
     * @return string
     */
    function osc_search_show_all_url( ) {
        if(osc_rewrite_enabled ()) {
            return osc_base_url() . 'search/';
        } else {
            return osc_base_url(true) . '?page=search';
        }
    }

    /**
     * Gets search url given params
     *
     * @params array $params
     * @return string
     */
    function osc_search_url($params = null) {
        $url = osc_base_url(true) . '?page=search';
        if($params!=null) {
            foreach($params as $k => $v) {
                $url .= "&" . $k . "=" . $v;
            }
        }
        return $url;
    }
   
    /**
     * Gets list of countries with items
     *
     * @return array
     */
    function osc_list_country() {
        if (View::newInstance()->_exists('list_countries')) {
            return View::newInstance()->_current('list_countries') ;
        } else {
            return null;
        }
    }

    /**
     * Gets list of regions with items
     *
     * @return array
     */
    function osc_list_region() {
        if (View::newInstance()->_exists('list_regions')) {
            return View::newInstance()->_current('list_regions') ;
        } else {
            return null;
        }
    }

    /**
     * Gets list of cities with items
     *
     * @return array
     */
    function osc_list_city() {
        if (View::newInstance()->_exists('list_cities')) {
            return View::newInstance()->_current('list_cities') ;
        } else {
            return null;
        }
    }
   
    /**
     * Gets the next country in the list_countries list
     *
     * @return array
     */
    function osc_has_list_countries() {
        if ( !View::newInstance()->_exists('list_countries') ) {
            View::newInstance()->_exportVariableToView('list_countries', Search::newInstance()->listCountries('>=') ) ;
        }
        return View::newInstance()->_next('list_countries') ;
    }

    /**
     * Gets the next region in the list_regions list
     *
     * @param string $country
     * @return array
     */
    function osc_has_list_regions($country = '%%%%') {
        if ( !View::newInstance()->_exists('list_regions') ) {
            View::newInstance()->_exportVariableToView('list_regions', Search::newInstance()->listRegions($country, '>') ) ;
        }
        return View::newInstance()->_next('list_regions') ;
    }

    /**
     * Gets the next city in the list_cities list
     *
     * @param string $region
     * @return array
     */
    function osc_has_list_cities($region = '%%%%') {
        if ( !View::newInstance()->_exists('list_cities') ) {
            View::newInstance()->_exportVariableToView('list_cities', Search::newInstance()->listCities($region,'>=') ) ;
        }
        $result = View::newInstance()->_next('list_cities');

        if (!$result) View::newInstance()->_erase('list_cities') ;
        return $result;
    }

    /**
     * Gets the total number of countries in list_countries
     *
     * @return int
     */
    function osc_count_list_countries() {
        if ( !View::newInstance()->_exists('list_countries') ) {
            View::newInstance()->_exportVariableToView('list_countries', Search::newInstance()->listCountries() ) ;
        }
        return View::newInstance()->_count('list_countries') ;
    }

    /**
     * Gets the total number of regions in list_regions
     *
     * @param string $country
     * @return int
     */
    function osc_count_list_regions($country = '%%%%') {
        if ( !View::newInstance()->_exists('list_regions') ) {
            View::newInstance()->_exportVariableToView('list_regions', Search::newInstance()->listRegions($country) ) ;
        }
        return View::newInstance()->_count('list_regions') ;
    }

    /**
     * Gets the total number of cities in list_cities
     *
     * @param string $region
     * @return int
     */

function osc_count_list_cities($region = '%%%%') {
        if ( !View::newInstance()->_exists('list_cities') ) {
            View::newInstance()->_exportVariableToView('list_cities', Search::newInstance()->listCities($region, ">=") ) ;
        }
        return View::newInstance()->_count('list_cities') ;
    }

    /**
     * Gets the the name of current "list region"
     *
     * @return string
     */
    function osc_list_region_name() {
        return osc_field(osc_list_region(), 'region_name', '') ;
    }
   
    /**
     * Gets the number of items of current "list region"
     *
     * @return int
     */
    function osc_list_region_items() {
        return osc_field(osc_list_region(), 'items', '') ;
    }

    /**
     * Gets the the name of current "list city""
     *
     * @return string
     */
    function osc_list_city_name() {
        return osc_field(osc_list_city(), 'city_name', '') ;
    }

    /**
     * Gets the number of items of current "list city"
     *
     * @return int
     */
    function osc_list_city_items() {
        return osc_field(osc_list_city(), 'items', '') ;
    }
   
    /**
     * Gets the url of current "list country""
     *
     * @return string
     */
    function osc_list_country_url() {
        return osc_search_url(array('sCountry' => osc_list_country_name()));
    }

    /**
     * Gets the url of current "list region""
     *
     * @return string
     */
    function osc_list_region_url() {
        return osc_search_url(array('sRegion' => osc_list_region_name()));
    }

    /**
     * Gets the url of current "list city""
     *
     * @return string
     */
    function osc_list_city_url() {
        return osc_search_url(array('sCity' => osc_list_city_name()));
    }

    /**********************
     ** LATEST SEARCHES **
     **********************/
    /**
     * Gets the latest searches done in the website
     *
     * @param int $limit
     * @return array
     */
    function osc_get_latest_searches($limit = 20) {
        if ( !View::newInstance()->_exists('latest_searches') ) {
            View::newInstance()->_exportVariableToView('latest_searches', LatestSearches::newInstance()->getSearches($limit) ) ;
        }
        return View::newInstance()->_count('latest_searches') ;
    }

    /**
     * Gets the total number of latest searches done in the website
     *
     * @return int
     */
    function osc_count_latest_searches() {
        if ( !View::newInstance()->_exists('latest_searches') ) {
            View::newInstance()->_exportVariableToView('latest_searches', LatestSearches::newInstance()->getSearches() ) ;
        }
        return View::newInstance()->_count('latest_searches') ;
    }
   
    /**
     * Gets the next latest search
     *
     * @return array
     */
    function osc_has_latest_searches() {
        if ( !View::newInstance()->_exists('latest_searches') ) {
            View::newInstance()->_exportVariableToView('latest_searches', LatestSearches::newInstance()->getSearches() ) ;
        }
        return View::newInstance()->_next('latest_searches') ;
    }

    /**
     * Gets the current latest search
     *
     * @return array
     */
    function osc_latest_search() {
        if (View::newInstance()->_exists('latest_searches')) {
            return View::newInstance()->_current('latest_searches') ;
        }
        return null;
    }
   
    /**
     * Gets the current latest search pattern
     *
     * @return string
     */
    function osc_latest_search_text() {
        return osc_field(osc_latest_search(), 's_search', '');
    }

    /**
     * Gets the current latest search date
     *
     * @return string
     */
    function osc_latest_search_date() {
        return osc_field(osc_latest_search(), 'd_date', '');
    }

    /**
     * Gets the current latest search total
     *
     * @return string
     */
    function osc_latest_search_total() {
        return osc_field(osc_latest_search(), 'i_total', '');
    }

?>

mario97

  • Newbie
  • *
  • Posts: 17
    • Email
Re: All cities not showing on the side pane
« Reply #10 on: February 08, 2012, 05:26:35 pm »
I tried and it works, but you can get a list of regions and not list of cities?

keyboard

  • Jr. Member
  • **
  • Posts: 64
    • Brill Deal
Re: All cities not showing on the side pane
« Reply #11 on: February 09, 2012, 03:20:44 am »
 :'( :'( :'( :'(

Alas, I tried it but i got an error message.
Could it be because i changed certain things in the publish your item page? (i put postcode instead of address...)

garciademarina

  • Administrator
  • Sr. Member
  • *****
  • Posts: 403
    • OSClass
    • Email
Re: All cities not showing on the side pane
« Reply #12 on: February 09, 2012, 12:32:19 pm »
I don't think so, did you some changes on database table structures?

You need to enable osclass debug if you want find the issue.

Take a look at this and follow the instructions:

http://wiki.osclass.org/Debug_PHP_errors
http://wiki.osclass.org/Debug_SQL_queries

Tell us if see something rare.
Carlos García de Marina
carlos@osclass.org
Twitter: @osclass
http://www.osclass.org/

OSClass - Open Source Classifieds

Juan Ramón

  • OSClass Developer
  • Hero Member
  • *****
  • Posts: 2243
    • osclass.org
    • Email
Re: All cities not showing on the side pane
« Reply #13 on: February 09, 2012, 12:56:29 pm »
Perhaps you can use gist.github.com or pastebin.com when you copy/paster your code, it wil be easier to read