Created
July 2, 2021 04:29
-
-
Save kurozumi/f8c5ad377a48aeb25a97a4632340d443 to your computer and use it in GitHub Desktop.
会員グループ管理::会員グループ価格管理アドオンで未ログイン時の場合、商品詳細ページにグループ会員価格一覧を表示させる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% 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 %} | |
{% set GroupPrices = GroupPrices|merge([GroupPrice[0].getPriceIncTax]) %} | |
{% else %} | |
{% set GroupPrices = GroupPrices|merge([ProductClass.getPrice02IncTax]) %} | |
{% endif %} | |
{% endfor %} | |
{% if Product.hasProductClass -%} | |
{% if min(GroupPrices) == max(GroupPrices) %} | |
<span class="ec-price__price price02-default">{{ min(GroupPrices)|price }}</span> | |
<span class="ec-price__tax">{{ 'common.tax_include'|trans }}</span> | |
{% else %} | |
<span class="ec-price__price price02-default">{{ min(GroupPrices)|price }} ~ {{ max(GroupPrices)|price }}</span> | |
<span class="ec-price__tax">{{ 'common.tax_include'|trans }}</span> | |
{% endif %} | |
{% else %} | |
<span class="ec-price__price">{{ min(GroupPrices)|price }}</span> | |
<span class="ec-price__tax">{{ 'common.tax_include'|trans }}</span> | |
{% endif %} | |
</div> | |
{% endfor %} | |
</div> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment