|
| 1 | +# Installation |
| 2 | +1. Add package to your project via composer: |
| 3 | + ```bash |
| 4 | + composer require bitbag/user-com-plugin |
| 5 | + ``` |
| 6 | + >If `bitbag/user-com-plugin` is not found by composer, try adding repository to your `composer.json` file: |
| 7 | + > ```json |
| 8 | + > "repositories": [ |
| 9 | + > { |
| 10 | + > "type": "vcs", |
| 11 | + > "url": "https://github.com/BitBagCommerce/SyliusUserComPlugin.git" |
| 12 | + > }, |
| 13 | + > ], |
| 14 | + > ``` |
| 15 | +2. Add required environment variables to your `.env` file: |
| 16 | + ```dotenv |
| 17 | + USER_COM_FRONTEND_API_KEY="" |
| 18 | + TAG_MANAGER_ID="" |
| 19 | + ``` |
| 20 | +3. Add plugin dependencies to config/bundles.php file: |
| 21 | + ```php |
| 22 | + return [ |
| 23 | + ... |
| 24 | + BitBag\SyliusUserComPlugin\BitBagSyliusUserComPlugin::class => ['all' => true], |
| 25 | + Spinbits\SyliusGoogleAnalytics4Plugin\SpinbitsSyliusGoogleAnalytics4Plugin::class => ['all' => true], |
| 26 | + ... |
| 27 | + ]; |
| 28 | + ``` |
| 29 | +4. Import required config in your `config/packages/_sylius.yaml` file: |
| 30 | + ```yaml |
| 31 | + imports: |
| 32 | + ... |
| 33 | + - { resource: "@BitBagSyliusUserComPlugin/config/config.yml" } |
| 34 | + ... |
| 35 | + ``` |
| 36 | +5. Extend `Channel` entity `UserComApiAwareTrait` and implement `UserComApiAwareInterface` |
| 37 | + ```php |
| 38 | + class Channel extends BaseChannel implements ChannelInterface |
| 39 | + { |
| 40 | + use UserComApiAwareTrait; |
| 41 | + } |
| 42 | + ``` |
| 43 | + |
| 44 | + ```php |
| 45 | + interface ChannelInterface extends BaseChannelInterface, UserComApiAwareInterface |
| 46 | + { |
| 47 | + } |
| 48 | + ``` |
| 49 | + >`UserComApiAwareTrait` contains mapping for annotations and for attributes which are required by UserCom integration. |
| 50 | + > If you're using xml mapping, you should add mapping for those properties in your `Channel.orm.xml` file. |
| 51 | +
|
| 52 | +6. Take advantage of channel based configuration of GoogleAnalyticsPlugin by adding : |
| 53 | + ```yaml |
| 54 | + spinbits_sylius_google_analytics4: |
| 55 | + id: "%env(TAG_MANAGER_ID)%" |
| 56 | + channels_ids: |
| 57 | + FASHION_WEB: "G-DF1P3RRJ8S" |
| 58 | + OTHER_CHANNEL: "G-WX1RJ8SP3R" |
| 59 | + ``` |
0 commit comments