Skip to content

Instantly share code, notes, and snippets.

Avatar

kurozumi kurozumi

View GitHub Profile
@kurozumi
kurozumi / index.twig
Created Jul 14, 2021
会員グループ管理::会員登録アドオン for EC-CUBE4で指定したパラメータ付きのURLで新規会員登録ページにアクセスすると新規会員登録完了時に会員グループが付与されるカスタマイズ方法
View index.twig
{% if app.request.get('type') == 'entry' or app.request.method == 'POST' %}
{{ include('@CustomerGroupEntry/default/Entry/hidden.twig', ignore_missing=true) }}
{% endif %}
@kurozumi
kurozumi / ShoppingCompleteListener.php
Created Jul 13, 2021
購入完了ページで会員に会員グループを設定する処理
View ShoppingCompleteListener.php
<?php
/**
* This file is part of CustomerGroupProduct
*
* Copyright(c) Akira Kurozumi <info@a-zumi.net>
*
* https://a-zumi.net
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@kurozumi
kurozumi / ProductTypeExtension.php
Created Jul 13, 2021
商品登録ページに自動登録する会員グループを選択する高奥を追加
View ProductTypeExtension.php
<?php
/**
* This file is part of CustomerGroupProduct
*
* Copyright(c) Akira Kurozumi <info@a-zumi.net>
*
* https://a-zumi.net
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@kurozumi
kurozumi / ProductTrait.php
Last active Jul 13, 2021
Productエンティティに自動登録する会員グループを保存する項目を追加
View ProductTrait.php
<?php
/**
* This file is part of CustomerGroupProduct
*
* Copyright(c) Akira Kurozumi <info@a-zumi.net>
*
* https://a-zumi.net
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@kurozumi
kurozumi / multi_category_search_form_side.twig
Created Jul 6, 2021
複数カテゴリ検索プラグインで特定のカテゴリで検索されたときのみ検索項目を表示させる方法
View multi_category_search_form_side.twig
{% if form.vars.value.category_ids|filter(c => c.id == 1)|length > 0 %}
{% set searchItem = repository("Plugin\\MultiCategorySearch4\\Entity\\SearchItem").find(1) %}
{% set value = 'search_item_' ~ searchItem.id %}
<dl>
<dd>
<div class="ec-blockCheckbox">
<label class="ec-label">{{ searchItem.name }}</label>
{% for i, item in form[value] %}
{{ form_widget(item, {'id': value~'_'~i~'_side'}) }}
{% endfor %}
@kurozumi
kurozumi / detail.twig
Created Jul 2, 2021
会員グループ管理::会員グループ価格管理アドオンで未ログイン時の場合、商品詳細ページにグループ会員価格一覧を表示させる
View detail.twig
{% if not is_granted('ROLE_USER') %}
{% set Groups = repository('Plugin\\CustomerGroup\\Entity\\Group').findAll() %}
<div class="ec-productRole__groupPrice">
{% for Group in Groups %}
<div class="ec-price">
<span class="">{{ Group.name }}価格:</span>
{% set GroupPrices = [] %}
{% for ProductClass in Product.getProductClasses %}
{% set GroupPrice = repository('Plugin\\CustomerGroupPrice\\Entity\\GroupPrice').findBy({'group': Group, 'ProductClass': ProductClass}) %}
{% if GroupPrice and GroupPrice[0].getPriceIncTax %}
View InstallerCommand.php
<?php
namespace Customize\Command;
use Eccube\Command\PluginCommandTrait;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@kurozumi
kurozumi / services.yaml
Created Jan 2, 2021
ProductValueResolverの優先度を設定
View services.yaml
services:
Customize\ArgumentResolver\ProductValueResolver:
arguments:
- '@Eccube\Repository\ProductRepository'
tags:
- { name: controller.argument_value_resolver, priority: 50 }
View ProductValueResolver.php
<?php
namespace Customize\ArgumentResolver;
use Eccube\Entity\Product;
use Eccube\Repository\ProductRepository;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;