$ composer require asdoria/sylius-shipping-delivery-time-plugin
# config/packages/asdoria_shipping_delivery_time.yaml
imports:
- { resource: "@AsdoriaSyliusShippingDeliveryTimePlugin/Resources/config/app/config.yaml" }
# Uncomment next line if you're using Webpack Encore
# - { resource: "@AsdoriaSyliusShippingDeliveryTimePlugin/Resources/config/app/config_webpack.yaml" }
# config/routes/asdoria_shipping_delivery_time.yaml
asdoria_sylius_shipping_delivery_time:
resource: "@AsdoriaSyliusShippingDeliveryTimePlugin/Resources/config/routes.yaml"
or if your app doesn't use locales:
# config/routes.yaml
asdoria_sylius_shipping_delivery_time:
resource: "@AsdoriaSyliusShippingDeliveryTimePlugin/Resources/config/routes_no_locale.yaml"
Make App\Entity\Shipping\ShippingMethod
extend ShippingMethodCountdownAwareInterface
use Asdoria\SyliusShippingDeliveryTimePlugin\Traits\Aware\ShippingMethodCountdownAwareTrait;
use Asdoria\SyliusShippingDeliveryTimePlugin\Model\Aware\ShippingMethodCountdownAwareInterface;
/**
* Class ShippingMethod
*
* @author Philippe Vesin <[email protected]>
*/
class ShippingMethod extends BaseShippingMethod implements ShippingMethodCountdownAwareInterface
{
use ShippingMethodCountdownAwareTrait;
/**
* ShippingMethod constructor.
*/
public function __construct()
{
parent::__construct();
$this->initializeShippingSchedulesCollection();
}
}
If you don't use annotations, make src/Resources/config/doctrine/Shipping/ShippingMethod.orm.xml
<mapped-superclass name="App\Entity\Shipping\ShippingMethod" table="sylius_shipping_method">
<field name="deliveryWeekdays" column="delivery_weekdays" nullable="true" type="array"/>
<field name="deliveryMaxTime" column="delivery_max_time" nullable="true" type="integer">
<options>
<option name="default">0</option>
</options>
</field>
<field name="deliveryMinTime" column="delivery_min_time" nullable="true" type="integer">
<options>
<option name="default">0</option>
</options>
</field>
<one-to-many target-entity="Asdoria\SyliusShippingDeliveryTimePlugin\Model\ShippingScheduleInterface"
mapped-by="shippingMethod" field="shippingSchedules" orphan-removal="true"
>
<cascade>
<cascade-all/>
</cascade>
</one-to-many>
<field name="additionalDeliveryTime" column="additional_delivery_time" nullable="true" type="json" />
</mapped-superclass>
Make App\Entity\Product\Product
extend ProductCountdownAwareInterface
use Asdoria\SyliusShippingDeliveryTimePlugin\Model\Aware\ProductCountdownAwareInterface;
use Asdoria\SyliusShippingDeliveryTimePlugin\Traits\Aware\ProductCountdownAwareTrait;
/**
* Class Product
* @package App\Entity\Product
*
* @author Philippe Vesin <[email protected]>
*/
class Product extends BaseProduct implements ProductInterface, ProductCountdownAwareInterface
{
use ProductCountdownAwareTrait;
}
If you don't use annotations, make src/Resources/config/doctrine/Product/Product.orm.xml
<mapped-superclass name="App\Entity\Product\Product" table="sylius_product">
<field name="additionalDeliveryTime" column="additional_delivery_time" nullable="true" type="integer">
<options>
<option name="default">0</option>
</options>
</field>
</mapped-superclass>
Make App\Entity\Channel\Channel
extend DefaultShippingZoneAwareInterface
use Asdoria\SyliusShippingDeliveryTimePlugin\Model\Aware\DefaultShippingZoneAwareInterface;
use Asdoria\SyliusShippingDeliveryTimePlugin\Traits\Aware\DefaultShippingZoneAwareTrait;
class Channel extends BaseChannel implements ChannelInterface, DefaultShippingZoneAwareInterface
{
use DefaultShippingZoneAwareTrait;
}
If you don't use annotations, make src/Resources/config/doctrine/Channel/Channel.orm.xml
<mapped-superclass name="App\Entity\Channel\Channel" table="sylius_channel">
<many-to-one field="defaultShippingZone" target-entity="Sylius\Component\Addressing\Model\ZoneInterface"/>
</mapped-superclass>
<?php
$bundles = [
// ...
Asdoria\SyliusShippingDeliveryTimePlugin\AsdoriaSyliusShippingDeliveryTimePlugin::class => ['all' => true],
// ...
];
- Copy the template overrides from the plugin directory
From: [shop_dir] vendor/asdoria/sylius-shipping-delivery-time-plugin/Resources/views/bundles/SyliusAdminBundle/*
To: [shop_dir] templates/bundles/SyliusAdminBundle/*
bin/console doctrine:migrations:diff
bin/console doctrine:migrations:migrate
php bin/console assets:install
php bin/console cache:clear