<span class="point-area" id="product-point-{{ Product.id }}">
{% set pointDataTitle = "" %}
{% set pointDataBody = "" %}
{% if is_granted('ROLE_USER') %}
{% set CustomerRank = null %}
{% if app.user.CustomerRank.id is defined %}
{% set CustomerRankId = app.user.CustomerRank.id %}
{% if CustomerRankId %}
{% set CustomerRank = repository('Plugin\\CustomerRank42\\Entity\\CustomerRank').find(CustomerRankId) %}
{% endif %}
{% endif %}
{% if CustomerRank %}
{# 会員ランクあり #}
{% set pointDataTitle = CustomerRank.name %}
{% if Product.getPrice02Min == Product.getPrice02Max %}
{% set point = Product.getPrice02Min / (1/((BaseInfo.basic_point_rate+CustomerRank.point_rate)/100)) %}
{% set pointDataBody = point|round %}
{% else %}
{% set pointMin = Product.getPrice02Min / (1/((BaseInfo.basic_point_rate+CustomerRank.point_rate)/100)) %}
{% set pointMax = Product.getPrice02Max / (1/((BaseInfo.basic_point_rate+CustomerRank.point_rate)/100)) %}
{% set pointDataBody = pointMin|round~"~"~pointMax|round %}
{% endif %}
{% else %}
{# 会員ランクなし #}
{% set pointDataTitle = "ノーマル会員" %}
{% if Product.getPrice02Min == Product.getPrice02Max %}
{% set point = Product.getPrice02Min / (1/(BaseInfo.basic_point_rate/100)) %}
{% set pointDataBody = point|round %}
{% else %}
{% set pointMin = Product.getPrice02Min / (1/(BaseInfo.basic_point_rate/100)) %}
{% set pointMax = Product.getPrice02Max / (1/(BaseInfo.basic_point_rate/100)) %}
{% set pointDataBody = pointMin|round~"~"~pointMax|round %}
{% endif %}
{% endif %}
{% else %}
{% set maxPoint = -1 %}
{% set minPoint = 101 %}
{% set CustomerRankAll = repository('Plugin\\CustomerRank42\\Entity\\CustomerRank').findAll() %}
{% for cr in CustomerRankAll %}
{% if cr.point_rate is defined and cr.point_rate is not null %}
{% if cr.point_rate < minPoint %}
{% set minPoint = cr.point_rate %}
{% endif %}
{% if maxPoint < cr.point_rate %}
{% set maxPoint = cr.point_rate %}
{% endif %}
{% endif %}
{% endfor %}
{% if 100 < minPoint %}
{% set minPoint = 0 %}
{% endif %}
{% if maxPoint < 0 %}
{% set maxPoint = 0 %}
{% endif %}
{#% set pointMin = Product.getPrice02Min / (1/((BaseInfo.basic_point_rate+minPoint)/100)) %#}
{% set pointMin = Product.getPrice02Min / (1/((BaseInfo.basic_point_rate)/100)) %}
{% set pointMax = Product.getPrice02Max / (1/((BaseInfo.basic_point_rate+maxPoint)/100)) %}
{% set pointDataTitle = "会員なら" %}
{% set pointDataBody = pointMin|round~"~"~pointMax|round %}
{% endif %}
<span class="point-data">{% if is_granted('ROLE_USER') %}{{ pointDataTitle }}{% endif %}{% if not is_granted('ROLE_USER') %}<a href="/mypage/login">{{ pointDataTitle }}</a>{% endif %}:<span style="font-weight:bold; color:#ff0000;">{{ pointDataBody }}</span>ポイント還元</span>
</span>