setono/sylius-shipping-countdown-plugin

Setono shipping countdown plugin for Sylius 1.6+

v0.1.1 2022-08-15 13:51 UTC

README

Latest Version Latest Unstable Version Software License Build Status Code Coverage

Screenshots

Screenshot showing shipping schedule index at admin

Screenshot showing shipping countdown at shop header

Installation

Require plugin with composer:

$ composer require setono/sylius-shipping-countdown-plugin

Import configuration:

# config/packages/setono_sylius_shipping_countdown.yaml
imports:
    - { resource: "@SetonoSyliusShippingCountdownPlugin/Resources/config/app/config.yaml" }

    # Uncomment next line if you're using Webpack Encore
    # - { resource: "@SetonoSyliusShippingCountdownPlugin/Resources/config/app/config_webpack.yaml" }
    
    # You can also import example fixtures to play
    # - { resource: "@SetonoSyliusShippingCountdownPlugin/Resources/config/app/fixtures.yaml" }

# If you want to use caching - add next configuration:
framework:
    cache:
        pools:
            app.shipping_countdown_cache_pool:
                adapter: cache.app

setono_sylius_shipping_countdown:
    cache:
        pool: app.shipping_countdown_cache_pool
        enabled: true

Import routing:

# config/routes/setono_sylius_shipping_countdown.yaml
setono_sylius_shipping_countdown:
    resource: "@SetonoSyliusShippingCountdownPlugin/Resources/config/routes.yaml"

or if your app doesn't use locales:

# config/routes.yaml
setono_sylius_shipping_countdown:
    resource: "@SetonoSyliusShippingCountdownPlugin/Resources/config/routes_no_locale.yaml"

Add plugin class to your bundles.php:

Make sure you add it before SyliusGridBundle, otherwise you'll get You have requested a non-existent parameter "setono_sylius_shipping_countdown.model.shipping_schedule.class". exception.

<?php
$bundles = [
    // ...
    Setono\SyliusShippingCountdownPlugin\SetonoSyliusShippingCountdownPlugin::class => ['all' => true],
    Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true],
    // ...
];

Update your database:

bin/console doctrine:migrations:diff
bin/console doctrine:migrations:migrate

Install assets:

php bin/console assets:install

Clear cache:

php bin/console cache:clear

Debug schedule

You can use setono:shipping-countdown:debug command to debug schedule.

Examples:

bin/console setono:shipping-countdown:debug
bin/console setono:shipping-countdown:debug '+1 day'
bin/console setono:shipping-countdown:debug '2021-04-29 16:29'
bin/console setono:shipping-countdown:debug '2021-04-29 16:31'