-
Require plugin with composer:
composer require sylius/invoicing-plugin
-
Add plugin class to your
AppKernel:$bundles = [ new \Knp\Bundle\SnappyBundle\KnpSnappyBundle(), new \Sylius\InvoicingPlugin\SyliusInvoicingPlugin(), ];
-
Import configuration:
imports: - { resource: "@SyliusInvoicingPlugin/Resources/config/config.yml" }
-
Import routing:
sylius_invoicing_plugin_admin: resource: "@SyliusInvoicingPlugin/Resources/config/app/routing/admin_invoicing.yml" prefix: /admin sylius_invoicing_plugin_shop: resource: "@SyliusInvoicingPlugin/Resources/config/app/routing/shop_invoicing.yml" prefix: /{_locale} requirements: _locale: ^[a-z]{2}(?:_[A-Z]{2})?$
-
Check if you have
wkhtmltopdfbinary. If not, you can download it here.In case
wkhtmltopdfis not located in/usr/local/bin/wkhtmltopdf, add a following snippet at the end of your application'sconfig.yml:knp_snappy: pdf: enabled: true binary: /usr/local/bin/wkhtmltopdf # Change this! :) options: []
-
Copy plugin migrations to your migrations directory (e.g.
src/Migrations) and apply them to your database:cp -R vendor/sylius/invoicing-plugin/migrations/* src/Migrations bin/console doctrine:migrations:migrate -
Override Channel entity:
a) Write new class which will use
ShopBillingDataTraitand implementShopBillingDataAwareInterface:<?php namespace AppBundle\Entity; use Doctrine\ORM\Mapping\MappedSuperclass; use Doctrine\ORM\Mapping\Table; use Sylius\Component\Core\Model\Channel as BaseChannel; use Sylius\InvoicingPlugin\Entity\ShopBillingDataAwareInterface; use Sylius\InvoicingPlugin\Entity\ShopBillingDataTrait; /** * @MappedSuperclass * @Table(name="sylius_channel") */ class Channel extends BaseChannel implements ShopBillingDataAwareInterface { use ShopBillingDataTrait; }
b) And override the model's class in the
app/config/config.yml:sylius_channel: resources: channel: classes: model: AppBundle\Entity\Channel
-
Clear cache:
bin/console cache:clear