monsieurbiz / sylius-shipping-slot-plugin
A Sylius plugin which allow you to choose a delivery date and time.
Installs: 2 631
Dependents: 1
Suggesters: 0
Security: 0
Stars: 6
Watchers: 8
Forks: 5
Open Issues: 2
Type:sylius-plugin
Requires
- php: ~7.4|~8.0
- gedmo/doctrine-extensions: ^2.4.12 || ^3.0
- simshaun/recurr: ^4.0
- sylius/sylius: >=1.9 <1.13
Requires (Dev)
- behat/behat: ^3.6.1
- behat/mink-selenium2-driver: ^1.4
- dmore/behat-chrome-extension: ^1.3
- dmore/chrome-mink-driver: ^2.7
- doctrine/data-fixtures: ^1.4
- ergebnis/composer-normalize: ^2.5
- friends-of-behat/mink: ^1.8
- friends-of-behat/mink-browserkit-driver: ^1.4
- friends-of-behat/mink-extension: ^2.4
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/symfony-extension: ^2.1
- friends-of-behat/variadic-extension: ^1.3
- hwi/oauth-bundle: ^1.1
- lchrusciel/api-test-case: ^5.0
- matthiasnoback/symfony-config-test: ^4.2
- matthiasnoback/symfony-dependency-injection-test: ^4.1
- mikey179/vfsstream: ^1.6
- mockery/mockery: ^1.4
- pamil/prophecy-common: ^0.1
- phpmd/phpmd: @stable
- phpspec/phpspec: ^6.1 || ^7.2
- phpstan/phpstan: ^0.12.57
- phpstan/phpstan-doctrine: ^0.12.19
- phpstan/phpstan-webmozart-assert: ^0.12.7
- phpunit/phpunit: ^8.5
- psalm/plugin-mockery: ^0.3
- psr/event-dispatcher: ^1.0
- sylius-labs/coding-standard: ^3.1
- symfony/browser-kit: ^4.4
- symfony/debug-bundle: ^4.4
- symfony/dotenv: ^4.4
- symfony/flex: ^1.7
- symfony/web-profiler-bundle: ^4.4
This package is auto-updated.
Last update: 2024-12-30 09:26:54 UTC
README
Shipping Slot
This plugin allows you to choose a delivery date and time.
Installation
Install the plugin with composer
:
composer require monsieurbiz/sylius-shipping-slot-plugin
If you are using Symfony Flex, the recipe will automatically do some actions.
For the installation without Flex, follow these additional steps
1. Add the plugin to your `config/bundles.php` file:
return [ // ... MonsieurBiz\SyliusShippingSlotPlugin\MonsieurBizSyliusShippingSlotPlugin::class => ['all' => true], ];
- Import the plugin's configuration by creating a new file
config/packages/monsieurbiz_sylius_shipping_slot_plugin.yaml
with the following content:
imports: - { resource: "@MonsieurBizSyliusShippingSlotPlugin/Resources/config/config.yaml" }
- Import the plugin's routing by creating a new file
config/routes/monsieurbiz_sylius_shipping_slot_plugin.yaml
with the following content:
monsieurbiz_sylius_shipping_slot_plugin: resource: "@MonsieurBizSyliusShippingSlotPlugin/Resources/config/routing.yaml"
- Copy the override template from the plugin to your
templates
directory:
mkdir -p templates/bundles/; cp -Rv vendor/monsieurbiz/sylius-shipping-slot-plugin/src/Resources/views/SyliusShopBundle templates/bundles/
After that, follow the next steps:
- Your
Order
entity should implement theMonsieurBiz\SyliusShippingSlotPlugin\Entity\OrderInterface
and use theMonsieurBiz\SyliusShippingSlotPlugin\Entity\OrderTrait
trait:
namespace App\Entity\Order; use Doctrine\ORM\Mapping as ORM; +use MonsieurBiz\SyliusShippingSlotPlugin\Entity\OrderInterface as MonsieurBizOrderInterface; +use MonsieurBiz\SyliusShippingSlotPlugin\Entity\OrderTrait; use Sylius\Component\Core\Model\Order as BaseOrder; /** * @ORM\Entity * @ORM\Table(name="sylius_order") */ #[ORM\Entity] #[ORM\Table(name: 'sylius_order')] -class Order extends BaseOrder +class Order extends BaseOrder implements MonsieurBizOrderInterface { + use OrderTrait; }
- Your
ProductVariant
entity should implement theMonsieurBiz\SyliusShippingSlotPlugin\Entity\ProductVariantInterface
and use theMonsieurBiz\SyliusShippingSlotPlugin\Entity\ProductVariantTrait
trait:
namespace App\Entity\Product; use Doctrine\ORM\Mapping as ORM; +use MonsieurBiz\SyliusShippingSlotPlugin\Entity\ProductVariantInterface as MonsieurBizProductVariantInterface; +use MonsieurBiz\SyliusShippingSlotPlugin\Entity\ProductVariantTrait; use Sylius\Component\Core\Model\ProductVariant as BaseProductVariant; use Sylius\Component\Product\Model\ProductVariantTranslationInterface; /** * @ORM\Entity * @ORM\Table(name="sylius_product_variant") */ #[ORM\Entity] #[ORM\Table(name: 'sylius_product_variant')] -class ProductVariant extends BaseProductVariant +class ProductVariant extends BaseProductVariant implements MonsieurBizProductVariantInterface { + use ProductVariantTrait; + protected function createTranslation(): ProductVariantTranslationInterface { return new ProductVariantTranslation(); } }
- Your
Shipment
entity should implement theMonsieurBiz\SyliusShippingSlotPlugin\Entity\ShipmentInterface
and use theMonsieurBiz\SyliusShippingSlotPlugin\Entity\ShipmentTrait
trait:
namespace App\Entity\Shipping; use Doctrine\ORM\Mapping as ORM; +use MonsieurBiz\SyliusShippingSlotPlugin\Entity\ShipmentInterface as MonsieurBizShipmentInterface; +use MonsieurBiz\SyliusShippingSlotPlugin\Entity\ShipmentTrait; use Sylius\Component\Core\Model\Shipment as BaseShipment; /** * @ORM\Entity * @ORM\Table(name="sylius_shipment") */ #[ORM\Entity] #[ORM\Table(name: 'sylius_shipment')] -class Shipment extends BaseShipment +class Shipment extends BaseShipment implements MonsieurBizShipmentInterface { + use ShipmentTrait; }
- Your
ShippingMethod
entity should implement theMonsieurBiz\SyliusShippingSlotPlugin\Entity\ShippingMethodInterface
and use theMonsieurBiz\SyliusShippingSlotPlugin\Entity\ShippingMethodTrait
trait:
namespace App\Entity\Shipping; use Doctrine\ORM\Mapping as ORM; +use MonsieurBiz\SyliusShippingSlotPlugin\Entity\ShippingMethodInterface as MonsieurBizShippingMethodInterface; +use MonsieurBiz\SyliusShippingSlotPlugin\Entity\ShippingMethodTrait; use Sylius\Component\Core\Model\ShippingMethod as BaseShippingMethod; use Sylius\Component\Shipping\Model\ShippingMethodTranslationInterface; /** * @ORM\Entity * @ORM\Table(name="sylius_shipping_method") */ #[ORM\Entity] #[ORM\Table(name: 'sylius_shipping_method')] -class ShippingMethod extends BaseShippingMethod +class ShippingMethod extends BaseShippingMethod implements MonsieurBizShippingMethodInterface { + use ShippingMethodTrait { + ShippingMethodTrait::__construct as private shippingMethodTraitConstruct; + } + + public function __construct() + { + parent::__construct(); + $this->shippingMethodTraitConstruct(); + } + protected function createTranslation(): ShippingMethodTranslationInterface { return new ShippingMethodTranslation(); } }
- Update your database schema with the following command:
bin/console doctrine:migrations:migrate
- Generate the migration and update your database schema:
bin/console doctrine:migrations:diff bin/console doctrine:migrations:migrate
Sponsors
- Glacier1891
- WahsWash
Contributing
You can open an issue or a Pull Request if you want! 😘
Thank you!