tavy315 / sylius-requested-delivery-date-plugin
Sylius plugin for your customers to request a delivery date.
Installs: 155
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:sylius-plugin
Requires
- php: >=7.4
- sylius/sylius: ^1.7
Requires (Dev)
README
This plugin for Sylius allows your customers to request a delivery date on their order.
Supports Doctrine ORM driver only.
Screenshots
Shop:
Admin:
Installation
Step 1: Install the plugin
Open a command console, enter your project directory and execute the following command to download the latest stable version of this plugin:
$ composer require tavy315/sylius-requested-delivery-date-plugin
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the plugin
Then, enable the plugin by adding it to the list of registered plugins/bundles in config/bundles.php
file of your project:
<?php $bundles = [ Tavy315\SyliusRequestedDeliveryDatePlugin\Tavy315SyliusRequestedDeliveryDatePlugin::class => ['all' => true], ];
Step 3: Configure the plugin
# config/packages/tavy315_sylius_requested_delivery_date.yaml imports: - { resource: "@Tavy315SyliusRequestedDeliveryDatePlugin/Resources/config/app/config.yaml" }
Step 4: Customize models
Read more about Sylius models customization here.
Customize your Order model
Add a Tavy315\SyliusRequestedDeliveryDatePlugin\Model\Order\RequestedDeliveryDateTrait
trait to your App\Entity\Order\Order
class.
-
If you use
annotations
mapping:<?php // src/Entity/Order/Order.php namespace App\Entity\Order; use Doctrine\ORM\Mapping as ORM; use Sylius\Component\Core\Model\Order as BaseOrder; use Tavy315\SyliusRequestedDeliveryDatePlugin\Model\Order\RequestedDeliveryDateInterface; use Tavy315\SyliusRequestedDeliveryDatePlugin\Model\Order\RequestedDeliveryDateTrait; /** * @ORM\Entity * @ORM\Table(name="sylius_order") */ class Order extends BaseOrder implements RequestedDeliveryDateInterface { use RequestedDeliveryDateTrait; }
Step 5: Update your database schema
$ php bin/console doctrine:migrations:diff $ php bin/console doctrine:migrations:migrate
Step 6: Add labels to your product templates
Add the new requestedDeliveryDate
field to your template. By default, you should use templates/bundles/SyliusShopBundle/Checkout/Complete/_form.html.twig
path.
{{ form_row(form.notes, sylius_test_form_attribute('extra-notes')|merge({'rows': 3})) }} {{ form_row(form.requestedDeliveryDate) }}
Usage
From now your customers should be able to request a delivery date.