468様
ご回答ありがとうございます。
/src/Eccube/Entity/Product.phpを以下のようにしました。
34行目付近
/**
* Product
*/
class Product extends \Eccube\Entity\AbstractEntity
{
private $_calc = false;
private $stockFinds = array();
private $stocks = array();
private $stockUnlimiteds = array();
private $price01 = array();
private $price02 = array();
private $price02Tax_Exc = array(); //追加
private $price01IncTaxs = array();
private $price02IncTaxs = array();
private $codes = array();
private $classCategories1 = array();
private $classCategories2 = array();
private $className1;
private $className2;
80行目付近
// price01
if (!is_null($ProductClass->getPrice01())) {
$this->price01[] = $ProductClass->getPrice01();
// price01IncTax
$this->price01IncTaxs[] = $ProductClass->getPrice01IncTax();
}
// price02
$this->price02[] = $ProductClass->getPrice02();
// price02Tax_Exc
$this->price02Tax_Exc[] = $ProductClass->getPrice02(); //追加
// price02IncTax
$this->price02IncTaxs[] = $ProductClass->getPrice02IncTax();
// product_code
$this->codes[] = $ProductClass->getCode();
285行目付近
/**
* Get Price02 min
*
* @return integer
*/
public function getPrice02Min()
{
$this->_calc();
return min($this->price02);
}
/**
* Get Price02 max
*
* @return integer
*/
public function getPrice02Max()
{
$this->_calc();
return max($this->price02);
}
/**
* Get price02Tax_Exc min
*
* @return integer
*/
public function getprice02Tax_ExcMin() //追加
{
$this->_calc();
return min($this->price02);
}
/**
* Get price02Tax_Exc max
*
* @return integer
*/
public function getprice02Tax_ExcMax() //追加
{
$this->_calc();
return max($this->price02);
}
430行目付近
$class_categories[$class_category_id1]['#'.$class_category_id2] = array(
'classcategory_id2' => $class_category_id2,
'name' => $class_category_name2,
'stock_find' => $ProductClass->getStockFind(),
'price01' => $ProductClass->getPrice01() === null ? '' : number_format($ProductClass->getPrice01IncTax()),
'price02' => number_format($ProductClass->getPrice02IncTax()),
'price02Tax_Exc' => number_format($ProductClass->getPrice02()), //追加
'product_class_id' => (string) $ProductClass->getId(),
'product_code' => $ProductClass->getCode(),
'product_type' => (string) $ProductClass->getProductType()->getId(),
);
}
以上のように変更した後に、/html/template/default/js/eccube.jsの500行目付近にあった通常価格の箇所を以下のようにしました。
// 税抜価格
var $price02Tax_Exc = $('#detail_description_box__class_normal_range_price')
.find('.price02Tax_Exc_default')
.first();
if (typeof this.price02Tax_Exc_origin === 'undefined') {
// 初期値を保持しておく
this.price02Tax_Exc_origin = $price02Tax_Exc.text();
}
if (classcat2 && typeof classcat2.price02Tax_Exc !== 'undefined' && String(classcat2.price02Tax_Exc).length >= 1) {
$price02Tax_Exc.text('¥ ' + classcat2.price02Tax_Exc);
} else {
$price02Tax_Exc.text(this.price02Tax_Exc_origin);
}
最後にsrc/Eccube/Resource/template/default/Product/detail.twigを以下のようにしました。
<!--★税抜価格★-->
{% if Product.hasProductClass %}
{% if Product.getprice02Tax_ExcMin == Product.getprice02Tax_ExcMax %}
<p id="detail_description_box__class_normal_price" class="normal_price"> <span class="price02Tax_Exc_default">{{ Product.getprice02Tax_ExcMin|price }}</span> <span class="small">税抜</span></p>
{% else %}
<p id="detail_description_box__class_normal_range_price" class="normal_price"> <span class="price02Tax_Exc_default">{{ Product.getprice02Tax_ExcMin|price }} ~ {{ Product.getprice02Tax_ExcMax|price }}</span> <span class="small">税抜</span></p>
{% endif %}
{% else %}
<p id="detail_description_box__normal_price" class="normal_price"> <span class="price02Tax_Exc_default">{{ Product.getprice02Tax_ExcMin|price }}</span> <span class="small">税抜</span></p>
{% endif %}
<!--★販売価格★-->
{% 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"><font color="red">{{ Product.getPrice02IncTaxMin|price }}</font></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"><font color="red">{{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}</font></span> <span class="small">税込</span></p>
{% endif %}
{% else -%}
<p id="detail_description_box__sale_price" class="sale_price text-primary"> <span class="price02_default"><font color="red">{{ Product.getPrice02IncTaxMin|price }}</font></span> <span class="small">税込</span></p>
{% endif -%}
これで、税込価格と税抜価格を同時に表示する事ができました。
恐らくこれで問題ないかと思います。
468様
長々とお付き合いいただきありがとうございました。
また分からないことがありましたら、教えていただければ幸いです。
この度は本当にありがとうございました。