Skip to content

Releases: gp247-plugin/ProductFlashSale

2.0.1

Choose a tag to compare

@gp247net gp247net released this 23 Sep 00:51

fix: offer the home strip through the block registry, not a template directory (2.0.1)

A block resolves as GP247TemplatePath::.blocks., and the template
name is a path segment — so this plugin shipped template/GP247Front/blocks/ and
registered that directory as one more GP247TemplatePath source root. Two things
were wrong with it: the plugin does not publish a template, yet it hardcoded the
name of one (a site running its own template never saw the block at all), and its
root joined TemplateSourceAudit::roots(), so gp247:template-publish,
gp247:template-prune and gp247:doctor counted plugin files as template sources.

gp247/front now carries a registry for exactly this, alongside layout_page,
seo_sitemap_providers and plugin_hooks:

config('gp247-config.front.layout_block_views')  // '<block>' => '<view key>'

Provider.php appends its entry there and the template/ directory is gone. The
renderer looks the active template's own blocks/.blade.php up FIRST and only
then the registry, so a site that published the block to edit it still wins, and
the block now reaches every template, needs no writable directory, and leaves
nothing behind when the plugin is removed.

seedLayoutBlock() drops blockAvailableForTemplate(): with no file inside a
template directory to depend on, there is no template the strip cannot render on,
so every store gets the row.

Nothing changes in front_layout_block — the block is still named
product_flash_sale — so installed sites need no migration.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

2.0.0

Choose a tag to compare

@gp247net gp247net released this 22 Sep 00:01

feat!: port to gp247/core 3.0, with an atomic sale quota (2.0.0)

Version 1.0.0 could not be installed on core 3.0 at all: requireCore ["1.1"]
fails ExtensionInstaller's compatibility range, and the admin screen extended
the removed gp247-core::layout while paginating through the removed
gp247-core::component.pagination, driven by pjax/select2/SweetAlert that the
TailAdmin shell no longer loads.

Admin

  • Two-panel Livewire screen on the core ResourcePanel base, replacing the
    AdminLTE controller and its views. Route names are unchanged because the
    AdminMenu row written by install() points at admin_product_flash_sale.index.
  • Searchable product picker, flatpickr window WITH the hour (time-boxed selling
    needs it), price in the base currency, sold/quantity progress, store column on
    multi-store installs.
  • Validation the old screen never really had: its unique rule passed a quoted
    class name, which Laravel reads as a table name, so creating a sale hit a SQL
    error. Rules now cover one-sale-per-product, quantity >= sold, end after start,
    and a server-side check that the product belongs to the acting admin's store.

Quota integrity

  • Units are taken with a conditional UPDATE inside the order transaction. The old
    read-modify-write let two simultaneous checkouts both pass the advisory check
    and oversell the sale.
  • Units come back when the goods do: cancel, delete, and removing an order line
    now release them (wired from gp247/shop). Re-opening a cancelled order takes
    them again and is refused when the sale is spent. Before this, one cancelled
    order burned a slot for ever.

Visibility

  • The listing delegates to ShopProduct::buildQuery instead of querying the tables
    directly, so status, approval, store scope and the out-of-stock setting apply.
    On a marketplace the old query published unapproved and other stores' products.

Storefront

  • Own listing page (the template's product-list screen ignores $products and
    rebuilds its own query, so the old page listed the whole catalogue), registered
    as a LayoutBlock page-type and contributed to sitemap.xml.
  • The strip is Tailwind + the template's Alpine countdown; the jQuery countdown
    from a CDN is gone, as is jQuery itself.
  • The block is offered to templates by registering this plugin's directory as one
    more GP247TemplatePath source root — nothing is copied into app/GP247/Templates,
    so it works on read-only deployments and leaves nothing behind when removed.
    Registered from booted() so the site's own published files still win.

Install lifecycle

  • install() and update() share a re-entrant converge(); the table is created only
    when missing (installing used to drop it first, destroying every scheduled sale)
    and the menu row only when absent.
  • A fresh install also places the strip at the bottom of the home page for stores
    that have no such block. Deliberately not in converge(): where a block appears
    is the admin's decision, and an update must not overrule it.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

1.0

1.0

Choose a tag to compare

@gp247net gp247net released this 17 Aug 15:25
first commit