Download the PHP package thelia/available-default-product-module without Composer

On this page you can find all versions of the php package thelia/available-default-product-module. 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 available-default-product-module

Available Default Product

Replaces the default sale element of a product by another one still in stock once it runs out.

When an order reaches the paid status, the module checks the sale elements of every ordered product: if the one marked default just ran out of stock, the first other sale element of the same product still in stock (in the order the database returns them) becomes the new default. A product with no other sale element in stock keeps its exhausted default.

Thelia 3.2 or later. The 2.x line of this module is for Thelia 2.

Installation

The module creates no table and stores no configuration: activation only registers the listener.

Usage

The module has no service to call and no configuration screen: it reacts on its own to TheliaEvents::ORDER_UPDATE_STATUS, after Thelia\Action\Order::updateStatus() (priority 128) has saved the new status and decreased the stock of the order lines, inside its own transaction. It never touches the cart: the order lines (order_product) are the only source read, so the swap still happens even when the cart the order was placed from has since been emptied or deleted.

The module produces no external output (no e-mail, no API call, no file write): it only updates product_sale_elements.is_default. Like the 2.x line, the swap saves the sale element directly and dispatches no declination event of its own: a listener wanting to react to the change should watch ProductSaleElements::save() or poll is_default.

A failure while swapping (a database error, for instance) is logged and does not interrupt the order: by the time the module runs, the order is already paid and committed by the core listener, so raising an exception here would only abort every listener still due to run after it (Thelia\Action\Coupon::orderStatusChange, priority 10, among others) and could fail the payment module's own callback for a problem of the module's making. A stuck exhausted default is fixed by hand from the back office.

Changes in 3.0.0

Tests

Integration tests, run from the root of the Thelia project against its own dedicated test database (DATABASE_NAME alone is not enough: under APP_ENV=test, Symfony Dotenv skips .env.local, so the connection details have to be passed explicitly, and so does the project's real kernel class):


All versions of available-default-product-module with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
ext-dom Version *
psr/log Version ^3.0
thelia/installer Version ^1.6
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 thelia/available-default-product-module contains the following files

Loading the files please wait ...