Skip to content

Instantly share code, notes, and snippets.

View kurozumi's full-sized avatar

kurozumi kurozumi

View GitHub Profile
@kurozumi
kurozumi / index.twig
Created July 14, 2021 08:40
会員グループ管理::会員登録アドオン for EC-CUBE4で指定したパラメータ付きのURLで新規会員登録ページにアクセスすると新規会員登録完了時に会員グループが付与されるカスタマイズ方法
{% 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 July 13, 2021 06:04
購入完了ページで会員に会員グループを設定する処理
<?php
/**
* This file is part of CustomerGroupProduct
*
* Copyright(c) Akira Kurozumi <[email protected]>
*
* 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 July 13, 2021 06:00
商品登録ページに自動登録する会員グループを選択する高奥を追加
<?php
/**
* This file is part of CustomerGroupProduct
*
* Copyright(c) Akira Kurozumi <[email protected]>
*
* 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 July 13, 2021 06:00
Productエンティティに自動登録する会員グループを保存する項目を追加
<?php
/**
* This file is part of CustomerGroupProduct
*
* Copyright(c) Akira Kurozumi <[email protected]>
*
* 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 July 6, 2021 06:17
複数カテゴリ検索プラグインで特定のカテゴリで検索されたときのみ検索項目を表示させる方法
{% 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 July 2, 2021 04:29
会員グループ管理::会員グループ価格管理アドオンで未ログイン時の場合、商品詳細ページにグループ会員価格一覧を表示させる
{% 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 %}
@kurozumi
kurozumi / InstallerCommand.php
Created January 21, 2021 06:15
InstallerCommand
<?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 January 2, 2021 05:41
ProductValueResolverの優先度を設定
services:
Customize\ArgumentResolver\ProductValueResolver:
arguments:
- '@Eccube\Repository\ProductRepository'
tags:
- { name: controller.argument_value_resolver, priority: 50 }
@kurozumi
kurozumi / ProductValueResolver.php
Created January 2, 2021 05:36
ProductValueResolver
<?php
namespace Customize\ArgumentResolver;
use Eccube\Entity\Product;
use Eccube\Repository\ProductRepository;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;