*

morfik

  • ****
  • 169 posts
The select citiy box shows only part of cities available
« on: March 10, 2023, 05:08:18 PM »
When I wanted to edit some listing to fix the city field (because it was empty, because of the previous database), I noticed that the list of cities is rather short -- I mean it's pretty long and alphabetically sorted, but it ends on cities that start with p or t character. When I change the region in the box above (in the edit listing page, User information) to some other one, and then I select the right region, and go to the city box, the list of cities is fully loaded.

So what could be wrong with it? Should I change something somewhere?

*

MB Themes

Re: The select citiy box shows only part of cities available
« Reply #1 on: March 10, 2023, 07:47:31 PM »
There might be limit on select boxes to avoid lags... If it is select box
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

morfik

  • ****
  • 169 posts
Re: The select citiy box shows only part of cities available
« Reply #2 on: March 10, 2023, 08:04:56 PM »
Is there a way to increase this limit? The city list is full when I reselect the region.

*

MB Themes

Re: The select citiy box shows only part of cities available
« Reply #3 on: March 11, 2023, 12:48:36 PM »
It is in one of model files probably.. there were problems in past by non-limiting this
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

morfik

  • ****
  • 169 posts
Re: The select citiy box shows only part of cities available
« Reply #4 on: March 11, 2023, 03:14:54 PM »
I couldn't find anything useful...

*

MB Themes

Re: The select citiy box shows only part of cities available
« Reply #5 on: March 15, 2023, 01:53:13 PM »
I cannot find it either so maybe it was removed meanwhile!
If you think there is limit, you can check data returned from ajax (network tab of browser) and log database queries to file and review them.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

morfik

  • ****
  • 169 posts
Re: The select citiy box shows only part of cities available
« Reply #6 on: March 15, 2023, 02:34:20 PM »
I'm not sure whether it's limited or it's just a bug in that it shows limited number of entries when the page is loaded, because when I reselect the region, the list of cities has all of the entries, so in this case there is no limit and all cities are returned. So it looks like a bug, and not a limit per se. I counted the cities when they are limited, and it looks like that it shows the first 1000 of them. Maybe that will help in targeting the bug.
« Last Edit: March 15, 2023, 02:35:58 PM by morfik »

*

MB Themes

Re: The select citiy box shows only part of cities available
« Reply #7 on: March 15, 2023, 02:42:58 PM »
Check thos equeries.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

morfik

  • ****
  • 169 posts
Re: The select citiy box shows only part of cities available
« Reply #8 on: March 15, 2023, 02:52:32 PM »
What should I do exactly? :D

*

MB Themes

Re: The select citiy box shows only part of cities available
« Reply #9 on: March 15, 2023, 03:39:38 PM »
Enable query debugging and saving queries to debug file. Then run city select and check that file for generated queries. One of them should have limit
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

morfik

  • ****
  • 169 posts
Re: The select citiy box shows only part of cities available
« Reply #10 on: March 15, 2023, 04:03:51 PM »
If I understood you well, I should set the following in the config.php file:

Code: [Select]
define('OSC_DEBUG', true);             // show PHP error logs and notices
 define('OSC_DEBUG_LOG', true);         // save PHP errors & logs to oc-content/debug.log

If so, the file oc-content/queries.log doesn't exist (I've run city select).

*

MB Themes

Re: The select citiy box shows only part of cities available
« Reply #11 on: March 16, 2023, 11:29:16 AM »
These are for PHP.
You look for database:
Code: [Select]
define('OSC_DEBUG_DB', true) ;
define('OSC_DEBUG_DB_LOG', true)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

morfik

  • ****
  • 169 posts
Re: The select citiy box shows only part of cities available
« Reply #12 on: March 16, 2023, 01:21:02 PM »
Ok so what should I look for?

I see some queries with LIMIT, but they concerns tables: oc_t_item, oc_t_latest_searches and oc_t_pages . But there's nothing about cities/regions. The only query about city is this:

Code: [Select]
SELECT pk_i_id, fk_i_region_id, s_name, s_name_native, fk_c_country_code, b_active, s_slug, d_coord_lat, d_coord_long
FROM (oc_t_city)
WHERE fk_i_region_id = '3858788'
ORDER BY s_name ASC

So, it should return all cities with region ID 3858788, which is a valid region ID existing in database. When I've run this query in phpmyadmin, I got 5 pages (each with 500 cities) with this ID. So the query works just fine.  But when I click on the select field in the dashboard>listings>Edit ad page, the select list of cities is incomplete and it looks like that it has <=1000 cities. Reselecting the region fixes this, and the list of cities is complete. But it's never complete after loading the edit page.
« Last Edit: March 16, 2023, 01:32:43 PM by morfik »

*

MB Themes

Re: The select citiy box shows only part of cities available
« Reply #13 on: March 16, 2023, 02:49:02 PM »
Ok so limit is not on query/database.

Limit is on oc-includes/osclass/frm/Form.form.class.php:
Code: [Select]
  protected static function generic_select( $name , $items , $fld_key , $fld_name , $default_item , $id, $limit = 1000 ) {

Will be updated to 2500 in 8.1.2
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

morfik

  • ****
  • 169 posts
Re: The select citiy box shows only part of cities available
« Reply #14 on: March 16, 2023, 02:55:55 PM »
Yes, this is it. I changed it to 10.000 and now all the cities are visible.

It looks like it also fixed the error with missing city while editing ads. I assume, when the city list was capped to 1K, there was no such city to display, and it simply was unset. :D

Would it be possible to use filters in this city fields in edit ad page?
« Last Edit: March 16, 2023, 02:58:35 PM by morfik »