setono / sylius-reserve-stock-plugin
Reserve Stock Plugin for Sylius.
Installs: 17 798
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 4
Open Issues: 12
Type:sylius-plugin
Requires
- php: >=7.2
- sylius/sylius: ^1.3.0
Requires (Dev)
- behat/behat: ^3.4
- behat/mink: ^1.7@dev
- behat/mink-browserkit-driver: ^1.3
- behat/mink-extension: ^2.2
- behat/mink-selenium2-driver: ^1.3
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.0
- friends-of-behat/symfony-extension: ^2.0
- friends-of-behat/variadic-extension: ^1.1
- lakion/mink-debug-extension: ^1.2.3
- localheinz/composer-normalize: ^1.3
- matthiasnoback/symfony-dependency-injection-test: ^2.0 || ^3.0
- phpspec/phpspec: ^5.0
- phpstan/phpstan-doctrine: ^0.10
- phpstan/phpstan-shim: ^0.10
- phpstan/phpstan-symfony: ^0.10
- phpstan/phpstan-webmozart-assert: ^0.10
- phpunit/phpunit: ^6.5
- roave/security-advisories: dev-latest
- sensiolabs/security-checker: ^5.0
- sylius-labs/coding-standard: ^2.0
- symfony/browser-kit: ^3.4 || ^4.1
- symfony/debug-bundle: ^3.4 || ^4.1
- symfony/dotenv: ^4.2
- symfony/intl: ^3.4 || ^4.1
- symfony/web-profiler-bundle: ^3.4 || ^4.1
- symfony/web-server-bundle: ^3.4 || ^4.1
- dev-master / 1.3.x-dev
- v1.3.1
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.0
- v1.0.0-beta
- dev-renovate/configure
- dev-dependabot/composer/localheinz/composer-normalize-tw-2.15
- dev-dependabot/add-v2-config-file
- dev-dependabot/composer/lakion/mink-debug-extension-tw-2.0.0
- dev-dependabot/composer/phpspec/phpspec-tw-6.3
- dev-dependabot/composer/sylius-labs/coding-standard-tw-3.1
- dev-dependabot/composer/sensiolabs/security-checker-tw-6.0
- dev-dependabot/composer/phpunit/phpunit-tw-8.5
- dev-dependabot/composer/phpstan/phpstan-shim-tw-0.12
- dev-feature/update-order-updated-at-while-browsing
This package is auto-updated.
Last update: 2024-11-15 16:40:45 UTC
README
This plugin will reserve items in your customers' carts in a given amount of time.
Installation
1. Composer
composer require setono/sylius-reserve-stock-plugin
2. Load bundle
Add to the bundle list in config/bundles.php
:
<?php return [ // ... Setono\SyliusReserveStockPlugin\SetonoSyliusReserveStockPlugin::class => ['all' => true], // ... ];
3. Configuration
Default configuration is applied automatically. Find out which settings can be adjusted by running:
bin/console config:dump-reference SetonoSyliusReserveStockPlugin
The default configuration is:
setono_sylius_reserve_stock: # Define the Time To Live (TTL) for a product reservation. ttl: 3600 # Example: 1800
4. Include repository
Option 1: load repository via config
This option applies if you didn't extend the OrderItem
repository yet.
sylius_order: resources: order_item: classes: repository: Setono\SyliusReserveStockPlugin\Repository\OrderItemRepository
Option 2: include repository trait in your repository
This option applies if you extended the OrderItem
repository already. Add the trait to your repository class as shown in the
example below. The package also comes with an interface (InCartQuantityForProductVariantOrderItemRepositoryAwareInterface
) which you can
optionally load.
<?php declare(strict_types=1); namespace App\Repository\OrderItemRepository; use Setono\SyliusReserveStockPlugin\Repository\InCartQuantityForProductVariantOrderItemRepositoryAwareInterface; use Setono\SyliusReserveStockPlugin\Repository\ProductVariantCartOrderItem; use Sylius\Bundle\OrderBundle\Doctrine\ORM\OrderItemRepository as BaseOrderItemRepository; final class OrderItemRepository extends BaseOrderItemRepository implements InCartQuantityForProductVariantOrderItemRepositoryAwareInterface { use ProductVariantCartOrderItem; // Load trait here }