MapListing — Product Map Listing extension for Paymenter v1.1.0

MapListing lets your customers put their business locations on the map. A signed-in customer lists a product's (or a shop's) location from the storefront — pin first, address second. The listing stays invisible until an admin approves it; approval publishes the pin to the map, and every maps surface reads the same approved set — one approved-listings source.

  • The maps site (map.smithandtech.space)
  • The maps app
  • The maps section on the Paymenter site itself (GET /map-listings)
  • Any other surface where Smith & Tech maps are used

A listing approved once shows up everywhere the maps are used. Submissions come from the Paymenter site only — the maps site and app never take submissions.

What's in v1.1.0

  • Proper Paymenter "Other" extension — no core/theme edits. Installs like ShareButtons/LinkedProducts: copy the extensions/Others/MapListing folder into Paymenter's extensions/Others/, then enable it in Admin → Extensions. The migration runs on install/upgrade.
  • ext_map_listings table: uuid idempotency key, user/product-or-shop subject, name, category, address, lat/lon, description, image URL, price, status pending/approved/declined/withdrawn/unpublished, map_place_id, map_url, sync_status/sync_error, reviewed-by.
  • Filament admin resource under Extensions → Map Listings: pending queue with a navigation badge, approve (with optional pin nudge), decline (with a reason the submitter sees), retry sync, unpublish, bulk approve. The admin can nudge the pin on the edit page; saving re-publishes.
  • "Find it on the map" block injected on product pages (products.show, GET, 200, HTML only, before </main>; no-op on any other route). Shows the pin card: name, category chip, address, "Find it on the map" (new tab), "Get directions" (seeds the map's own routing), description, photo, price, "Listed by" display name only — no email/phone.
  • Business location: list it on the map, show it on the shop. The submission form is the "list my business location on the map" option — it collects the business information that goes on the map listing: business name, category, address, description, photo URL, website. And the location shows on the business's own shop page too: maplisting::shop-block is a small map/pin block the shop page includes, rendered from the same approved listing — one source, shown on the shop and on every maps surface. Shop listings are live in v1.1.0: a shop owner lists their shop's location from /map-listings/submit/shop/{slug} (same form as products, no price), and the shop page offers the form to the owner only.
  • The Paymenter maps section (GET /map-listings): a Leaflet map with every approved listing as a pin, plus a list, rendered inside the storefront layout. It reads the approved set directly from this extension's own table — no map-app call — so it works even if the map app is down.
  • Submission: signed-in users only. Pick-on-map with a draggable Leaflet pin first, typed address second. Typed addresses geocode server-side at submit time (Nominatim; see Geocoding). One pending/approved listing per (user, subject); re-submission edits the existing one and sends it back to pending for re-approval (the live pin keeps the previously approved data until re-approved). Throttled (10/hour); only whitelisted fields accepted.
  • Publish failure keeps the listing approved with sync_status=failed + a retry action — approval is never lost to a dead map.
  • Product deletion unpublishes the pin before the rows cascade.

Install

  1. Copy extensions/Others/MapListing into Paymenter's extensions/Others/ directory.
  2. In the Paymenter admin panel go to Extensions → MapListing and click Install, then Enable.
  3. Fill in the settings (Admin → Extensions → MapListing → Settings). The defaults point at the public map; set the API token and pick the transport (see below) before approving anything.
  4. Verify: the migration created ext_map_listings; the resource appears under Extensions → Map Listings; a product page shows the block; /map-listings loads; /map-listings/feed.geojson returns 404 without the right token.

Configuration (all in Admin → Extensions → MapListing → Settings)

Setting Type Default What it does
map_base_url text https://map.smithandtech.space The map that receives approved listings and that pin links point to.
map_api_token password — Bearer token for the map's write API.
map_api_places_path text /api/v1/places Path appended to the base URL for the places API.
transport select api api pushes listings to the map; feed publishes the signed GeoJSON feed for the map to poll.
feed_token text generated random 32-char string Token the map must pass as ?token= to read the feed.
default_lat / default_lng number 33.7490 / -84.3880 Default map center (Atlanta).
default_zoom number 11 Default zoom.
tile_url text https://tile.openstreetmap.org/{z}/{x}/{y}.png Tile layer for the submission picker, the shop block, and the maps section.
geocoder_url text https://nominatim.openstreetmap.org Nominatim endpoint used for typed addresses.
categories textarea Restaurant, Gas, ATM, Shopping, General One category per line; the submission form only accepts these.
section_title text Find it on the map Heading of the product-page block.
submit_button_label text List on the map Label of the submit button and the block's link.
waiting_message textarea Your listing is waiting for review. It will appear on the map once an admin approves it. Shown to the submitter while pending.
decline_message textarea This listing was not approved. You can edit it and submit it again. Shown to the submitter when declined.
submissions_enabled checkbox on Turn submissions off without removing existing listings.
shops_enabled checkbox off Shop listings for user-created shops. Off by default — turn on to let shop owners list locations.
require_approval checkbox on Placeholder — approval is always on in v1 and enforced in code.
max_listings_per_user number 10 Cap on pending + approved listings per user.
show_price_on_pin checkbox on Include the price on the pin.
brand_name text Smith & Tech Maps Brand used in the maps section title and the submission page.

No Smith & Tech identifier is hard-coded in code — only as config defaults in MapListing.php. Change the defaults there (or in the admin settings) to resell the extension under another brand.

How approval works

  1. Customer submits a location from a product page (/map-listings/submit/product/{slug}) or from a shop page (/map-listings/submit/shop/{slug}). Status: pending.
  2. Admin reviews it in Extensions → Map Listings (nudge the pin if needed) and clicks Approve. The extension pushes the listing to the map (async queued job) and stores the returned map_place_id + map_url.
  3. The pin is live on every maps surface. Editing an approved listing re-publishes it (same uuid, so the map updates the same place). Withdrawing, unpublishing, or deleting the product removes the pin.
  4. Decline never touches the map. The submitter sees the decline reason and can edit and resubmit.

Publish target — site, app, and every maps surface

Approved listings must show on the maps site AND the maps app AND the maps section on the Paymenter site AND anywhere else Smith & Tech maps are used. The principle: one approved-listings source that every maps surface reads from, so a listing approved once shows up everywhere.

How each surface gets its data:

  • Paymenter maps section (GET /map-listings) — reads the approved set directly from this extension's own table. Confirmed by construction.
  • Maps site and maps app — receive approved listings through the publish push (API transport) or the signed GeoJSON feed (feed transport). The push target is the map system that feeds both surfaces.
  • Any other surface where the maps appear — reads the same approved set through the push or the feed.

Open verification items (recorded as UNVERIFIED, not assumed):

  • Whether the maps site and the maps app share one backend/API. If they do, one push covers both. If not, the design must say what the second surface needs (a second push target, or the feed consumed by that surface's backend).
  • An inventory of every other surface where Smith & Tech maps appear, and how each one gets its data.
  • CT 116 internals (language/framework, ports, LAN IP, data store, whether a write API exists) — see "What is unverified" below.

Map API contract (what the map must accept)

The extension pushes approved listings to the map over HTTPS, async via a queued job. The map's write API is not yet confirmed — the contract below is what the extension sends; the map side must implement it (or the feed transport is used instead).

POST {map_base_url}/api/v1/places
Authorization: Bearer {map_api_token}
Content-Type: application/json

{
  "uuid": "11111111-2222-3333-4444-555555555555",
  "name": "Test Business",
  "category": "Shopping",
  "address": "123 Main St, Atlanta, GA",
  "latitude": 33.749,
  "longitude": -84.388,
  "description": "A test shop.",
  "image_url": "https://example.com/shop.jpg",
  "website_url": "https://example.com",
  "price": 15.00,
  "currency": "USD",
  "source": "paymenter"
}
  • POST creates a place; the response must return place_id (string) and may return url.
  • PUT {map_base_url}/api/v1/places/{place_id} updates the same place (same uuid); DELETE .../{place_id} removes it.
  • The map must treat uuid as the idempotency key: re-POSTing the same uuid must not create a duplicate.
  • The pin link is {map_base_url}/?place={place_id}; "Get directions" seeds the map's own routing with {map_base_url}/?route={lat},{lon} as the destination.
  • The payload contains no email, no Paymenter user ID, and no phone number. "Listed by" is a display name only.

Feed transport (fallback if the map has no write API)

GET /map-listings/feed.geojson?token={feed_token} returns a GeoJSON FeatureCollection of every approved listing with coordinates (feature id = the listing uuid). The map polls it; the feed is the canonical read surface. With the feed transport, listings are marked synced at approve time (no job is dispatched).

Last resort

Manual CSV export from the admin panel (Filament's built-in export) is the last resort only — never the primary transport. Shared-DB access is rejected as primary (the extension never writes to the map's database).

Geocoding

Pin-drop first, geocode second. Typed addresses geocode server-side at submit time (and from the form's "Find address" button), so no key is exposed to the browser.

  • First choice: Nominatim against the OSM data already on pve0 if an instance exists on CT 113 (free, private) — set geocoder_url to it.
  • If not: public Nominatim (https://nominatim.openstreetmap.org, free, no key, 1 req/s policy) with server-side caching (30 days) and a real User-Agent built from the configured brand + map URL.
  • Never Google/Mapbox in v1 (paid keys).

Sale-ready

The extension is built to be sold like the other extensions ($29 pattern): full getConfig() section (every setting above), no store identifier hard-coded outside config defaults, version constant 1.0.0, and a test harness proving the no-hard-coded-brand rule (tests/maplisting_harness.php). No sale product is created by this build — that is a later step after proof.

What is unverified (do not assume)

  • CT 116 (maps-listings) internals: language/framework, ports, LAN IP, data store, whether a write API exists, and whether the maps site and the maps app share one backend/API. The build does not hinge on the answer: the transport is one swappable class (MapPublisher interface, ApiPublisher + FeedPublisher).
  • CT 113 (osm-georgia): whether a Nominatim/Photon instance is running there. Public Nominatim is the fallback.
  • Live behaviour: Filament auto-discovery of the admin resource, the migration actually running, the middleware injecting into a real product page and a real shop page, the submission form rendering end to end, the Leaflet picker in a browser, the push to the real map, and the maps section rendering inside the theme layout. All need a live install + proof on a Paymenter instance (owner approval required; not part of this build).

Known limits (v1.1.0)

  • Image is a URL (no upload), like LinkedProducts v1.
  • Approval is always on (require_approval is a placeholder field).

Files

extensions/Others/MapListing/
  MapListing.php                  ExtensionMeta, getConfig, boot, hooks
  Models/MapListing.php           ext_map_listings model
  Src/MapListingService.php       approve/decline/unpublish, payload, feed
  Src/Geocoder.php                Nominatim geocoder (pin first, cache, 1 req/s)
  Src/Publish/MapPublisher.php    Transport interface
  Src/Publish/ApiPublisher.php    POST/PUT/DELETE {map_base_url}/api/v1/places
  Src/Publish/FeedPublisher.php   Feed is the read surface; publish is a no-op
  Src/Jobs/PublishMapListing.php  Queued publish job (3 tries, backoff 10/60/300)
  Src/Middleware/InjectMapListing.php  "Find it on the map" block on product pages
  Admin/Resources/MapListingResource.php
  Admin/Resources/MapListingResource/Pages/{List,Create,Edit}MapListing.php
  Policies/MapListingPolicy.php   Admin-only access
  database/migrations/2026_11_19_000002_create_ext_map_listings_table.php
  resources/views/block.blade.php       Product-page pin card
  resources/views/shop-block.blade.php  Shop-page location block (v2)
  resources/views/submit.blade.php      "List my business location" form + pin picker
  resources/views/mine.blade.php        My listings + withdraw
  resources/views/map.blade.php         Paymenter maps section
  routes/web.php                  /map-listings, feed, submit, mine, geocode
tests/maplisting_harness.php      php tests/maplisting_harness.php
DESIGN.md                         Full design, decisions, open items

Test

php tests/maplisting_harness.php

Runs php -l on all PHP files plus the checks listed in the harness header. It proves the extension's internal behaviour without Laravel; live behaviour still needs the install proof.

S
Description
MapListing extension for Paymenter — product and business locations on Smith and Tech Maps, admin-approved before they show (v1.0.0)
Readme
969 KiB
0 Stars 1 Watchers 0 Forks
Languages
PHP 82%
Blade 18%