tahir-rasheed/sylius-bulk-price-edit-plugin

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Bulk price edit plugin for Sylius.

v0.1.0 2020-10-07 09:53 UTC

README

Latest Version Latest Unstable Version Software License Build Status Code Coverage

This plugin is a proof of concept of something great to be.

Installation

Download

$ composer require tahir-rasheed/sylius-bulk_price-edit-plugin

Import configuration

# config/packages/sylius_bulk_edit.yaml
imports:
    # ...
    - { resource: "@TahirRasheedSyliusBulkEditPlugin/Resources/config/app/config.yaml" }

Import routes

# config/routes/sylius_bulk_edit.yaml
setono_sylius_bulk_edit:
    resource: "@TahirRasheedSyliusBulkEditPlugin/Resources/config/routes.yaml"

or if your app doesn't use locales:

# config/routes.yaml
setono_sylius_bulk_edit:
    resource: "@TahirRasheedSyliusBulkEditPlugin/Resources/config/routes_no_locale.yaml"

Add plugin class to your bundles.php:

<?php
$bundles = [
    // ...

    TahirRasheed\SyliusBulkEditPlugin\TahirRasheedSyliusBulkEditPlugin::class => ['all' => true],

    // ...
];

Extend resource classes

Extend ProductRepository

<?php

# src/Doctrine/ORM/ProductRepository.php

declare(strict_types=1);

namespace App\Doctrine\ORM;

use Setono\SyliusBulkEditPlugin\Doctrine\ORM\ProductRepositoryTrait;
use Setono\SyliusBulkEditPlugin\Repository\ProductRepositoryInterface;
use Sylius\Bundle\CoreBundle\Doctrine\ORM\ProductRepository as BaseProductRepository;

class ProductRepository extends BaseProductRepository implements ProductRepositoryInterface
{
    use ProductRepositoryTrait;
}

Add configuration

# config/packages/_sylius.yaml
sylius_product:
    resources:
        product:
            classes:
                repository: App\Doctrine\ORM\ProductRepository

Done!

Go to /admin/products, select a few products and click the Edit button.