EC-CUBE3のテンプレートで税抜き価格を表示する
商品詳細ページに登録されている価格が、運用によっては税込税抜ってまちまちなってしまっている。
先にその辺を取り決めておけば良いのだが、後々カスタマイズを入れると変更したいってなる事が多い。
と言う訳で、基本は税込になっているテンプレートを税抜にしてみる。
/src/Eccube/Resource/template/default/Product/detail.twig
<!--★販売価格★--> {% if Product.hasProductClass -%} {% if Product.getPrice02IncTaxMin == Product.getPrice02IncTaxMax %} <p id="detail_description_box__class_sale_price" class="sale_price text-primary"> <span class="price02_default">{{ Product.getPrice02IncTaxMin|price }}</span> <span class="small">税込</span></p> {% else %} <p id="detail_description_box__class_range_sale_price" class="sale_price text-primary"> <span class="price02_default">{{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}</span> <span class="small">税込</span></p> {% endif %} {% else -%} <p id="detail_description_box__sale_price" class="sale_price text-primary"> <span class="price02_default">{{ Product.getPrice02IncTaxMin|price }}</span> <span class="small">税込</span></p> {% endif -%}
この IncTaxを削る。
<!--★販売価格★--> {% if Product.hasProductClass -%} {% if Product.getPrice02Min == Product.getPrice02Max %} <p id="detail_description_box__class_sale_price" class="sale_price text-primary"> <span class="price02_default">{{ Product.getPrice02Min|price }}</span> <span class="small">税込</span></p> {% else %} <p id="detail_description_box__class_range_sale_price" class="sale_price text-primary"> <span class="price02_default">{{ Product.getPrice02Min|price }} ~ {{ Product.getPrice02Max|price }}</span> <span class="small">税込</span></p> {% endif %} {% else -%} <p id="detail_description_box__sale_price" class="sale_price text-primary"> <span class="price02_default">{{ Product.getPrice02Min|price }}</span> <span class="small">税込</span></p> {% endif -%}
元々税込がデフォになっているので明示的に税込と言う命令を削る。