app/template/aneros2023/Product/customer_rank_point.twig line 1

Open in your IDE?
  1. <span class="point-area" id="product-point-{{ Product.id }}">
  2. {% set pointDataTitle = "" %}
  3. {% set pointDataBody = "" %}
  4. {% if is_granted('ROLE_USER') %}
  5.     {% set CustomerRank = null %}
  6.     {% if app.user.CustomerRank.id is defined %}
  7.         {% set CustomerRankId = app.user.CustomerRank.id %}
  8.         {% if CustomerRankId %}
  9.             {% set CustomerRank = repository('Plugin\\CustomerRank42\\Entity\\CustomerRank').find(CustomerRankId) %}
  10.         {% endif %}
  11.     {% endif %}
  12.     {% if CustomerRank %}
  13.         {# 会員ランクあり #}
  14.         {% set pointDataTitle = CustomerRank.name %}
  15.         {% if Product.getPrice02Min == Product.getPrice02Max %}
  16.             {% set point = Product.getPrice02Min / (1/((BaseInfo.basic_point_rate+CustomerRank.point_rate)/100)) %}
  17.             {% set pointDataBody = point|round %}
  18.         {% else %}
  19.             {% set pointMin = Product.getPrice02Min / (1/((BaseInfo.basic_point_rate+CustomerRank.point_rate)/100)) %}
  20.             {% set pointMax = Product.getPrice02Max / (1/((BaseInfo.basic_point_rate+CustomerRank.point_rate)/100)) %}
  21.             {% set pointDataBody = pointMin|round~"~"~pointMax|round %}
  22.         {% endif %}
  23.     {% else %}
  24.         {# 会員ランクなし #}
  25.         {% set pointDataTitle = "ノーマル会員" %}
  26.         {% if Product.getPrice02Min == Product.getPrice02Max %}
  27.             {% set point = Product.getPrice02Min / (1/(BaseInfo.basic_point_rate/100)) %}
  28.             {% set pointDataBody = point|round %}
  29.         {% else %}
  30.             {% set pointMin = Product.getPrice02Min / (1/(BaseInfo.basic_point_rate/100)) %}
  31.             {% set pointMax = Product.getPrice02Max / (1/(BaseInfo.basic_point_rate/100)) %}
  32.             {% set pointDataBody = pointMin|round~"~"~pointMax|round %}
  33.         {% endif %}
  34.     {% endif %}
  35. {% else %}
  36.     {% set maxPoint = -1 %}
  37.     {% set minPoint = 101 %}
  38.     {% set CustomerRankAll = repository('Plugin\\CustomerRank42\\Entity\\CustomerRank').findAll() %}
  39.     {% for cr in CustomerRankAll %}
  40.         {% if cr.point_rate is defined and cr.point_rate is not null %}
  41.             {% if cr.point_rate < minPoint %}
  42.                 {% set minPoint = cr.point_rate %}
  43.             {% endif %}
  44.             {% if maxPoint < cr.point_rate %}
  45.                 {% set maxPoint = cr.point_rate %}
  46.             {% endif %}
  47.         {% endif %}
  48.     {% endfor %}
  49.     {% if 100 < minPoint %}
  50.         {% set minPoint = 0 %}
  51.     {% endif %}
  52.     {% if maxPoint < 0 %}
  53.         {% set maxPoint = 0 %}
  54.     {% endif %}
  55.     {#% set pointMin = Product.getPrice02Min / (1/((BaseInfo.basic_point_rate+minPoint)/100)) %#}
  56.     {% set pointMin = Product.getPrice02Min / (1/((BaseInfo.basic_point_rate)/100)) %}
  57.     {% set pointMax = Product.getPrice02Max / (1/((BaseInfo.basic_point_rate+maxPoint)/100)) %}
  58.     {% set pointDataTitle = "会員なら" %}
  59.     {% set pointDataBody = pointMin|round~"~"~pointMax|round %}
  60. {% endif %}
  61.     <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>
  62. </span>