setono / sylius-order-edit-plugin
Setono example plugin for Sylius.
Fund package maintenance!
Setono
Installs: 734
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 4
Type:sylius-plugin
Requires
- php: >=8.1
- doctrine/orm: ^2.0 || ^3.0
- doctrine/persistence: ^2.0 || ^3.0
- sylius/admin-bundle: ^1.0
- sylius/core: ^1.0
- sylius/core-bundle: ^1.0
- sylius/grid-bundle: ^1.0
- sylius/money-bundle: ^1.0
- sylius/order: ^1.0
- sylius/order-bundle: ^1.0
- sylius/resource-bundle: ^1.6
- symfony/config: ^5.4 || ^6.4 || ^7.0
- symfony/dependency-injection: ^5.4 || ^6.4 || ^7.0
- symfony/event-dispatcher: ^5.4 || ^6.4 || ^7.0
- symfony/form: ^5.4 || ^6.4 || ^7.0
- symfony/http-foundation: ^5.4 || ^6.4 || ^7.0
- symfony/http-kernel: ^5.4 || ^6.4 || ^7.0
- symfony/messenger: ^5.4 || ^6.4 || ^7.0
- symfony/options-resolver: ^5.4 || ^6.4 || ^7.0
- symfony/routing: ^5.4 || ^6.4 || ^7.0
- symfony/translation: ^5.4 || ^6.4 || ^7.0
- webmozart/assert: ^1.11
Requires (Dev)
- api-platform/core: ^2.7.16
- babdev/pagerfanta-bundle: ^3.8
- behat/behat: ^3.14
- doctrine/doctrine-bundle: ^2.11
- infection/infection: ^0.27.10
- jms/serializer-bundle: ^4.2
- lexik/jwt-authentication-bundle: ^2.17
- matthiasnoback/symfony-dependency-injection-test: ^4.3 || ^5.1
- phpspec/prophecy-phpunit: ^2.2
- phpunit/phpunit: ^9.6.17
- psalm/plugin-phpunit: ^0.18.4
- setono/code-quality-pack: ^2.7
- sylius/sylius: ~1.12.13
- symfony/browser-kit: ^5.4 || ^6.4 || ^7.0
- symfony/debug-bundle: ^5.4 || ^6.4 || ^7.0
- symfony/dotenv: ^5.4 || ^6.4 || ^7.0
- symfony/intl: ^5.4 || ^6.4 || ^7.0
- symfony/property-info: ^5.4 || ^6.4 || ^7.0
- symfony/serializer: ^5.4 || ^6.4 || ^7.0
- symfony/web-profiler-bundle: ^5.4 || ^6.4 || ^7.0
- symfony/webpack-encore-bundle: ^1.17.2
- symfony/workflow: ^6.4
- willdurand/negotiation: ^3.1
Conflicts
- doctrine/annotations: <1.13.2
- doctrine/data-fixtures: <1.5.1
This package is auto-updated.
Last update: 2024-11-02 08:42:54 UTC
README
Edit orders inside your admin interface.
Install
composer require setono/sylius-order-edit-plugin
Import routing
# config/routes/setono_sylius_order_edit.yaml setono_sylius_order_edit: resource: "@SetonoSyliusOrderEditPlugin/Resources/config/routes.yaml"
If you're using Sylius <=1.10, also import additional product variant routes:
setono_sylius_order_edit_product_variant: resource: "@SetonoSyliusOrderEditPlugin/Resources/config/routes/product_variant.yaml"
and remember to add the referenced ProductVariantRepository
methods (findByCodes
and findByPhrase
).
Extend the Order
entity
<?php declare(strict_types=1); namespace App\Entity\Order; use Doctrine\ORM\Mapping as ORM; use Setono\SyliusOrderEditPlugin\Entity\EditableOrderInterface; use Setono\SyliusOrderEditPlugin\Entity\EditableOrderTrait; use Sylius\Component\Core\Model\Order as BaseOrder; #[ORM\Entity] #[ORM\Table(name: 'sylius_order')] class Order extends BaseOrder implements EditableOrderInterface { use EditableOrderTrait; }
Update your database schema
php bin/console doctrine:migrations:diff php bin/console doctrine:migrations:migrate
The plugin adds a new field to the Order
entity named initialTotal
which will contain the order total and is used when editing orders.
To set the initialTotal
field for existing orders, you can add the following to your migration:
<?php // ... public function up(Schema $schema): void { // ... $this->addSql('UPDATE sylius_order SET initial_total = total'); } // ...
Done!
You should be able to edit orders in your admin interface. Enjoy 🎉