Skip to content

Elastic-Suite/gally-sylius-connector

Gally Plugin for Sylius

Requirements

  • Gally version: 1.3.x
  • Sylius version: 1.12.x

Usage

  • Install the gally/sylius-plugin bundle
    • Run composer require gally/sylius-plugin
    • Add the bundle in config/bundles.php. You must put it after SyliusGridBundle
      [...]
      Gally\SyliusPlugin\GallySyliusPlugin::class => ['all' => true],
    • Import the Gally Sylius bundle configuration by adding the following lines to the imports section of config/packages/_sylius.yaml
      - { resource: "@GallySyliusPlugin/Resources/config/config.yml" }
    • Import admin routes by creating a file config/routes/gally_admin.yaml
      gally_admin:
          resource: "@GallySyliusPlugin/Resources/config/admin_routing.yml"
          prefix: /admin
    • Import shop routes by creating a file config/routes/gally_shop.yaml
      gally_shop:
          resource: "@GallySyliusPlugin/Resources/config/shop_routing.yml"
          prefix: /{_locale}
    • Implement the Gally\SyliusPlugin\Model\GallyChannelInterface and Gally\SyliusPlugin\Model\GallyChannelTrait in your Channel Entity src/App/Entity/Channel/Channel.php.
    <?php
    
    declare(strict_types=1);
    
    namespace App\Entity\Channel;
    
    use Doctrine\ORM\Mapping as ORM;
    use Gally\SyliusPlugin\Model\GallyChannelInterface;
    use Gally\SyliusPlugin\Model\GallyChannelTrait;
    use Sylius\Component\Core\Model\Channel as BaseChannel;
    
    /**
     * @ORM\Entity
     * @ORM\Table(name="sylius_channel")
     */
     #[ORM\Entity]
     #[ORM\Table(name: 'sylius_channel')]
     class Channel extends BaseChannel implements GallyChannelInterface
     {
        use GallyChannelTrait;
     }
    • Copy the templates from vendor/gally/sylius-plugin/src/Resources/views/SyliusShopBundle/ to templates/bundles/SyliusShopBundle/.
    • Copy the bundle assets (Javascript & CSS files):
      • Run php bin/console assets:install
      • Run php bin/console sylius:install:assets
      • Run php bin/console sylius:theme:assets:install
    • Run php bin/console doctrine:migrations:diff and php bin/console doctrine:migrations:migrate to update the database schema
    • Open Sylius Admin, head to Configuration > Gally and configure the Gally endpoint (URL, credentials)
  • Run this commands from your Sylius instance. This commands must be runned only once to synchronize the structure.
        bin/console gally:structure:sync   # Sync catalog et source field data with gally
  • Run a full index from Sylius to Gally. This command can be run only once. Afterwards, the modified products are automatically synchronized.
        bin/console gally:index            # Index category and product entity to gally
  • At this step, you should be able to see your product and source field in the Gally backend.
  • They should also appear in your Sylius frontend when searching or browsing categories.
  • And you're done !
  • You can also run the command to clean data that are not present in sylius anymore:
        bin/console gally:structure:clean 

noUiSlider

This bundle includes the noUiSlider distribution files. noUiSlider is "a lightweight, ARIA-accessible JavaScript range slider with multi-touch and keyboard support" which is used in this project for the price slider implementation.