Skip to content

Releases: ROLLPIX/M2-DisableSales

v1.1.7

Choose a tag to compare

@nmarquev nmarquev released this 03 Mar 23:01

Changes

  • Fix: banner disappearing immediately after showing
    • Removed hideBanner() from the evaluation logic — intermediate customerData states (empty {} during section refresh) were triggering it and hiding the banner
    • Banner now only shows when conditions are met, never actively hidden (starts hidden via CSS in JS mode)
    • Added NaN guard for group_id when cached section data doesn't include it yet

v1.1.6

Choose a tag to compare

@nmarquev nmarquev released this 03 Mar 22:43

Changes

  • Updated README.md and README.es.md with documentation for:
    • Customer group filtering (multiselect)
    • "Show Only After Login" option for banner and modal
    • Updated file structure, plugins table, and ViewModel methods
    • New testing guide sections for group filtering and login transitions

v1.1.5

Choose a tag to compare

@nmarquev nmarquev released this 03 Mar 22:34

Changes

  • Fix: reliable state updates after login/logout without needing Ctrl+F5
    • Use customerData.getInitCustomerData() to re-evaluate after Magento finishes refreshing section data
    • Handle browser back-forward cache (bfcache) via pageshow event
    • Reset banner dismissed state when login state changes (so logged-in restricted users see the banner)
    • Properly hide banner when switching to a non-restricted group

v1.1.4

Choose a tag to compare

@nmarquev nmarquev released this 03 Mar 22:23

Changes

  • Remove guest special case: "Not Logged In" (group 0) is now treated as a regular restricted group
  • When group 0 is restricted: add-to-cart buttons are hidden via JS (same as logged-in restricted users)
  • Banner/modal visibility respects show_on_login setting: if unchecked, shows for all restricted users including guests
  • Removed AJAX add-to-cart intercept (no longer needed since buttons are hidden)

v1.1.3

Choose a tag to compare

@nmarquev nmarquev released this 03 Mar 22:13

Changes

  • Return HTTP 400 instead of 200 on blocked guest add-to-cart AJAX requests to prevent theme success popup from showing "undefined" content
  • Simplified JSON response payload (plain message instead of HTML)

v1.1.2

Choose a tag to compare

@nmarquev nmarquev released this 03 Mar 22:06

Bugfix

  • Guest add-to-cart feedback: When a guest (Not Logged In group restricted) tries to add a product to cart, the server blocks it but previously showed no feedback. Now:
    • The error message appears properly formatted in the standard Magento messages container
    • The top banner is shown after the failed attempt so the customer understands sales are disabled

v1.1.1

Choose a tag to compare

@nmarquev nmarquev released this 03 Mar 21:48

Bugfixes

  • Fixed JS ReferenceError: addHideTocartStyle and removeHideTocartStyle functions were called but never defined, breaking the entire group filter JS component (add-to-cart hiding and banner visibility for logged-in restricted users)
  • Fixed missing group_id in customerData: Magento's default customer section data does not include group_id. Added CustomerPlugin to inject it, enabling frontend JS to detect the customer's group

v1.1.0

Choose a tag to compare

@nmarquev nmarquev released this 03 Mar 21:10

Changes

  • Customer group filtering: Sales disable can now target specific customer groups via multiselect in admin config. Leave empty for backward-compatible "all groups" behavior.
  • Show Only After Login: New checkbox for banner and modal — only displays to logged-in customers whose group is restricted. Prevents confusing guests who may belong to unrestricted groups.
  • Guest special case: When "Not Logged In" group is restricted, add-to-cart button stays visible but server blocks the action with an error message (since we can't identify the customer before login).
  • All 4 server-side plugins (Cart Add, Quote AddProduct, API CartItemRepository, Checkout) now check customer group.
  • New JS component (disable-sales-group-filter.js) handles client-side visibility via Magento customerData for FPC compatibility.
  • New CustomerGroup source model for admin multiselect.
  • Added Magento_Customer module dependency.
  • Spanish translations for new config fields.

v1.0.0 - Initial Release

Choose a tag to compare

@nmarquev nmarquev released this 26 Feb 01:01

Rollpix_DisableSales v1.0.0

Magento 2 module to temporarily disable sales without affecting catalog navigation.

Features

  • Block add-to-cart: controller plugin + quote model plugin + REST API plugin
  • Block checkout (optional): redirect to cart with error message
  • Top banner: dismissible, customizable colors and CSS, persists via localStorage
  • Modal popup: centered, once per session, independent colors and CSS
  • Banner + Modal can coexist simultaneously
  • HTML support in message (plain text in error messages)
  • Custom CSS fields pre-loaded with editable defaults
  • es_AR translation included
  • Zero performance impact when disabled
  • 100% reversible: no database changes, no crons, no observers

Compatibility

  • PHP 7.4 ~ 8.3
  • Magento 2.4.x (Open Source / Commerce)

Installation

composer require rollpix/module-disable-sales
bin/magento module:enable Rollpix_DisableSales
bin/magento setup:upgrade
bin/magento cache:flush

SPONSOR: www.rollpix.com