fabit / sylius-odoo-product-plugin
Odoo product sync plugin for Sylius applications.
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Type:sylius-plugin
Requires
- php: ^7.4|^8.0|^8.1
- fabit/sylius-odoo-core-plugin: ^1.0
- lakion/mink-debug-extension: ^2.0
- sylius/sylius: ^1.10
- symfony/lock: ^4.0|^5.0
- symfony/messenger: ^4.0|^5.0
Requires (Dev)
- behat/behat: ^3.4
- behat/mink: ^1.7@dev
- behat/mink-browserkit-driver: ^1.3
- behat/mink-extension: ^2.2
- behat/mink-selenium2-driver: ^1.3
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.0
- friends-of-behat/symfony-extension: ^2.0
- friends-of-behat/variadic-extension: ^1.1
- phpstan/phpstan: ^1.4
- phpunit/phpunit: ^8.0
- sensiolabs/security-checker: ^5.0
- sylius-labs/coding-standard: ^4.3
- symfony/browser-kit: ^3.4|^4.3|^5.0
- symfony/debug-bundle: ^3.4|^4.3|^5.0
- symfony/dotenv: ^4.3|^5.0
- symfony/intl: ^3.4|^4.3|^5.0
- symfony/web-profiler-bundle: ^3.4|^4.3|^5.0
- symfony/web-server-bundle: ^3.4|^4.3|^5.0
- symplify/easy-coding-standard: ^10.1
This package is not auto-updated.
Last update: 2025-03-05 02:53:30 UTC
README
Fabit Odoo Product Plugin Skeleton
This plugin sync Odoo products into SyliusDocumentation
For a comprehensive guide on Sylius plugin development please go to Sylius documentation, there you will find the Plugin Development Guide, that is full of examples.
Quickstart Installation
- Create new file [project]/]config/packages/sylius_odoo_product.yaml and copy configuraiton into it
sylius_odoo_product: data_transform: product: mapping: - sylius_field: id odoo_field: id required: true default: '' allow_types: [int, 'null'] - sylius_field: productTmplId odoo_field: product_tmpl_id required: true default: '' allow_types: [int, 'null'] - sylius_field: code odoo_field: code required: true default: '' allow_types: [string, 'null'] - sylius_field: name odoo_field: name required: true default: '' allow_types: [string, 'null'] - sylius_field: description odoo_field: description required: true default: '' allow_types: [string, 'null'] - sylius_field: categId odoo_field: categ_id required: false default: [ ] allow_types: [array] - sylius_field: lst_price odoo_field: lst_price required: true default: '' allow_types: [float] - sylius_field: taxes_id odoo_field: taxes_id required: false default: [ ] allow_types: [array] - sylius_field: image1920 odoo_field: image_1920 required: true default: null allow_types: [string, boolean, 'null'] - sylius_field: active odoo_field: active required: true default: null allow_types: [string, boolean, 'null'] tax: mapping: - sylius_field: code odoo_field: id required: true default: '' allow_types: [string, 'null'] - sylius_field: name odoo_field: name required: true default: '' allow_types: [string, 'null'] - sylius_field: description odoo_field: description required: true default: '' allow_types: [string, 'null', 'bool'] - sylius_field: amount odoo_field: amount required: true default: '' allow_types: [float, 'null'] category: mapping: - sylius_field: code odoo_field: id required: true default: '' allow_types: [string, 'null'] - sylius_field: name odoo_field: name required: true default: '' allow_types: [string, 'null'] - sylius_field: parent odoo_field: parent_id required: true default: '' allow_types: [string, 'null']
-
Run composer to add dependancy
composer require fabit/sylius-odoo-product-plugin
-
Add following entry in
config/bundles.php
Fabit\SyliusOdooProductPlugin\SyliusOdooProductPlugin::class => ['all' => true]
-
Add route entry in
config/routes.yaml
fabit_sylius_odoo_product_plugin: resource: "@SyliusOdooProductPlugin/Resources/config/routing.yaml"
- Override the Product Entity
src/Entity/Product/Product.php
, Add ProductTrait to your Product entity
namespace App\Entity\Product; use Doctrine\ORM\Mapping as ORM; use Sylius\Component\Core\Model\Product as BaseProduct; use Sylius\Component\Product\Model\ProductTranslationInterface; use Fabit\SyliusOdooProductPlugin\Traits\ProductTrait; /** * @ORM\Entity * @ORM\Table(name="sylius_product", indexes={ * @ORM\Index(name="sylius_odoo_product_plugin_odoo_product_tmpl_id", columns={"odoo_product_tmpl_id"}) * }) */ class Product extends BaseProduct { use ProductTrait;
- Override the ProductVariant Entity
src/Entity/Product/ProductVariant.php
, Add ProductVariantTrait to your ProductVariant entity
namespace App\Entity\Product; use Doctrine\ORM\Mapping as ORM; use Sylius\Component\Core\Model\ProductVariant as BaseProductVariant; use Sylius\Component\Product\Model\ProductVariantTranslationInterface; use Fabit\SyliusOdooProductPlugin\Traits\ProductVariantTrait; /** * @ORM\Entity * @ORM\Table(name="sylius_product_variant", indexes={ * @ORM\Index(name="sylius_odoo_product_plugin_odoo_product_variant_id", columns={"odoo_product_variant_id"}) * }) */ class ProductVariant extends BaseProductVariant { use ProductVariantTrait;
-
Add following variables in .env file
###> fabit/sylius-odoo-product-plugin ### odoo_url=https://demo.odoo.com odoo_db=odoo-datbase odoo_user=odoo-user odoo_password=odoo-password odoo_live_stock=True odoo_enable=1 ###> fabit/sylius-odoo-product-plugin ###
Sylius basic intallation
-
Run following command to install install Sylius
php bin/console sylius:install
- note: on a demo Odoo, use
en_EN
as localization
- note: on a demo Odoo, use
-
Make sure media directory has write permission
-
Setup Country & Zone
INSERT INTO `sylius_country` (`id`, `code`, `enabled`) VALUES (NULL, 'FR', 1); INSERT INTO `sylius_zone` (`id`, `code`, `name`, `type`, `scope`) VALUES (NULL, 'FR', 'France', 'country', 'all'); INSERT INTO `sylius_zone_member` (`id`, `belongs_to`, `code`) VALUES (NULL, 1, 'FR');
Execute Odoo commands
-
Update database table, Run command to update database schema
php bin/console doctrine:schema:update --force
-
Run following command to import all categories
php bin/console odoo:category:import
-
Run following command to import all taxes
php bin/console odoo:tax:import
-
Run following command to import all taxes
php bin/console odoo:product:import
Sylius after Odoo Sync
- Choose Odoo category "All" in Configuration -> Channel
- Choose Delivery method
- Choose Payment method
! ENJOY THE DEMO !