Skip to content

Latest commit

 

History

History
147 lines (120 loc) · 3.99 KB

installation.md

File metadata and controls

147 lines (120 loc) · 3.99 KB

Installation

Overview:

GENERAL


FRONTEND


ADDITIONAL


Requirements:

We work on stable, supported and up-to-date versions of packages. We recommend you to do the same.

Package Version
PHP >=8.0
sylius/sylius 1.12.x - 1.13.x
MySQL >= 5.7
NodeJS >= 18.x

Composer:

composer require bitbag/product-attribute-groups-plugin --no-scripts

Basic configuration:

Add plugin dependencies to your config/bundles.php file:

# config/bundles.php

return [
    ...
    BitBag\SyliusProductAttributeGroupsPlugin\BitBagSyliusProductAttributeGroupsPlugin::class => ['all' => true],
];

Import required config in your config/packages/_sylius.yaml file:

# config/packages/_sylius.yaml

imports:
    ...
    - { resource: "@BitBagSyliusProductAttributeGroupsPlugin/Resources/config/config.yml" }

Add routing to your config/routes.yaml file:

# config/routes.yaml

bitbag_product_attribute_groups_plugin:
    resource: "@BitBagSyliusProductAttributeGroupsPlugin/Resources/config/routing.yml"

Update your database

First, please run legacy-versioned migrations by using command:

bin/console doctrine:migrations:migrate

After migration, please create a new diff migration and update database:

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

Clear application cache by using command:

bin/console cache:clear

Note: If you are running it on production, add the -e prod flag to this command.

Templates

Copy required templates into correct directories in your project.

AdminBundle (templates/bundles/SyliusAdminBundle):

vendor/bitbag/product-attribute-groups-plugin/tests/Application/templates/bundles/SyliusAdminBundle/Product/Attribute/attributeChoice.html.twig
vendor/bitbag/product-attribute-groups-plugin/tests/Application/templates/bundles/SyliusAdminBundle/ProductAttribute/_form.html.twig

Webpack

Webpack.config.js

Please setup your webpack.config.js file to require the plugin's webpack configuration. To do so, please put the line below somewhere on top of your webpack.config.js file:

const [ bitbagProductAttributeGroupsAdmin ] = require('./vendor/bitbag/product-attribute-groups-plugin/webpack.config.js')

As next step, please add the imported consts into final module exports:

module.exports = [..., bitbagProductAttributeGroupsAdmin];

Assets

Add the asset configuration into config/packages/assets.yaml:

framework:
    assets:
        packages:
            ...
            product_attribute_groups_admin:
                json_manifest_path: '%kernel.project_dir%/public/build/bitbag/productAttributeGroups/admin/manifest.json'

Webpack Encore

Add the webpack configuration into config/packages/webpack_encore.yaml:

webpack_encore:
    output_path: '%kernel.project_dir%/public/build/default'
    builds:
        ...
        product_attribute_groups_admin: '%kernel.project_dir%/public/build/bitbag/productAttributeGroups/admin'

Encore functions

Add encore functions to your templates:

SyliusAdminBundle:

{# @SyliusAdminBundle/_scripts.html.twig #}
{{ encore_entry_script_tags('bitbag-productAttributeGroups-admin', null, 'product_attribute_groups_admin') }}

{# @SyliusAdminBundle/_styles.html.twig #}
{{ encore_entry_link_tags('bitbag-productAttributeGroups-admin', null, 'product_attribute_groups_admin') }}

Run commands

yarn install
yarn encore dev # or prod, depends on your environment

Known issues

Translations not displaying correctly

For incorrectly displayed translations, execute the command:

bin/console cache:clear