税込み価格と税抜き価格を並列表記する(v2.13)
/data/class/SC_Product.phpの293行目以降
// 価格 // TODO: ここでprice01,price02を税込みにしてよいのか? _inctax を付けるべき?要検証 $arrClassCats2['price01'] = strlen($arrProductsClass['price01']) ? number_format(SC_Helper_TaxRule_Ex::sfCalcIncTax($arrProductsClass['price01'], $productId, $arrProductsClass['product_class_id'])) : ''; $arrClassCats2['price02'] = strlen($arrProductsClass['price02']) ? number_format(SC_Helper_TaxRule_Ex::sfCalcIncTax($arrProductsClass['price02'], $productId, $arrProductsClass['product_class_id'])) : '';
の部分に
// 税抜価格を表示させるために追加 $arrClassCats2['price011'] = strlen($arrProductsClass['price01']) ? number_format($arrProductsClass['price01']) : ''; $arrClassCats2['price021'] = strlen($arrProductsClass['price02']) ? number_format($arrProductsClass['price02']) : '';
を追加。
次に、js/eccube.jsの502行目、販売価格のところを
var $price02_default = $form.find('[id^=price02_default]'); var $price02_dynamic = $form.find('[id^=price02_dynamic]'); var $price021_default = $form.find('[id^=price021_default]'); var $price021_dynamic = $form.find('[id^=price021_dynamic]'); if (classcat2 && typeof classcat2.price02 !== 'undefined' && String(classcat2.price02).length >= 1) { $price02_dynamic.text(classcat2.price02).show(); $price021_dynamic.text(classcat2.price021).show(); $price02_default.hide(); $price021_default.hide(); } else { $price02_dynamic.hide(); $price02_default.show(); $price021_dynamic.hide(); $price021_default.show(); }
に変更。
最後に、/data/Smarty/templates/default/products/detail.tplを
<!--★販売価格★--> <dl class="sale_price"> <dt><!--{$smarty.const.SALE_PRICE_TITLE}-->(税込):</dt> <dd class="price"> <span id="price02_default"><!--{strip}--> <!--{if $arrProduct.price02_min_inctax == $arrProduct.price02_max_inctax}--> <!--{$arrProduct.price02_min_inctax|number_format}--> <!--{else}--> <!--{$arrProduct.price02_min_inctax|number_format}-->〜<!--{$arrProduct.price02_max_inctax|number_format}--> <!--{/if}--> <!--{/strip}--></span><span id="price02_dynamic"></span> 円(税抜:<span id="price021_default"><!--{$arrProduct.price02_min|number_format}--></span><span id="price021_dynamic"></span>円) </dd> </dl>
みたいな感じで。