osclass

How to link city areas in osclass?


I have function in osclass..

function item_city_area($cityarea_txt, $cityarea_select_txt) {
      $aCityArea    = osc_get_cityarea() ;
      $item       = (osc_item() != null) ? osc_item() : array() ;

      switch( count($aCityArea) ) {
          case 0:     // 0 regions ?>
<div class="clearfix">
<label><?php echo $cityarea_txt ; ?></label>
<div class="input">
  <input class="city_name" id="city_name" type="text" name="city" value="<?php echo get_city_name($item) ; ?>" />
</div>
</div>
<?php
          break;
          case 1:      ?>
<input class="city_id" id="city_id" type="hidden" name="cityId" value="<?php echo get_city_id($item) ; ?>" />
<?php
          break;
          default:    // more than one region ?>
<div class="clearfix">
<label><?php echo $cityarea_txt ; ?></label>
<div class="input">
  <select class="cityarea_id" id="cityarea_id" name="cityArea">
    <option value=""><?php echo $cityarea_select_txt ; ?></option>
    <?php //foreach($aCityArea as $city) { ?>
    <option value="<?php echo $city['pk_i_id'] ; ?>"><?php echo $city['s_name'] ; ?></option>
    <?php //} ?>
  </select>
</div>
</div>
<?php
          break;
      }
  }

and please help me on call this and linkage to the city..


Solution

  • You can see as example in search page inside theme folder in search page. eg. themes/modern/search.php you can call as For the city you call as

    <?php item_city_box(__("city", "theme_name"), __("Select a city...", "theme_name")) ; ?>
    **For the cityarea you can call as**
    <?php item_city_area(__("cityarea", "theme_name"), __("Select a cityarea...", "theme_name")) ; ?>
    

    For the linkage to city and cityarea, you have to modify your database too. You can ask if you did not get it. Cheers