|
11 | 11 |
|
12 | 12 | ## Installation |
13 | 13 |
|
| 14 | +0. This plugin requires the [MyOnlineStore/ViesBundle](https://github.com/MyOnlineStore/ViesBundle) but this is not actually compatible with Symfony 7, there is an open PR: https://github.com/MyOnlineStore/ViesBundle/pull/18 |
| 15 | + |
| 16 | + Thus, you have to run the following command to require a fork of the bundle which is compatible with Symfony 7: |
| 17 | + |
| 18 | + ```bash |
| 19 | + composer config repositories.sandwich/vies-bundle git https://github.com/mmenozzi/ViesBundle.git |
| 20 | + ``` |
| 21 | + |
| 22 | + and you have to run this command too to allow "dev" versions of the bundle (we need the "dev-patch-1" version): |
| 23 | + |
| 24 | + ```bash |
| 25 | + composer config minimum-stability dev |
| 26 | + ``` |
| 27 | + |
14 | 28 | 1. Require the plugin: |
15 | 29 |
|
16 | 30 | ```bash |
17 | 31 | composer require webgriffe/sylius-italian-invoiceable-order-plugin |
18 | 32 | ``` |
19 | 33 |
|
20 | | -2. Add bundles to `config/bundles.php` file: |
| 34 | +2. If they have not been added automatically, you have to add these bundles to `config/bundles.php` file: |
21 | 35 |
|
22 | 36 | ```php |
23 | 37 | Sandwich\ViesBundle\SandwichViesBundle::class => ['all' => true], |
24 | 38 | Webgriffe\SyliusItalianInvoiceableOrderPlugin\WebgriffeSyliusItalianInvoiceableOrderPlugin::class => ['all' => true], |
25 | 39 | ``` |
26 | 40 |
|
| 41 | +3. Configure your ActiveCampaign API connection parameters by creating the `config/packages/webgriffe_sylius_italian_invoiceable_order_plugin.yaml` file with the following content: |
| 42 | + ```yaml |
| 43 | + imports: |
| 44 | + - { resource: "@WebgriffeSyliusItalianInvoiceableOrderPlugin/config/config.yaml" } |
| 45 | + ``` |
| 46 | +
|
27 | 47 | 3. By default, the parameter `app.taxation.eu_zone_code` is set to "EU", as it must be the code of a zone representing the EU. This is used to determine if an order is invoiced to a company within the EU or not. Please change this parameter according to your Sylius's zone configuration if needed: |
28 | 48 |
|
29 | 49 | ```yaml |
|
40 | 60 |
|
41 | 61 | ```bash |
42 | 62 | mkdir -p config/validator/ |
43 | | - cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/TestApplication/config/validator/Address.xml config/validator/ |
44 | | - cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/TestApplication/config/validator/Order.xml config/validator/ |
| 63 | + cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/TestApplication/config/validation/Address.xml config/validator/ |
| 64 | + cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/TestApplication/config/validation/Order.xml config/validator/ |
45 | 65 | ``` |
46 | 66 |
|
47 | | - Or by merging the configuration into your existing `Address` and `Order` validator configuration. |
| 67 | + **WAIT! We are not done with this step yet.** You must edit these files to change the namespace `Tests\Webgriffe\SyliusItalianInvoiceableOrderPlugin` to your own project namespace: there are 3 references that you have to change among these files. |
| 68 | + |
| 69 | + If you have the "App" as the base namespace of your app, this command should be enough: |
| 70 | + |
| 71 | + Linux: |
| 72 | + ```bash |
| 73 | + sed -i 's/Tests\\Webgriffe\\SyliusItalianInvoiceableOrderPlugin/App/g' config/validator/Address.xml config/validator/Order.xml |
| 74 | + ``` |
| 75 | + |
| 76 | + MacOS: |
| 77 | + ```bash |
| 78 | + sed -i '' 's/Tests\\Webgriffe\\SyliusItalianInvoiceableOrderPlugin/App/g' config/validator/Address.xml config/validator/Order.xml |
| 79 | + ``` |
| 80 | + |
| 81 | + If you alread have some validator file for these entities you have to merge the configuration manually. |
48 | 82 |
|
49 | 83 | 7. Configure Sylius to use the `Italian tax calculation` tax calculation strategy. |
50 | 84 |
|
51 | 85 | 8. To properly enable group sequence validation of your Address entity you must set the `Default` validation group instead of the `sylius` validation group: |
52 | 86 |
|
53 | 87 | ```yaml |
54 | | - # config/services.yaml |
| 88 | + # config/parameters.yaml |
55 | 89 | parameters: |
56 | 90 | # ... |
57 | 91 | sylius.form.type.address.validation_groups: ['Default'] |
|
62 | 96 | 9. Run migration |
63 | 97 |
|
64 | 98 | ```bash |
65 | | - vendor/bin/console cache:clear |
66 | | - vendor/bin/console doctrine:migrations:migrate |
| 99 | + bin/console cache:clear |
| 100 | + bin/console doctrine:migrations:migrate |
67 | 101 | ``` |
68 | 102 |
|
69 | | - |
70 | 103 | 10. Add invoiceable fields to the address show template for admin. To do so you have to override this template: |
71 | 104 |
|
72 | 105 | ```bash |
|
76 | 109 | by copying directly our implementation provided in the plugin: |
77 | 110 |
|
78 | 111 | ```bash |
79 | | - cp tests/TestApplication/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig |
| 112 | + mkdir -p templates/bundles/SyliusAdminBundle/shared/helper/ |
| 113 | + cp vendor/webgriffe/sylius-italian-invoiceable-order-plugin/tests/TestApplication/templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig templates/bundles/SyliusAdminBundle/shared/helper/address.html.twig |
80 | 114 | ``` |
81 | 115 |
|
82 | 116 | or by copying the original template and adding the invoiceable fields by yourself. In this case your template should look like the following: |
|
0 commit comments