Hi All,
i need help to add countries instead of states on homepage.
this is main.php
<!DOCTYPE html>
<html dir="ltr" lang="<?php echo str_replace('_', '-', osc_current_user_locale()); ?>">
<head>
<?php osc_current_web_theme_path('head.php') ; ?>
<meta name="robots" content="index, follow" />
<meta name="googlebot" content="index, follow" />
</head>
<body>
<?php osc_current_web_theme_path('header.php') ; ?>
<?php osc_current_web_theme_path('inc.search.php') ; ?>
<div class="container margin-top-10">
<?php twitter_show_flash_message() ; ?>
</div>
<!-- content -->
<div class="container container-fluid latest_ads">
<div class="sidebar">
<div class="row">
</div>
<?php if ( !View::newInstance()->_exists('list_contries') ) {
View::newInstance()->_exportVariableToView('list_regions', Search::newInstance()->listRegions('%%%%', '>=', 'region_name ASC') ) ;
}
if( osc_count_list_regions() ) { ?>
<div class="row">
<div class="span4 columns">
<?php $conn = getConnection(); $aStates = $conn->osc_dbFetchResults("SELECT * FROM %st_city ", DB_TABLE_PREFIX); ?>
<?php if (count($aStates) >= 0 ) {?>
<?php foreach($aStates as $state) { ?>
<?php $paese = $state['fk_c_country_code']; ?>
<?php } ?><?php } ?>
<?php $aRegions = Region::newInstance()->getByCountry($paese); ?>
<h3><?php _e('Select state load city', 'twitter') ; ?></h3>
<?php if(count($aRegions) >= 0 ) { ?>
<select id="sRegion" name="sRegion" style="width:132px;" class="">
<option value="">Select a State</option>
<?php foreach($aRegions as $region) { ?>
<option id="idregioni" value="<?php echo $region['pk_i_id']; ?>"<?php if(Params::getParam('sRegion') == $region['pk_i_id']) { ?>selected<?php } ?>><?php echo $region['s_name'] ; ?></option>
<?php } ?>
</select><?php } ?>
<?php $regionId = $_GET[sRegion]; ?>
<?php $conn = getConnection(); $aCities = $conn->osc_dbFetchResults("SELECT * FROM %st_city WHERE fk_i_region_id = '$regionId'", DB_TABLE_PREFIX); ?>
<?php if (count($aCities) >= 0 ) {?>
<ul id="sCity" >
</ul>
<?php } ?>
</div>
</div>
<?php } ?>
</div>
<div class="catslist">
<?php while ( osc_has_categories() ) { ?>
<div class="category">
<h2><a class="category <?php echo osc_category_slug() ; ?>" href="<?php echo osc_search_category_url() ; ?>"><?php echo osc_category_name() ; ?></a> <span></span></strong></h2>
<?php if ( osc_count_subcategories() > 0 ) { ?>
<ul>
<?php while ( osc_has_subcategories() ) { ?>
<li><a class="category <?php echo osc_category_slug() ; ?>" href="<?php echo osc_search_category_url() ; ?>"><?php echo osc_category_name() ; ?></a> <span></span></li>
<?php } ?>
</ul>
<?php } ?>
</div>
<?php
if (($col==1 && $i==$col1_max_cat) || ($col==2 && $i==$col2_max_cat) || ($col==3 && $i==$col3_max_cat) || ($col==4 && $i==$col4_max_cat)) {
$i = 1;
$col++;
echo '</ul>';
if($x < $total_categories) {
echo '<ul class="col c'.$col.'">';
}
} else {
$i++ ;
}
$x++ ;
?>
<?php } ?>
</div>
<div style="clear:both"></div>
</div>
</div>
<?php osc_current_web_theme_path('footer.php') ; ?>
</body>
</html>