Download the PHP package rollpix/module-disable-sales without Composer

On this page you can find all versions of the php package rollpix/module-disable-sales. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package module-disable-sales

Rollpix_DisableSales

Version en español

SPONSOR: www.rollpix.com

Magento 2 module to temporarily disable sales in an online store without affecting catalog navigation. Ideal for high-demand situations, maintenance, or when you need to pause purchases without taking the site down.

Supports restricting sales by customer group, so you can block purchases for specific groups while allowing others to continue buying.

Compatibility

Requirement Supported versions
PHP 7.4 ~ 8.3
Magento 2.4.x (Open Source / Commerce)

Installation

Via composer (recommended)

Manual

  1. Create the folder app/code/Rollpix/DisableSales in your Magento installation.
  2. Copy all files from this repository into that folder.
  3. Run:

Admin Configuration

Go to Stores > Configuration > Rollpix > Disable Sales.

Configuration is divided into three sections:

General Settings

Field Type Default Description
Enable Yes/No No Activate or deactivate sales blocking
Message Textarea (see below) Message shown to customers. Supports HTML in the banner and modal. Checkout/cart error messages display as plain text
Also Disable Checkout Yes/No Yes Block checkout access as an additional safety net
Restrict to Customer Groups Multiselect (empty) Select which customer groups are restricted. If empty, all groups are restricted (backward compatible). Includes "NOT LOGGED IN" for guest users

Default message:

Debido a la alta demanda, las compras estan temporalmente suspendidas. Podes seguir navegando el catalogo. Volve pronto!

The message field supports HTML. You can use <strong>, <br>, <a href="...">, etc. HTML renders in the top banner and modal. Error messages shown in checkout and cart (via Magento message manager) automatically display as plain text.

Customer Group Filtering

When one or more customer groups are selected:

When no groups are selected (empty), the module works in legacy mode: sales are disabled for everyone using server-side CSS, identical to v1.0.x behavior.

Top Banner

Field Type Default Description
Show Top Banner Yes/No Yes Display a dismissible banner at the top of the page
Show Only After Login Yes/No No Only show the banner after the customer logs in. Guests won't see it even if their group is restricted
Background Color Color #ff6b35 Banner background color (hex format)
Text Color Color #ffffff Banner text color (hex format)
Banner Message Custom CSS Textarea font-size: 14px; line-height: 1.4; Inline CSS applied to the message text. Pre-loaded with defaults for easy editing

The banner has a close button (X). Once closed, it won't show again in that browser session (uses localStorage). The dismissed state resets automatically when the customer logs in or out.

Modal Popup

Field Type Default Description
Show Modal Yes/No No Display a modal popup once per session
Show Only After Login Yes/No No Only show the modal after the customer logs in
Background Color Color #ffffff Modal background color
Text Color Color #333333 Modal text color
Modal Message Custom CSS Textarea font-size: 18px; line-height: 1.6; text-align: center; padding: 10px 20px; Inline CSS applied to the modal message text. Pre-loaded with defaults

The modal is displayed centered on screen, with a max-width of 600px. It appears once per browser session (uses sessionStorage). Includes an "Entendido" (Got it) button to close.

Banner and Modal can be active at the same time. They are independent of each other.


What the module does when active

1. Hides "Add to Cart" buttons

Without group filter (legacy mode): Conditional inline CSS hides .action.tocart and #product-addtocart-button buttons on all pages.

With group filter: JavaScript dynamically injects/removes a <style> tag based on the customer's group (determined via customerData). This approach is FPC-compatible.

Affected pages:

2. Blocks add-to-cart (backend)

First layer: around plugin on Magento\Checkout\Controller\Cart\Add::execute

Second layer: before plugin on Magento\Quote\Model\Quote::addProduct

3. Blocks checkout (optional)

If "Also Disable Checkout" is set to Yes:

4. Blocks REST API / GraphQL

before plugin on Magento\Quote\Api\CartItemRepositoryInterface::save

5. Visual notification

Displays the configured message to users via:

Both support the "Show Only After Login" option and customer group filtering.


Behavior when disabled

When Enable = No:

The module is 100% reversible: simply set Enable = No and flush cache, everything returns to normal. No database tables are modified, no crons or observers are created.


Technical architecture

File structure

Plugins

Plugin Type Scope Intercepted class
AddPlugin around frontend Magento\Checkout\Controller\Cart\Add
AddProductPlugin before global Magento\Quote\Model\Quote
DisableCheckoutPlugin around frontend Magento\Checkout\Controller\Index\Index / Onepage\Index
CartItemRepositoryPlugin before global Magento\Quote\Api\CartItemRepositoryInterface
CustomerPlugin after frontend Magento\Customer\CustomerData\Customer

ViewModel

Rollpix\DisableSales\ViewModel\SalesStatus exposes to frontend:

ACL

Resource: Rollpix_DisableSales::config under Magento_Config::config


Manual testing guide

Basic functionality

  1. Enable the module in admin (Enable = Yes) → Save configuration → Flush cache

    • Verify "Add to Cart" buttons disappear on category, product, and search pages
    • Verify the top banner appears (if enabled)
    • Verify the modal appears (if enabled)
  2. Try adding to cart via direct URL (/checkout/cart/add/product/ID/)

    • Verify it is blocked and shows the error message
  3. Try accessing checkout with products in cart

    • Verify it redirects to cart with error message
  4. Disable the module (Enable = No) → Flush cache
    • Verify everything returns to normal

Customer group filtering

  1. Select specific groups (e.g., "General" and "NOT LOGGED IN") → Save → Flush cache

    • As a guest: verify buttons are hidden and banner/modal appear
    • Log in as a user in the "General" group: verify buttons are hidden
    • Log in as a user in a non-restricted group (e.g., "Wholesale"): verify buttons are visible and no banner/modal
  2. Test login/logout transitions

    • Start as guest (restricted) → log in as non-restricted → verify buttons become visible without page refresh
    • Start as guest (not restricted) → log in as restricted → verify buttons become hidden
  3. Test "Show Only After Login" for banner and/or modal
    • Enable the option → as guest, verify banner/modal don't appear
    • Log in as a restricted user → verify banner/modal appear

Visual customization

  1. Change message, colors and CSS → Flush cache

    • Verify changes are reflected on the frontend
  2. Test banner close button (X)

    • Verify it doesn't show again when navigating (localStorage)
  3. Test modal in incognito mode

    • Verify it appears once and doesn't reappear in the session (sessionStorage)
  4. Test banner + modal together
    • Enable both and verify they coexist correctly

Uninstall

If installed via composer, run composer remove rollpix/module-disable-sales. If installed manually, remove the app/code/Rollpix/DisableSales folder.

No database tables are created or modified. No residue left behind.


License

MIT


All versions of module-disable-sales with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
magento/framework Version *
magento/module-checkout Version *
magento/module-quote Version *
magento/module-catalog Version *
magento/module-config Version *
magento/module-store Version *
magento/module-backend Version *
magento/module-customer Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rollpix/module-disable-sales contains the following files

Loading the files please wait ...