*

rooman

  • ****
  • 231 posts
Not all regions are shown, only cities are shown
« on: June 23, 2024, 04:41:19 PM »
 Hello
On the company page there is a selection of advertisements by city
Not all regions are shown, only cities are shown
There are advertisements in different regions
How can regions and cities be shown in the selection list?

Code: [Select]
$cities = ModelBPR::newInstance()->getCities($user['pk_i_id']);
Code: [Select]
<div class="bpr-select bpr-city">
            <select name="city" id="bpr-city">
              <option value=""><?php _e('Select city''business_profile'); ?></option>

              <?php if(count($cities) > 0) { ?>
                <?php foreach($cities as $c) { ?>
                  <option value="<?php echo $c['city_id']; ?>" <?php if($current_city == $c['city_id']) { ?>selected="selected"<?php ?>><?php echo osc_location_native_name_selector($c'city_name'); ?></option>
                <?php ?>
              <?php ?>
            </select>
          </div>

*

rooman

  • ****
  • 231 posts
Re: Not all regions are shown, only cities are shown
« Reply #1 on: June 25, 2024, 05:13:06 PM »
Hello

*

MB Themes

Re: Not all regions are shown, only cities are shown
« Reply #2 on: June 26, 2024, 02:34:04 PM »
@rooman
If you look into model
Code: [Select]
// GET SELLER ITEM CITIES
public function getCities($user_id) {
  if(osc_get_current_user_locations_native() == 1) {
    $this->dao->select('DISTINCT l.fk_i_city_id as city_id, l.s_city as city_name, l.s_city_native as city_name_native');
  } else {
    $this->dao->select('DISTINCT l.fk_i_city_id as city_id, l.s_city as city_name');
  }

  $this->dao->from($this->getTable_item() . ' as i, ' . $this->getTable_item_location() . ' as l');

  $this->dao->where('l.fk_i_item_id = i.pk_i_id');
  $this->dao->where('i.fk_i_user_id', (int)$user_id);
  $this->dao->where('l.fk_i_city_id > 0');
  $this->dao->where('l.s_city <> ""');

  $result = $this->dao->get();
 
  if($result) {
    return $result->result();
  }

  return array();
}

It only get cities where seller has listings.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots