Support » Plugin: Store Locator Plus for WordPress » Search/edit problem in admin

  • Resolved katiewp


    v3.8.9. I got the Pro Pack today and imported all the locations (close to 600). In admin’s Manage Locations, when I type in the location’s name to search, the search result returns, but when I click on edit on one of the locations, it goes back to the first page of the entire list.

    The only time it works as it’s supposed to is if the location is listed on the page that I was on when I issued a search query. I have it set to show 25/page, sorted by name in alphabetical order.

    Example: I click on Manage Locations which takes me to page 1 of 21 that lists 25 locations that start with an A. I search for a name that begins with a P which is on page 17 of 21. I click Edit on a location I want to edit, but it takes me back to the first page of the entire list (25 locations that start with an A). But if I happened to be on page 17 already when I issue the same search, then clicking Edit will jump to the edit mode of the the correct location.


Viewing 5 replies - 1 through 5 (of 5 total)
  • I have this exact same issue. I have 1400 locations to manage, so navigating to each individual page to make the change is a pain.

    When I have more time this afternoon I’ll try to poke into the code to diagnose, but for now, consider this a “CONFIRMED”.

    Running WordPress 3.5.1
    StoreLocator Plus Version 3.8.12 with ProPack

    I have found and produced a fix for this issue. Here’s the diff if you want to edit the code yourself:

    diff -rupN include_old/slp-adminui_managelocations_class.php include/slp-adminui_managelocations_class.php
    --- include_old/slp-adminui_managelocations_class.php   2013-01-31 15:39:35.000000000 -0800
    +++ include/slp-adminui_managelocations_class.php   2013-01-31 15:42:53.000000000 -0800
    @@ -556,13 +556,16 @@ if (! class_exists('SLPlus_AdminUI_Manag
                                 __("View", SLPLUS_PREFIX)."</a>" :
                                 "" ;
    +                        $editlink = str_replace('&edit='.(isset($_GET['edit'])?$_GET['edit']:''), '', $_SERVER['REQUEST_URI']);
    +                        $editlink = str_replace('&q='.$qry, '', $editlink);
    +                        $editlink .= '&edit='.$locID.(!empty($qry) ? '&q='.urlencode($qry) : '').'#a'.$locID;
                             "<tr style='background-color:$bgcol'>" .
                                 "<th><input type='checkbox' name='sl_id[]' value='$locID'></th>" .
                                 "<th class='thnowrap'>".
                                 "<a class='action_icon edit_icon' alt='".__('edit',SLPLUS_PREFIX)."' title='".__('edit',SLPLUS_PREFIX)."'
    -                                href='".preg_replace('/&edit='.(isset($_GET['edit'])?$_GET['edit']:'').'/', '',$_SERVER['REQUEST_URI']).
    -                            "&edit=" . $locID ."#a$locID'></a>".
    +                                href='".$editlink."'></a>".
                                 " " .
                                 "<a class='action_icon delete_icon' alt='".__('delete',SLPLUS_PREFIX)."' title='".__('delete',SLPLUS_PREFIX)."'
                                     href='".$_SERVER['REQUEST_URI']."&delete=$locID' " .
    diff -rupN include_old/storelocatorplus-adminui_class.php include/storelocatorplus-adminui_class.php
    --- include_old/storelocatorplus-adminui_class.php  2013-01-31 15:39:35.000000000 -0800
    +++ include/storelocatorplus-adminui_class.php  2013-01-31 15:42:55.000000000 -0800
    @@ -561,7 +561,7 @@ if (! class_exists('SLPlus_AdminUI')) {
                 $prev = min(max(0,$start-$num_per_page),$totalLocations);
                 $next = min(max(0,$start+$num_per_page),$totalLocations);
                 $qry = isset($_GET['q'])?$_GET['q']:'';
    -            $cleared=preg_replace('/q=$qry/', '', $_SERVER['REQUEST_URI']);
    +            $cleared=preg_replace('/&q=[^&]*/', '', $_SERVER['REQUEST_URI']);
                 $extra_text=(trim($qry)!='')    ?
                     __("for your search of", SLPLUS_PREFIX).

    A safe way to apply this is to make sure you’re running the latest version of the plugin first (3.8.12), then switch into the wp-content/plugins/store-locator-le directory, copy and paste the above code into a file in that directory called changes.diff and then run the following command:

    patch -p0 < changes.diff
    Plugin Author Store Locator Plus


    There is a patch I am testing with 3.8.13 that is more extensive. The problem goes beyond edit and to the basic manner in which URLs are constructed in the manage locations module. I spent a good bit of time cleaning that up in the 3.8.13 build, though still not perfect it is a big step in the right direction.

    I hope to finish testing 3.8.13 soon. If anyone wants a pre-release copy you can fetch it here, but be warned I’ve not tested it yet other than on my development system:

    Store Locator Plus 3.8.13 RC1

    Thanks for the reply! I just handed off my project that I was working on, bit I appreciate the download link. Glad to hear something is in the works. I did notice there’s a few edge cases as well, beyond what I reported, such as trying to edit an entry after searching for un-geocoded results.

    Thanks again for reply and the product you offer.

    Your latest update fixed it. Thank you!!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Search/edit problem in admin’ is closed to new replies.