Skip to content

1.0.2

Latest

Choose a tag to compare

@gp247net gp247net released this 22 Sep 14:55

fix: register the "Top new vendors" block instead of copying it into a template (1.0.2)

install() copied template/blocks/*.blade.php into
app/GP247/Templates//blocks/. Every part of that failed somewhere:

  • it needs a writable template directory, and the is_writable() guard meant a
    read-only deploy silently ended up with no block and no error;
  • it only reached the template active at install time, so switching themes or
    adding a store lost the block;
  • if (!file_exists) meant a plugin update never refreshed the copy. The copy on
    our own dev site still carried the partner/domain branch this plugin dropped in
    1.0.0 — dead markup rendering for weeks;
  • uninstalling left the file behind, under a path s-cart's .gitignore excludes, so
    it belonged to no repository at all.

The block now lives where the plugin's other views live, Views/blocks/, and
Provider.php registers it in gp247/front's block registry:

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

gp247_render_block() resolves the active template's own blocks/.blade.php
first and falls back to the registry, so a site that already has the copied file —
including one it has edited — keeps rendering exactly what it renders today. A site
that wants to clean up can delete
app/GP247/Templates//blocks/vendor_new.blade.php by hand; nothing deletes it
for them.

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