Customer Report from (cvtsoft : 834.832)

Number to show after search is set to 25.
Enabled Pagination is checked.
Pages are not showing up when results are returned.

Pagination Not Working (SaaS Embed) — Resolution

We identified that pagination itself was being generated correctly, but the click action failed in SaaS embed mode because the Next/Previous links call javascript:SLPPREMIER..., and SLPPREMIER was not available as a global in that runtime.

In standalone WordPress, scripts load in a normal global context, so pagination works. In SaaS, scripts are bundled and executed through the loader (location.js + eval()), which can leave const SLPPREMIER scoped to eval execution instead of window.

Resolution: update the SaaS wiring so pagination does not depend on javascript: global calls (preferred: bind click handlers via JS events), or explicitly expose required add-on namespaces/settings to window before pagination links are used.

Result: this resolves the ReferenceError: Can't find variable: SLPPREMIER and restores Next/Previous pagination behavior.

Research

Setup

Setting: enable_pagination (set to 1).
Set initial results returned to 5.
Set after-search results to 5.
Radius to 1,000 miles.
Display Initial Directory is enabled.


02/25/2026 Updates

Testing: Local SaaS
https://local.storelocatorplus.com/costarica_at_storelocatorplus_dot_com/wp-admin/admin.php?page=myslp-dashboard&tab=deployment

The Costa Rica user has more than 5 locations available.

Go to Generate Embed.

The More Locations: default text for pagination is rendered along with a “>” to go to the next page.
Clicking “>” does nothing.

__

In the developer console I see a few issues, but the primary issue is likely this one:

ReferenceError: Can’t find variable: SLPPREMIER

__

Hovering over the “>” in Safari browser with developer tools open shows a tool tip:
Run script “SLPPREMIER.location_list.get_next_page();”

Since SLPPREMIER is undefined this is a problem. The JavaScript for the Premier plugin userinterface should be loaded via the front-end calls through locations.js as part of a data fetch that returns a script payload to be evaluated.

The autocomplete in the JavaScript console on the browser shows other JavaScript variables starting with SLP but not SLPPREMIER. For example, these are listed:
SLPWJS
slp
slp_Filter
slp_Map
slp_Makrer
slpexperience

The script stack is loaded via a call to this URL:
https://local.storelocatorplus.com/costarica_at_storelocatorplus_dot_com/wp-json/myslp/v2/locations-map?callback=initMySLP&action=get_myslp_data&api_key=myslp.ab2819c816bc2c927ebcdfc6cd23e9989ef68053b78af1f35342444df93fe272&attributes%5Bpresentation%5D=map&attributes%5Blocator_page%5D=__SELF__&_jsonp=initMySLP&_=1772052466405

Note: the username (costarica_at_storelocatorplus_dot_com), the api_key, and the _ values are all unique to this user session.

The value returned by that URL call is in the attached scratch.json file. In that file I see the SLPPREMIER variable.

This call in locations.js should evaluate the JSON payload:
_this.map_script = JSON.parse(response.options.map_script);
With this call:
const didEval = eval(this.map_script);

Which should, in theory evalute the contents of the options.map_script variable which contains all of the JavaScript we render on the front-end.

If the map_script payload is correct, that should result in the variable SLPPREMIER being set.

Dev Notes

Generate Embed (load) is calling \SLP_Premier_AJAX::add_ajax_hooks()
Find Locations (search) is NOT calling \SLP_Premier_AJAX::add_ajax_hooks()

Turns out the MySLP_REST_API was not initializing the add on modules for search mode, only load mode… patched in Dashboard 2503.05.03

Front End Processing

Now that the response is including the pagination we need to figure out why the JavaScript is not rendering/processing it.

This should be bundled into the front end processing as an inline include of wp-content/plugins/slp-premier/js/slp-premier_userinterface.js

JavaScript: SLPPREMIER.location_list.add_pagination() should manage this.

Backend Data Handling

The two primary pagination handlers are from here:

\SLP_Premier_AJAX_Pagination::modify_sql_for_pagination()
attached to hook ‘slp_ajaxsql_fullquery’

\SLP_Premier_AJAX_Pagination::modify_ajax_response()
attached to hook ‘slp_ajax_response’

Hooking modify_ajax_response

REST ROUTE: myslp/v2/locations-map/search

Call Stacks

