• Hello,

    I am continually getting a server error with the plugin (i’ve used the plugin before to great success on other sites we’ve built). Here’s the page where we have WP Locator working (or not working, as it were): https://www.beckettcorp.com/find-a-beckett-distributor/

    We’ve turned off all other plugins and even switched the theme (it’s using the DIVI theme) to see if we could get it to work and nothing worked. The only think that seemed to get it to work was to completely delete it from the site and re-install… which was problematic because we had to then re-import all 3,200 locations as well. And even after doing all that, it seemed to work for a couple of days and now i’m getting the same error. The console says the error is:

    Failed to load resource: the server responded with a status of 500 () https://www.beckettcorp.com/wp-admin/admin-ajax.php?action=store_search&lat=41.38949&lng=-82.01903&max_results=25&search_radius=50&autoload=1

    I spoke to WP Engine (hosting the site) about the potential issue with the access to admin-ajax.php being blocked as noted in your documentation: https://wpstorelocator.co/document/map-does-not-load-no-results/#admin-ajax-blocked

    They told me that the admin-ajax.php being blocked is not, indeed, the issue in this case — rather, they are pointing to a PHP Fatal error which they mentioned i needed to send your way:

    68 PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /nas/content/live/beckettcorp/wp-content/plugins/wp-store-locator/frontend/class-frontend.php:560

    Please let me know what i need to do to get this fixed on the site when you get a sec.

    Thank you.

    Daniel

    • This topic was modified 1 year, 10 months ago by ata380.
    • This topic was modified 1 year, 10 months ago by ata380.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi there!

    We are aware of this issue happening to some users in some occasions. Long story short, in some edge cases, something that should be an array turns out to be a <null> value.

    Please do this change in the contents of line 560 in the frontend/class-frontend.php file from:

    $hour_count = count( $hours[$index] );

    to

    $hour_count = ( is_array( $hours ) && array_key_exists( $index, $hours ) ) ? count( $hours[$index] ) : 0;

    This is actually a small but annoying bug, and it will be fixed in the upcoming v3.0 of wp store locator, which will be released soon. I will remind the dev team, though, in case they consider releasing a hotfix for this in the current version.

    Let me know if you need help implementing the mentioned change.

    Apologies!

    Thread Starter ata380

    (@ata380)

    Thank you so much for your help… that seemed to do the trick!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fatal error: Uncaught TypeError: count(): Argument #1’ is closed to new replies.