Osclass面包屑在“城市”页面中显示错误的地区
列表已发布到得克萨斯州/休斯顿,
但这显示的是阿拉巴马州/休斯顿
两个地区的城市相同。如何显示确切的地区?
在不同区域中有2个或3个相同的城市名称时,不会显示对应区域的正确城市。
引用https://www.pluzs.com/houston-c448657
case('search'):
$region = osc_search_region();
$city = osc_search_city();
$pattern = osc_search_pattern();
$category = osc_search_category_id();
$category = ((count($category) == 1) ? $category[0] : '');
$b_show_all = ($pattern == '' && $category == '' && $region == '' && $city == '');
$b_category = ($category != '');
$b_pattern = ($pattern != '');
$b_region = ($region != '');
$b_city = ($city != '');
$b_location = ($b_region || $b_city);
// show all
if( $b_show_all ) {
$l = array('title' => $this->title['search']);
$this->addLevel($l);
break;
}
// category
if( $b_category ) {
$aCategories = Category::newInstance()->toRootTree($category);
foreach( $aCategories as $c ) {
View::newInstance()->_erase('categories');
View::newInstance()->_erase('subcategories');
View::newInstance()->_exportVariableToView('category', $c);
$l = array(
'url' => osc_search_category_url(),
'title' => osc_category_name()
);
$this->addLevel($l);
}
}
// location
if( $b_location ) {
$params = array();
if( $b_category ) {
$params['sCategory'] = $category;
}
if( $b_city ) {
$aCity = array();
if($b_region) {
$_region = Region::newInstance()->findByName($region);
if(isset($_region['pk_i_id'])) {
$aCity = City::newInstance()->findByName($city, $_region['pk_i_id']);
}
} else {
$aCity = City::newInstance()->findByName($city);
}
if( count($aCity) == 0 ) {
$params['sCity'] = $city;
$l = array(
'url' => osc_search_url($params),
'title' => $city
);
$this->addLevel($l);
} else {
$aRegion = Region::newInstance()->findByPrimaryKey($aCity['fk_i_region_id']);
$params['sRegion'] = $aRegion['s_name'];
$l = array(
'url' => osc_search_url($params),
'title' => $aRegion['s_name']
);
$this->addLevel($l);
$params['sCity'] = $aCity['s_name'];
$l = array(
'url' => osc_search_url($params),
'title' => $aCity['s_name']
);
$this->addLevel($l);
}
} else if( $b_region ) {
$params['sRegion'] = $region;
$l = array(
'url' => osc_search_url($params),
'title' => $region
);
$this->addLevel($l);
}
}