Skip to content

Commit

Permalink
Add gally plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreGauthier committed Nov 21, 2023
1 parent d3c20ab commit 69a2c36
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 19 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
],
"require": {
"php": "^8.0",
"gally/sylius-plugin": "dev-master",
"sylius/paypal-plugin": "^1.5",
"sylius/sylius": "^1.12.11",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/runtime": "^5.4 || ^6.0",
"symfony/flex": "^2.1"
"symfony/flex": "^2.1",
"symfony/runtime": "^5.4 || ^6.0"
},
"require-dev": {
"behat/behat": "^3.7",
Expand Down
1 change: 1 addition & 0 deletions config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@
SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true],
League\FlysystemBundle\FlysystemBundle::class => ['all' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
Gally\SyliusPlugin\GallySyliusPlugin::class => ['all' => true],
];
1 change: 1 addition & 0 deletions config/packages/_sylius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ imports:

- { resource: "@SyliusShopBundle/Resources/config/app/config.yml" }
- { resource: "@SyliusPayPalPlugin/Resources/config/config.yaml" }
- { resource: "@GallySyliusPlugin/Resources/config/config.yml" }

parameters:
sylius_core.public_dir: '%kernel.project_dir%/public'
Expand Down
3 changes: 3 additions & 0 deletions config/routes/gally_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gally_admin:
resource: "@GallySyliusPlugin/Resources/config/admin_routing.yml"
prefix: /admin
17 changes: 1 addition & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
context: .
target: sylius_php_dev
depends_on:
- migrations
- mysql
environment:
- APP_ENV=dev
- APP_DEBUG=1
Expand All @@ -22,21 +22,6 @@ services:
# - ./public/media:/srv/sylius/public/media:rw
- public-media:/srv/sylius/public/media:rw

migrations:
container_name: migrations
build:
context: .
target: sylius_migrations_dev
depends_on:
- mysql
environment:
- APP_ENV=dev
- APP_DEBUG=1
- APP_SECRET=EDITME
- DATABASE_URL=mysql://sylius:${MYSQL_PASSWORD:-nopassword}@mysql/sylius
- LOAD_FIXTURES=1
- PHP_DATE_TIMEZONE=${PHP_DATE_TIMEZONE:-UTC}

mysql:
container_name: mysql
image: mysql:5.7 # Sylius is fully working on mysql 8.0 version
Expand Down
5 changes: 4 additions & 1 deletion src/Entity/Channel/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
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;

/**
Expand All @@ -13,6 +15,7 @@
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_channel')]
class Channel extends BaseChannel
class Channel extends BaseChannel implements GallyChannelInterface
{
use GallyChannelTrait;
}
35 changes: 35 additions & 0 deletions src/Migrations/Version20231120150637.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

namespace App\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20231120150637 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE gally_configuration CHANGE id id INT AUTO_INCREMENT NOT NULL');
$this->addSql('ALTER TABLE sylius_channel ADD gally_active TINYINT(1) NOT NULL, ADD gally_product_index_batch_size INT NOT NULL, ADD gally_category_index_batch_size INT NOT NULL');
$this->addSql('ALTER TABLE messenger_messages CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE available_at available_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE delivered_at delivered_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE gally_configuration CHANGE id id INT NOT NULL');
$this->addSql('ALTER TABLE messenger_messages CHANGE created_at created_at DATETIME NOT NULL, CHANGE available_at available_at DATETIME NOT NULL, CHANGE delivered_at delivered_at DATETIME DEFAULT NULL');
$this->addSql('ALTER TABLE sylius_channel DROP gally_active, DROP gally_product_index_batch_size, DROP gally_category_index_batch_size');
}
}
3 changes: 3 additions & 0 deletions symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@
"ref": "258300d52be6ad59b32a888d5ddafbf9638540ff"
}
},
"gally/sylius-plugin": {
"version": "dev-master"
},
"gedmo/doctrine-extensions": {
"version": "v2.4.36"
},
Expand Down
21 changes: 21 additions & 0 deletions templates/bundles/SyliusShopBundle/Product/Index/_search.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<div class="ui segment">
<form method="get" action="{{ path('sylius_shop_product_index', {'slug': app.request.attributes.get('slug')}) }}" class="ui loadable form">
<div class="ui stackable grid" id="searchbar">
<div class="column" id="searchbarTextField">
{% for filter in products.definition.enabledFilters %}
{% if filter.type == 'shop_string' %}
{{ sylius_grid_render_filter(products, filter) }}
{% endif %}
{% endfor %}
</div>
<div class="right aligned column" id="searchbarButtons">
<div class="ui buttons">
<button type="submit" class="ui primary icon labeled button" {{ sylius_test_html_attribute('search') }}><i class="search icon"></i> {{ 'sylius.ui.search'|trans }}</button>
<a href="{{ path('sylius_shop_product_index', {'slug': app.request.attributes.get('slug')}) }}" class="ui negative icon labeled button" {{ sylius_test_html_attribute('clear') }}>
<i class="cancel icon"></i> {{ 'sylius.ui.clear'|trans }}
</a>
</div>
</div>
</div>
</form>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{ render(url('sylius_shop_partial_taxon_show_by_slug', {
'slug': app.request.attributes.get('slug'),
'template': '@SyliusShop/Taxon/_verticalMenu.html.twig',
})) }}

{{ sylius_template_event('sylius.shop.product.index.filters', {'products': products}) }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% if resources.data.nbResults > 0 %}

{% set route = app.request.attributes.get('_route') %}
{% set route_parameters = app.request.attributes.all('_route_params')|merge(app.request.query.all) %}
{% set criteria = app.request.query.all('criteria') %}

<div class="ui right floated small header">
<div class="content">
{{ 'sylius.ui.sort'|trans }}
<div class="ui inline dropdown">
<div class="text">{{ current_sorting_label }}</div>
<i class="dropdown icon"></i>
<div class="menu">
{% for option in sort_options %}
{% set sort_path = path(route, route_parameters|merge({'sorting': option.sorting, 'criteria': criteria})) %}

<a class="item" href="{{ sort_path }}" data-text="{{ option.label }}">{{ option.label }}</a>
{% endfor %}
</div>
</div>
</div>
</div>
{% endif %}

0 comments on commit 69a2c36

Please sign in to comment.