ちと難しいですよ。
下記のコード(赤字部分のあたり)を変更もしくは追加してもらう必要があります。
eccube/html/frontparts/bloc/cart.php
if (count($_SESSION[$objCart->key]) > 0){
// カート情報を取得
$arrCartList = $objCart->getCartList();
// カート内の商品ID一覧を取得
$arrAllProductID = $objCart->getAllProductID();
// 商品が1つ以上入っている場合には商品名称を取得
if (count($arrAllProductID) > 0){
$objQuery = new SC_Query();
$arrVal = array();
$sql = "";
$sql = "SELECT product_id,name,main_list_image FROM dtb_products WHERE product_id IN ( ?";
$arrVal = array($arrAllProductID[0]);
for($i = 1 ; $i < count($arrAllProductID) ; $i++){
$sql.= " ,? ";
array_push($arrVal, $arrAllProductID[$i]);
}
$sql.= " )";
$arrProduct_list = $objQuery->getAll($sql, $arrVal);
$item_list = array();
for($i = 0; $i < count($arrProduct_list); $i++){
$item_list[$arrProduct_list[$i]['product_id']]['name'] = $arrProduct_list[$i]['name'];
$item_list[$arrProduct_list[$i]['product_id']]['main_list_image'] = $arrProduct_list[$i]['main_list_image'];
}
for($i = 0; $i < count($arrCartList); $i++){
$arrCartList[$i]['product_name'] = $item_list[$arrCartList[$i]['id'][0]]['name'];
$arrCartList[$i]['img'] = $item_list[$arrCartList[$i]['id'][0]]['main_list_image'];
}
}
// 店舗情報の取得
$arrInfo = $objSiteInfo->data;
// 購入金額合計
$ProductsTotal = $objCart->getAllProductsTotal($arrInfo);
// 合計個数
$TotalQuantity = $objCart->getTotalQuantity();
// 送料無料までの金額
$arrCartList[0]['ProductsTotal'] = $ProductsTotal;
$arrCartList[0]['TotalQuantity'] = $TotalQuantity;
$deliv_free = $arrInfo['free_rule'] - $ProductsTotal;
$arrCartList[0]['free_rule'] = $arrInfo['free_rule'];
$arrCartList[0]['deliv_free'] = $deliv_free;
$objSubPage->arrCartList = $arrCartList;
$objSubPage->arrInfo = $arrInfo;
}
cart_delitem.phpは商品リスト削除用のコードで、新規に作成してください。
eccube/html/frontparts/bloc/cart_delitem.php
<?php
require_once("../../require.php");
$objCartSess = new SC_CartSession("", false);
switch($_POST['mode']) {
case 'up':
$objCartSess->upQuantity($_POST['cart_no']);
header("Location: " . URL_DIR);
break;
case 'down':
$objCartSess->downQuantity($_POST['cart_no']);
header("Location: " . URL_DIR);
break;
case 'delete':
$objCartSess->delProduct($_POST['cart_no']);
header("Location: " . URL_DIR);
break;
default:
header("Location: " . URL_DIR);
break;
}
?>
商品一覧よりカゴに入れた場合の処理
eccube/html/products/list.php
if($_POST['mode'] == "cart" && $_POST['product_id'] != "") {
// 値の正当性チェック
if(!sfIsInt($_POST['product_id']) || !sfIsRecord("dtb_products", "product_id", $_POST['product_id'], "del_flg = 0 AND status = 1")) {
sfDispSiteError(PRODUCT_NOT_FOUND);
} else {
// 入力値の変換
$objPage->arrErr = lfCheckError($_POST['product_id']);
if(count($objPage->arrErr) == 0) {
$objCartSess = new SC_CartSession();
$objSiteInfo = new SC_SiteInfo;
// 店舗情報の取得
$arrInfo = $objSiteInfo->data;
$classcategory_id = "classcategory_id". $_POST['product_id'];
$classcategory_id1 = $_POST[$classcategory_id. '_1'];
$classcategory_id2 = $_POST[$classcategory_id. '_2'];
$quantity = "quantity". $_POST['product_id'];
// 規格1が設定されていない場合
if(!$objPage->tpl_classcat_find1[$_POST['product_id']]) {
$classcategory_id1 = '0';
}
// 規格2が設定されていない場合
if(!$objPage->tpl_classcat_find2[$_POST['product_id']]) {
$classcategory_id2 = '0';
}
$objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
$objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity]);
$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
header("Location: " . $objCartSess->getPrevURL() . "#top");
exit;
}
}
}
商品詳細よりカゴに入れたときの処理
eccube/html/products/detail.php
switch($_POST['mode']) {
case 'cart':
// 入力値の変換
$objFormParam->convParam();
$objPage->arrErr = lfCheckError();
if(count($objPage->arrErr) == 0) {
$objCartSess = new SC_CartSession();
$objSiteInfo = new SC_SiteInfo;
// 店舗情報の取得
$arrInfo = $objSiteInfo->data;
$classcategory_id1 = $_POST['classcategory_id1'];
$classcategory_id2 = $_POST['classcategory_id2'];
// 規格1が設定されていない場合
if(!$objPage->tpl_classcat_find1) {
$classcategory_id1 = '0';
}
// 規格2が設定されていない場合
if(!$objPage->tpl_classcat_find2) {
$classcategory_id2 = '0';
}
$objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
$objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $objFormParam->getValue('quantity'));
$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
header("Location: " . $objCartSess->getPrevURL() . "#top");
exit;
}
break;
default:
break;
}
テンプレートはテーブルタグをやめてしまったので、ご自分のテンプレートに合わせて修正が必要でしょうか。
一応、大事なところは青くしておきます。
eccube/html/user_data/include/bloc/cart.tpl
<!--{*
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*}-->
<!--▼現在のカゴの中ここから-->
<div class="sb-base">
<!--★タイトル★-->
<h4><img src="<!--{$smarty.const.URL_DIR}-->img/side/title_cartin.jpg" alt="現在のカゴの中" /></h4>
<div class="sb-main">
<div class="sb-content">
<!--★商品点数★-->
<div><span class="fs10">商品数:<!--{$arrCartList.0.TotalQuantity|number_format|default:0}-->点</span></div>
<!--{if $arrCartList.0.TotalQuantity > 0}-->
<form name="form2" id="form2" method="post" action="<!--{$smarty.const.URL_DIR}-->frontparts/bloc/cart_delitem.php">
<input type="hidden" name="mode" value="delete" />
<input type="hidden" name="cart_no" value="" />
<!--{section name=cnt loop=$arrCartList}-->
<div style="margin-bottom:5px">
<!--★商品画像★-->
<div style="width:50px;float:left"><a href="<!--{$smarty.const.URL_DIR}-->cart/index.php">
<img src="<!--{$smarty.const.SITE_URL}-->resize_image.php?image=<!--{$smarty.const.IMAGE_SAVE_DIR}-->/<!--{$arrCartList[cnt].img}-->&width=48&height=48" alt="<!--{$arrCartList[cnt].product_name|escape}-->" />
</a></div>
<div style="width:95px;float:right">
<!--★商品名★-->
<div style="color:#4a6fa6;font-size:14px">
<strong><!--{$arrCartList[cnt].product_name|escape}--></strong>
</div>
<!--★販売価格×数量★-->
<div style="text-align:right;font-size:12px">
<!--{$arrCartList[cnt].price|sfPreTax:$arrInfo.tax:$arrInfo.tax_rule|number_format|default:0}-->円×<!--{$arrCartList[cnt].quantity|escape}-->
<a href="<!--{$smarty.const.URL_DIR}-->frontparts/bloc/cart_delitem.php" onclick="fnFormModeSubmit('form2', 'delete', 'cart_no', '<!--{$arrCartList[cnt].cart_no}-->'); return false;"><img src="<!--{$smarty.const.URL_DIR}-->img/contents/icon_delete.jpg" alt="この商品の購入を取り消す" /></a>
</div>
</div><br style="clear:both" />
</div>
<!--{/section}-->
</form>
<!--{/if}-->
<!--★区切り線★-->
<hr />
<!--★合計★-->
<div style="margin-bottom:5px;text-align:right">
<span class="redst"><span class="fs14">合計:<!--{$arrCartList.0.ProductsTotal|number_format|default:0}-->円</span></span>
</div>
<!--★カゴの中に商品がある場合にのみ表示★-->
<!--{if $arrCartList.0.TotalQuantity > 0 and $arrCartList.0.free_rule > 0}-->
<div style="margin-bottom:10px">
<span class="fs10">
<!--{if $arrCartList.0.deliv_free > 0}-->
送料手数料無料まであと<!--{$arrCartList.0.deliv_free|number_format|default:0}-->円(税込)です。
<!--{else}-->
現在、送料は「<span class="redst">無料</span>」です。
<!--{/if}-->
</span>
</div>
<!--{/if}-->
<!--★ボタン★-->
<div style="margin-top:5px;text-align:center">
<a href="<!--{$smarty.const.URL_DIR}-->cart/index.php" onmouseover="chgImg('<!--{$smarty.const.URL_DIR}-->img/side/button_cartin_on.gif','button_cartin');" onmouseout="chgImg('<!--{$smarty.const.URL_DIR}-->img/side/button_cartin.gif','button_cartin');"><img src="<!--{$smarty.const.URL_DIR}-->img/side/button_cartin.gif" alt="カゴの中を見る" name="button_cartin" /></a>
</div>
</div>
</div>
<div class="sb-bottom"></div>
</div>
<!--▲現在のカゴの中ここまで-->