0 comments on “Power : Store Pages Not Working”

Power : Store Pages Not Working

Store Pages interfaces are not invoked.

Reproduction

Requires Power add on to be active.

  • Login as admin on WordPress (WP) site.
  • Go to Store Locator Plus® | Options
  • Enable Pages
  • Go to Store Locator Plus® | Locations
  • Choose Pages, Create from the bulk actions drop down menu
  • Click “to All” next to that menu

Issues

  • There is no “Pages” list in the sidebar
  • Each location shows a page attached, but if you scroll over to the Pages URL column on the location list page, view or edit does not work.
  • Edit brings up this error:
    Sorry, you are not allowed to edit posts in this post type.
0 comments on “Power : $slplus is null in UI handler”

Power : $slplus is null in UI handler

SLP should not allow the older version of Power (2511.06.01 or earlier) to run.

Got error 'PHP message: PHP Fatal error:  
Uncaught Error: Call to a member function addon() on null 
in /bitnami/wordpress/wp-content/plugins/slp-power/include/module/ui/SLP_Power_UI.php:41

From..

		global $slplus;
		$this->addon = $slplus->addon( 'power' );

Resolution

Must use Power 2511.06.02 with the latest version of SLP.

SLP had to be updated to test for the minimum version of the Power add on at 2511.06.02 or higher.

Power : Imports Are Not Working