After patch — the search and initial results are sending back pagination data to the front end.

load

SLP_Premier_AJAX.php:51, SLP_Premier_AJAX->add_ajax_hooks()
base_class.ajax.php:86, SLP_BaseClass_AJAX->do_ajax_startup()
base_class.ajax.php:53, SLP_BaseClass_AJAX->initialize()
SLP_Premier_AJAX.php:30, SLP_Premier_AJAX->initialize()
base_class.object.php:27, SLPlus_BaseClass_Object->__construct()
base_class.object.php:84, SLPlus_BaseClass_Object::get_instance()
MySLP_REST_API.php:721, MySLP_REST_API->get_map_locations()
MySLP_REST_API.php:296, MySLP_REST_API->search_map()
MySLP.php:265, MySLP->rest_dispatch_request_filter()
class-wp-hook.php:324, WP_Hook->apply_filters()
plugin.php:205, apply_filters()
class-wp-rest-server.php:1187, WP_REST_Server->respond_to_request()
class-wp-rest-server.php:1041, WP_REST_Server->dispatch()
class-wp-rest-server.php:431, WP_REST_Server->serve_request()
rest-api.php:424, rest_api_loaded()
class-wp-hook.php:324, WP_Hook->apply_filters()
class-wp-hook.php:348, WP_Hook->do_action()
plugin.php:565, do_action_ref_array()
class-wp.php:418, WP->parse_request()
class-wp.php:813, WP->main()
functions.php:1336, wp()
wp-blog-header.php:16, require()
index.php:17, {main}()

search

SLP_Premier_AJAX.php:51, SLP_Premier_AJAX->add_ajax_hooks()
base_class.ajax.php:86, SLP_BaseClass_AJAX->do_ajax_startup()
base_class.ajax.php:53, SLP_BaseClass_AJAX->initialize()
SLP_Premier_AJAX.php:30, SLP_Premier_AJAX->initialize()
base_class.object.php:27, SLPlus_BaseClass_Object->__construct()
base_class.object.php:84, SLPlus_BaseClass_Object::get_instance()
MySLP_REST_API.php:721, MySLP_REST_API->get_map_locations()
MySLP_REST_API.php:296, MySLP_REST_API->search_map()
MySLP.php:265, MySLP->rest_dispatch_request_filter()
class-wp-hook.php:324, WP_Hook->apply_filters()
plugin.php:205, apply_filters()
class-wp-rest-server.php:1187, WP_REST_Server->respond_to_request()
class-wp-rest-server.php:1041, WP_REST_Server->dispatch()
class-wp-rest-server.php:431, WP_REST_Server->serve_request()
rest-api.php:424, rest_api_loaded()
class-wp-hook.php:324, WP_Hook->apply_filters()
class-wp-hook.php:348, WP_Hook->do_action()
plugin.php:565, do_action_ref_array()
class-wp.php:418, WP->parse_request()
class-wp.php:813, WP->main()
functions.php:1336, wp()
wp-blog-header.php:16, require()
index.php:17, {main}()

Notes…


$this->slplus->SmartOptions->is_true( 'pagination_enabled' ) is true
Calling...
add_filter( 'slp_ajaxsql_fullquery', array( $pagination, 'modify_sql_for_pagination' ) );

modify_sql_for_pagination is called, but $_REQUEST[‘page’] is empty.

\SLP_Premier_AJAX_Pagination::modify_sql_for_pagination()

Handles moving between pages once the pages are rendered.

\SLP_Premier_AJAX_Pagination::modify_ajax_response()

Handles crafting the modified response with HTML etc. for pagination.

Response [‘premier’][‘pagination_block’] is set…

The front end is receiving the premier response value:

