Advertisement:

Author Topic: Countries, Regions and cities not corresponding - database issue?  (Read 4009 times)

venus

  • Newbie
  • *
  • Posts: 23
Country, regions and cities correspond perfectly when I have only one country on my site. When I add other countries everything goes haywire. For example if I have countries A, B, C......Z regardless of what country I select I see country A regions only. How do I solve this? Quite a few people have asked this question but they have always been referred to http://doc.osclass.org/Changing_between_drop-down_and_autocomplete_for_locations which has not worked for me.

Does this have to do with the database? I noticed that the value for b_active is 1 for every country. Should that be changed so each country gets a different b_active value? Need your input. Thanks.
« Last Edit: December 10, 2014, 08:12:55 pm by venus »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Countries, Regions and cities not corresponding - database issue?
« Reply #1 on: December 10, 2014, 10:11:26 pm »
Hi,

Look at Locations on your Admin Panel / Settings. If you can see there that each country has its own regions, the problem is not in the database. BTW, b_active is a binary switch: 0 = deactivated, any other value = active.

I think your problem resides in that procedure for dropdown and autocomplete being obsolete, because you're not the first one pointing out an issue with that. Please tell me your Osclass version and theme you're using (also with version, look at the first lines of your theme/index.php), I will try to reproduce it and find a solution...

Regards

venus

  • Newbie
  • *
  • Posts: 23
Re: Countries, Regions and cities not corresponding - database issue?
« Reply #2 on: December 10, 2014, 11:37:10 pm »
Teseo, thanks. Cool! it's not a database issue. I'm using Osclass 3.5.2 and real estate theme 2.0.0

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Countries, Regions and cities not corresponding - database issue?
« Reply #3 on: December 11, 2014, 12:17:09 am »
***CORRECTED***

Try following the procedure described there, but where it's written

Code: [Select]
<?php ItemForm::region_select(osc_get_regions(osc_user_country_code()), osc_user()) ; ?>
use instead:

Code: [Select]
<?php ItemForm::region_select(osc_get_regions(osc_user_country()), osc_user()) ; ?>
and tell me if it works (didn't test myself, but that osc_user_country_code() function must have been gone many versions ago).

Regards
« Last Edit: January 19, 2016, 01:47:18 pm by teseo »

venus

  • Newbie
  • *
  • Posts: 23
Re: Countries, Regions and cities not corresponding - database issue?[SOLVED]
« Reply #4 on: December 11, 2014, 04:06:48 pm »
Teseo, thanks for detecting that obsolete culprit code <?php ItemForm::region_select(osc_get_regions(osc_user_country_code()), osc_user()) ; ?> in http://doc.osclass.org/Changing_between_drop-down_and_autocomplete_for_locations You did it. Let me recap this for those who may need it.

The following worked like a charm in Osclass 3.5.2, real estate theme 2.0.0 and should work in other older Osclass and themes:

 in /oc-content/themes/realestate/item-post.php you should have
<?php ItemForm::region_select(osc_get_regions(), osc_user()) ; ?> and
<?php ItemForm::city_select(osc_get_cities(), osc_user()); ?>


in /oc-content/themes/realestate/item-edit.php you should have
<?php ItemForm::region_select(osc_user()) ; ?> and
<?php ItemForm::city_select(osc_user()); ?>

regards
« Last Edit: December 13, 2014, 09:24:40 pm by venus »

Aficionado

  • Guest
Re: Countries, Regions and cities not corresponding - database issue?
« Reply #5 on: May 06, 2015, 06:42:09 pm »
Is that

Quote
oc-admin/themes/modern/items/frm.php

needed for Bender ? I mean, it refers to modern theme ...


teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Countries, Regions and cities not corresponding - database issue?
« Reply #6 on: May 06, 2015, 07:47:45 pm »
Hm... You're right. Well, in that case seems that all that frm.php block is not needed anymore for this working basically (still if you already had selected a city, it won't change on region change, and region/city the same when you change country, but the list of available locations do change).

So, as far as I can see, only item-post.php (and item-edit.php for themes with different structure than Bender) must be modified (taking care of replacing the obsolete country helper). And that little issue I mentioned might be solved with some little changes in Javascript code.

Regards


Aficionado

  • Guest
Re: Countries, Regions and cities not corresponding - database issue?
« Reply #7 on: May 06, 2015, 07:50:24 pm »
Hm... You're right. Well, in that case seems that all that frm.php block is not needed anymore for this working basically (still if you already had selected a city, it won't change on region change, and region/city the same when you change country, but the list of available locations do change).

So, as far as I can see, only item-post.php (and item-edit.php for themes with different structure than Bender) must be modified (taking care of replacing the obsolete country helper). And that little issue I mentioned might be solved with some little changes in Javascript code.

Regards

I have spend a lot of time to make this to work on a Bender-based theme. And i have failed no matter what. It IS working in my website for 2 years now with Modern theme, it is working with stock Bender (i have tried it) but it doesn't work in that theme. I'm lost.