On the WordPress Test Site (https://qc.storelocatorplus.com/) the Location Import feature of Store Locator Plus® for WordPress (SLP for WP) is not working.

Location import does work on the local Docker container.

Location import does work on staging and production versions of the SaaS application.

The version of the SLP, Power, Experience, and Premier plugins are the same on QC, localhost (the docker container), and the SaaS deployments.

Reproduction

  1. Login to the QC test server.
  2. Ensure the Store Locator Plus® and Power plugins are active.
  3. Go to Store Locator Plus | Locations on the sidebar menu.
  4. Click the import tab.
  5. Click the upload CSV button.
  6. Choose a sample CSV file like the one noted below.

Result

The import never starts. The progress meter never appears. No new locations that are in the CSV are added to the location list.

Expected Result

An import information window should show the circular loading progress meter and the location import count when finished. New locations appear on the location list.

Resolution

Status: Partially Resolved

Findings

Turns out that if a user downloads a new version of the Power add on (a zip file) and already has a prior version of the slp-power.zip file in the download directory on their laptop, the browser may create a new file named slp-power-2.zip without direct notification or confirmation it has done so.

If the user uploads this file to the WordPress installation it will create a NEW installation of the Power plugin at ./wp-content/plugins/slp-power-2/. This may or may not reside alongside a version of the older installation at ./wp-content/plugins/slp-power/ which is the standard installation path.

Even if a user deactivates and deletes the existing Power add on , which is best practice, before uploading the new slp-power-2.zip , the new path for the plugin will not match the prior path.

This causes the JavaScript for location imports included in the Power add on to not be loaded.

Workaround

Make sure the downloaded zip files for the plugin follow the standard naming convention:

  • SLP plugin should be named store-locator-plus.zip
  • Power add on should be named slp-power.zip

Deactivate and delete the installed versions of any plugins that are being updated.

Upload and install the most recent plugin zip file.

Meta

The Location Import feature is provided by the Power add on (a plugin that works with SLP for WP).

The issue is being tracked on the GitHub SLP project here:
https://github.com/Store-Locator-Plus/myslp_aws_ecs_kit/issues/35

Debugging

Check for JavaScript errors.

  1. 🔲 Import test with Power / Experience / Premier active using slp_test_at_slp_guru_locations CSV file shown below.

slp_test_at_slp_guru_locations.csv

sl_id,sl_store,sl_address,sl_address2,sl_city,sl_state,sl_zip,sl_country,sl_latitude,sl_longitude,sl_tags,sl_description,sl_email,sl_url,sl_hours,sl_phone,sl_fax,sl_image,sl_private,sl_neat_title,featured,rank,category,category_slug,contact,contact_address,contact_email,contact_fax,contact_image,county,department,district,facility_type,first_name,identifier,introduction,last_name,marker,mobile_phone,notes,office_hours,office_phone,region,territory,title,training,year_established
5136,"Amalfi's Italian Restaurant & Pizzeria","664 Long Point Rd",#E,"Mt Pleasant",SC,29464,,32.83928400,-79.85446600,,,,,,,,,,,0,,,,,,,,,,,,,,,,,,,,,,,,,,
5138,"The Wine Bar","664 Long Point Rd","Unit G","Mt Pleasant",SC,29464,,32.83930200,-79.85423300,,,,,,,,,,,0,,,,,,,,,,,,,,,,,,,,,,,,,,
5140,"Burtons Grill & Bar","1876 North Highway 17",,"Mt Pleasant",SC,29464,,32.83029500,-79.83291900,,,,,,,,,,,0,,,,,,,,,,,,,,,,,,,,,,,,,,

Info Gathering Toward Resolution

Path Disclosure

Searching for the difference in the URLs in the JavaScript:

  • Added additional information to the SLP | Info | Environment tab within the SLP plugin showing the plugin directory and path.
    • updated \SLP_REST_Environment::get() to add new environment variables
Site URLhttp://localhosthttp://qc.storelocatorplus.com
Store Locator Plus®2511.04.012511.04.01
Power2510.01.012510.01.01
Experience2510.02.012510.02.01
Premier2506.23.012506.23.01
SLP Network ActiveNoNo
WordPress Version6.8.36.8.3
WordPress Memory Limit40M40M
WordPress Max Memory Limit256M512M
PHP Version8.3.18.2.28
PHP Memory Limit128M512M
PHP Post Max Size64M80M
PHP Peak RAM6 MB8 MB
MySQL Version8.3.011.4.7
Plugin Directory/var/www/html/wp-content/plugins/store-locator-plus//bitnami/wordpress/wp-content/plugins/store-locator-plus/
Plugin URLhttp://localhost/wp-content/plugins/store-locator-plushttps://qc.storelocatorplus.com/wp-content/plugins/store-locator-plus

QC Versus Local HTML Sources

Partial Resolution

If you upload slp-power-12.zip to a WordPress site your new power directory will be ./wp-content/plugins/slp-power-12/

That is NOT and issue if you’ve NEVER had power installed before (my plugins detect whatever random directory you put in the first time).

However if you UPDATE an existing Power plugin that was already installed at wp-content/plugins/slp-power with a zip file named slp-power-12.zip the app will break. First of all you’ll likely end up with TWO power plugins listed in your plugin directory. Out of habit you will likely delete the older one, which inevitably will be the one in wp-content/plugins/slp-power, leaving the revised path of wp-content/plugins/slp-power-12/ as the new path.

Plugin Update Best Practices

Rename your zip files to the base name only:

  • store-locator-plus.zip (or store-locator-le.zip if you are an original old-school SLP user from version 5 or earlier)
  • slp-power.zip
  • slp-experience.zip
  • slp-premier.zip

If it won’t let you, sort folder on your computer by name and delete the old copies…. then rename the downloaded zip file t one of the above.

Install the properly named zip file on WordPress:

First delete the original plugin (deactivate/delete) then upload the new zip file.

This process MIGHT work with the inline update like the pic below, but some systems cannot handle the duplicate directory on the server automatically (some do, but not all) .   Thus it is safer to deactivate/delete first versus using the “fancy updater” that does an inline replace in WordPress.

The inline update process.

New Research : Reproduced On Localhost

I realized renaming the directory from slp-power to slp-power-2 (or 3) in the IDE will NOT change the mount point in the Docker container.  To change that the Docker composer file needs to change the mount point of the volumes.

I created a new composer file that mounts the wp-content/plugins/slp-power directory in the IDE (on the host laptop for Docker) to wp-content/plugins/slp-power-2 in the Docker container.

Shut down the prior Docker container and started a new container with the revised path.

Sure enough, the Power import breaks if the Power add on is NOT installed in ./wp-content/plugins/slp-power/

This indicates an error in the base plugin (SLP) or Power add on that is not allowing the install path to be flexible. It skips loading the required JavaScript library.

Work Toward Resolution

UX Update Show Directories

Let’s show the add on directory paths in the SLP | Info | Environment panel.

Updated \SLP_REST_Environment::get() to show the directory path for any add on directly underneath the plugin version.

Likely Culprit : \SLP_BaseClass_Admin::enqueue_admin_javascript

\SLP_BaseClass_Admin::enqueue_admin_javascript is the likely culprit which is NOT loading wp-content/plugins/slp-power/js/slppower-admin-locations-tab.js if the directory changes to wp-content/plugins/slp-power-2/js/slppower-admin-locations-tab.js

In the following code snippet from \SLP_BaseClass_Admin::enqueue_admin_javascript

		if ( $this->addon->short_slug === 'store-locator-le' ) {
			$base_name = 'slp';
		} else {
			$base_name = preg_replace( '/\W/', '', dirname( $this->addon->slug ) );
		}

Incoming data

$this->addon->slug = 'slp-power-2/slp-power.php'

Returns

$base_name = 'slppower2'

Which later means this code in \SLP_BaseClass_Admin::enqueue_admin_javascript

			case 'manage_locations':
				$files = array(
					'js/admin-locations-tab.min.js',
					'js/admin-locations-tab.js',
					'js/' . $base_name . '-admin-locations-tab.min.js',
					'js/' . $base_name . '-admin-locations-tab.js'
				);
				break;

Is looking for a file named ‘js/slppower2-admin-locations-tab.js’ which does not exist.

The fix via AI Assistant Claude Sonnet 4.5

In the following code snippet from \SLP_BaseClass_Admin::enqueue_admin_javascript

if ( $this->addon->short_slug === 'store-locator-le' ) {
$base_name = 'slp';
} else {
$base_name = preg_replace( '/\W/', '', $this->addon->short_slug);
}

Additional Fixes

In addition to the fix, I renamed wp-content/plugins/slp-power/js/slppower-admin-locations-tab.js to wp-content/plugins/slp-power/js/admin-locations-tab.js

This makes it more consistent with other plugins. It also allows \SLP_BaseClass_Admin::enqueue_admin_javascript to be simplified to:
case 'manage_locations':
$files = array( 'js/admin-locations-tab.min.js', 'js/admin-locations-tab.js' );
break;

Power 2511.05.01 now requires SLP 2511.05.01 with the primary fix being in the SLP main plugin.

AI Summary

⟨ΞPowerImports⟩ ≡ ⟨ΨPathDependency⟩ ⊢ ⟨ΔAssetEnqueue⟩

ΨRootCause:
  ⟨$base_name⟩ ← dirname(⟨slug⟩) ⇨ ⟨directory_name⟩
  IF ⟨install_path⟩ ≠ ⟨canonical_path⟩ THEN
    ⟨slug⟩ = 'slp-power-2/slp-power.php'
    ∴ dirname(⟨slug⟩) = 'slp-power-2'
    ∴ ⟨$base_name⟩ = 'slppower2'
    ∴ ⟨js_file⟩ = 'js/slppower2-admin-locations-tab.js' ↯ 404

ΩResolution:
  1. SLP_BaseClass_Admin.php:376
     BEFORE: $base_name = preg_replace('/\W/', '', dirname($this->addon->slug))
     AFTER:  $base_name = preg_replace('/\W/', '', $this->addon->short_slug)
     
  2. Normalize asset naming:
     RENAME: js/slppower-admin-locations-tab.js 
     TO:     js/admin-locations-tab.js
     
  3. Simplify enqueue logic:
     $files = ['js/admin-locations-tab.min.js', 'js/admin-locations-tab.js']

⊢ ⟨ΔPathIndependence⟩: Assets load correctly regardless of installation directory
⊢ ⟨ΔConsistency⟩: Standardized naming across all add-ons
⊢ ⟨ΔMaintainability⟩: Reduced code complexity

Formula: ⟨short_slug⟩ ⟶ ⟨base_name⟩ ⊥ ⟨directory_structure⟩
0 comments on “Testing: Location Categories”

Testing: Location Categories

Location categories provides a way to place categories into groups that can be filtered via the administrative tools and on the front end user experience.

Managing categories is provided by the Power add on.

Technical Implementation

The underlying technology uses the built-in WordPress category management system. Some of the core functionality of adding, removing, and assigning categories is managed by WordPress and thus requires additional testing whenever WordPress posts a new release.

The Power add on extend this default functionality to provide custom administrative and user interactions with location categories.

Testing Environment (July 2022)

WordPress 6+
Store Locator Plus 5.13+
Power Add On 5.11+

Related Use Cases

The use cases are based on the WordPress plugins. Most of the processes described within apply to the MySLP SaaS implementation as well.

Assumptions

WordPress environment is setup and configured including activation of the following plugins

  • Store Locator Plus®
  • SLP Power add on

In addition map service (Google API keys) should be in place and some locations should be added to the system.

A page has been created with the [slplus] shortcode present and the map is rendering properly.

Users are logged in as a WordPress administrator (the process will be slightly different for SaaS users).

Adding Categories To Locations

Objective

Create a location category and attach it to an existing location.

User Action: Add A Location Category

  1. Click on Store Locator Plus® | Categories in the WordPress sidebar menu.
  2. In the left “Add New Category Form”…
    1. Type a category name. (Restaurant)
    2. Click Add New Category
Result

The new category should appear on the category list on the page.

Category list after adding the restaurant category.

User Action: Attach Category To Location

  1. Click on Store Locator Plus® | Locations in the WordPress sidebar menu.
  2. Click the Edit action icon on the first location.
  3. Check off the box next to “Restaurants” in the Power | Categories section of the form.
  4. Click Save.
Result

The category is assigned to the location and appears on the location table.

The location with an assigned restaurant category. This view is showing fewer columns as the Screen Options was updated to removed unused columns from the table view.

User Action: Show Category Select On Front End

  1. Click on Store Locator Plus® | Settings in the WordPress sidebar menu.
  2. Change the Category Selector setting to “Single Drop Down”.
  3. Click Save
  4. On the front end, go to the page that has the [slplus] shortcode.
Result

The search form for the map should show a category drop down.

The front end page with the [slplus] shortcode, showing the category selection filter.

User Action : Filtering Locations With Category

  1. On the front end, go to the page that has the [slplus] shortcode.
  2. Enter an address, choose a category.
  3. Click “Find Locations”.
Result

Only the locations that match the search criteria, including the category filter, should be shown.