/**/
initMySLP({
    "data": {
        "success": true,
        "slp_version": "2503.05.02",
        "data_queries": {
            "standard_location_search": {
                "query_slugs": ["selectall_with_distance", "where_default_validlatlong"],
                "query": "SELECT *,( 3959 * acos( cos( radians( 34.043925 ) ) * cos( radians( sl_latitude ) ) * cos( radians( sl_longitude ) - radians( -118.242429 ) ) + sin( radians( 34.043925 ) ) * sin( radians( sl_latitude ) ) ) ) AS sl_distance  FROM wp_832_store_locator  LEFT JOIN wp_832_slp_extendo USING(sl_id)  WHERE   sl_latitude REGEXP '^[0-9]|-' AND sl_longitude REGEXP '^[0-9]|-'  AND  ( NOT sl_private OR sl_private IS NULL)     HAVING (sl_distance < 200.000000) OR (sl_distance IS NULL)  ORDER BY sl_distance asc LIMIT 25",
                "params": [3959, "34.043925", "-118.242429", "34.043925", "200", "25"],
                "locations": {
                    "pre-filter": 25,
                    "filtered": 25
                }
            }
        },
        "count": 25,
        "type": "search",
        "http_query": {
            "callback": "initMySLP",
            "action": "csl_ajax_search",
            "address": "90013",
            "formdata": "nameSearch=&addressInput=90013&addressInputCity=&addressInputState=&addressInputCountry=&ignore_radius=0",
            "lat": "34.043925",
            "lng": "-118.242429",
            "options": {
                "map_center_lat": "37.09024000",
                "map_center_lng": "-95.71289100",
                "city": "",
                "country": "",
                "distance_unit": "miles",
                "ignore_radius": "0",
                "initial_radius": "",
                "map_domain": "maps.google.com",
                "map_end_icon": "https:\/\/local.storelocatorplus.com\/john_at_cvtsoftserve_dot_com\/wp-content\/mu-plugins\/store-locator-plus\/images\/icons\/bulb_azure.png",
                "state": "",
                "territory": ""
            },
            "radius": "200",
            "nonce": "d47fb592a4",
            "api_key": "myslp.e0db54d191521ffc7b7908019919af0340185260666a814397a7ecde7dedab66",
            "_jsonp": "initMySLP",
            "_": "1741202325419"
        },
        "response": [{
            "name": "Dash Mart on Doordash delivers to 90013",
            "address": "",
            "address2": "",
            "city": "",
            "state": "",
            "zip": "90013",
            "country": "USA",
            "lat": "34.0445905",
            "lng": "-118.2405557",
            "description": "",
            "url": "https:\/\/www.doordash.com\/search\/store\/CVT%20soft%20serve\/",
            "sl_pages_url": "https:\/\/dashboard.storelocatorplus.com\/john_at_cvtsoftserve_dot_com\/?post_type=store_page&#038;p=14851",
            "email": "",
            "email_link": "",
            "hours": "",
            "phone": "",
            "fax": "",
            "image": "",
            "distance": "0.11669715301840718",
            "tags": "",
            "option_value": "",
            "attributes": "",
            "id": "7633",
            "linked_postid": "14851",
            "neat_title": "",
            "data": {
                "sl_id": "7633",
                "sl_store": "Dash Mart on Doordash delivers to 90013",
                "sl_address": "",
                "sl_address2": "",
                "sl_city": "",
                "sl_state": "",
                "sl_zip": "90013",
                "sl_country": "USA",
                "sl_latitude": "34.0445905",
                "sl_longitude": "-118.2405557",
                "sl_tags": "",
                "sl_description": "",
                "sl_email": "",
                "sl_url": "https:\/\/www.doordash.com\/search\/store\/CVT%20soft%20serve\/",
                "sl_hours": "",
                "sl_phone": "",
                "sl_fax": "",
                "sl_image": "",
                "sl_private": "",
                "sl_neat_title": "",
                "sl_linked_postid": "14851",
                "sl_pages_url": "https:\/\/dashboard.storelocatorplus.com\/john_at_cvtsoftserve_dot_com\/?post_type=store_page&p=14851",
                "sl_pages_on": "",
                "sl_option_value": "",
                "sl_initial_distance": "0.5577071875",
                "sl_lastupdated": "2024-12-05 00:56:07",
                "id": "5349",
                "featured": "0",
                "rank": null,
                "marker": null,
                "sl_distance": "0.11669715301840718",
                "in_territory": "0",
                "in_territory_class": ""
            },
            "city_state_zip": "90013",
            "zip_state_city": "<span class=\"slp_zip\">90013<\/span>",
            "web_link": "<a href='https:\/\/www.doordash.com\/search\/store\/CVT%20soft%20serve\/' target='_blank' class='storelocatorlink'>Website<\/a><br\/>",
            "url_link": "<a href='https:\/\/www.doordash.com\/search\/store\/CVT%20soft%20serve\/' target='_blank' class='storelocatorlink'>https:\/\/www.doordash.com\/search\/store\/CVT%20soft%20serve\/<\/a><br\/>",
            "contact_image_html": "",
            "categories": [],
            "category_count": 0,
            "category_names": "",
            "icon": "",
            "iconarray": "",
            "exdata": {
                "featured": "0"
            },
            "featured": "0",
            "rank": ""
        }, 
... <MORE ENTRIES> ...
 {
            "name": "Food 4 Less Olympic &amp; Calada",
            "address": "3654 E Olympic Blvd",
            "address2": "",
            "city": "Los Angeles",
            "state": "CA",
            "zip": "90023",
            "country": "USA",
            "lat": "34.0178978",
            "lng": "-118.1983966",
            "description": "",
            "url": "https:\/\/www.food4less.com\/",
            "sl_pages_url": "https:\/\/dashboard.storelocatorplus.com\/john_at_cvtsoftserve_dot_com\/?post_type=store_page&#038;p=15403",
            "email": "",
            "email_link": "",
            "hours": "",
            "phone": "",
            "fax": "",
            "image": "",
            "distance": "3.0971018704816133",
            "tags": "",
            "option_value": "",
            "attributes": "",
            "id": "7909",
            "linked_postid": "15403",
            "neat_title": "",
            "data": {
                "sl_id": "7909",
                "sl_store": "Food 4 Less Olympic & Calada",
                "sl_address": "3654 E Olympic Blvd",
                "sl_address2": "",
                "sl_city": "Los Angeles",
                "sl_state": "CA",
                "sl_zip": "90023",
                "sl_country": "USA",
                "sl_latitude": "34.0178978",
                "sl_longitude": "-118.1983966",
                "sl_tags": "",
                "sl_description": "",
                "sl_email": "",
                "sl_url": "https:\/\/www.food4less.com\/",
                "sl_hours": "",
                "sl_phone": "",
                "sl_fax": "",
                "sl_image": "",
                "sl_private": "",
                "sl_neat_title": "",
                "sl_linked_postid": "15403",
                "sl_pages_url": "https:\/\/dashboard.storelocatorplus.com\/john_at_cvtsoftserve_dot_com\/?post_type=store_page&p=15403",
                "sl_pages_on": "",
                "sl_option_value": "",
                "sl_initial_distance": "3.5148171889",
                "sl_lastupdated": "2024-12-05 00:57:23",
                "id": "5625",
                "featured": "0",
                "rank": null,
                "marker": null,
                "sl_distance": "3.0971018704816133",
                "in_territory": "0",
                "in_territory_class": ""
            },
            "city_state_zip": "Los Angeles, CA 90023",
            "zip_state_city": "<span class=\"slp_zip\">90023<\/span> <span class=\"slp_state\">CA<\/span> <span class=\"slp_city\">Los Angeles<\/span>",
            "web_link": "<a href='https:\/\/www.food4less.com\/' target='_blank' class='storelocatorlink'>Website<\/a><br\/>",
            "url_link": "<a href='https:\/\/www.food4less.com\/' target='_blank' class='storelocatorlink'>https:\/\/www.food4less.com\/<\/a><br\/>",
            "contact_image_html": "",
            "categories": [],
            "category_count": 0,
            "category_names": "",
            "icon": "",
            "iconarray": "",
            "exdata": {
                "featured": "0"
            },
            "featured": "0",
            "rank": ""
        }],
        "premier": {
            "pagination_block": "<div class=\"results_pagination\"><span class=\"pagination_label\">More Locations: <\/span><a id=\"next-locations-page\" href=\"javascript:SLPPREMIER.location_list.get_next_page();\" title='Next Page' ><span class=\"dashicons dashicons-arrow-right-alt2\"><\/span><\/a><\/div>",
            "search_coordinates": "34.043925,-118.242429",
            "options": {
                "category_name_separator": ", ",
                "boundaries_influence_min_lat": "26.685477",
                "boundaries_influence_min_lng": "-151.048852",
                "boundaries_influence_max_lat": "64.854018",
                "boundaries_influence_max_lng": "-71.036289",
                "dropdown_autosubmit": "0",
                "installed_version": "2503.05.01",
                "pagination_label": "More Locations: ",
                "show_address_guess": "0",
                "show_location_on_order_email": "1",
                "woo_data_version": "0"
            }
        }
    },
    "warnings": "\"\""
})