以前、EC-CUBE2.11.2用に考えたコードですが、その後 EC-CUBEの仕様変更により使えなくなりましたので、
念のため2.11.3~2.11.4用に記述しておきます。EC-CUBE2.11.0~2.11.2の方はこちら。
1.data/class_extends/SC_Product_Ex.php に以下の関数を追加
function lists(&$objQuery) {
$col = <<< __EOS__
product_id
,product_code_min
,product_code_max
,name
,comment1
,comment2
,comment3
,main_list_comment
,main_image
,main_list_image
,price01_min
,price01_max
,price02_min
,price02_max
,stock_min
,stock_max
,stock_unlimited_min
,stock_unlimited_max
,deliv_date_id
,status
,del_flg
,update_date
,sub_title1
,sub_image1
,sub_title2
,sub_image2
,sub_title3
,sub_image3
,sub_title4
,sub_image4
,sub_title5
,sub_image5
__EOS__;
$where = 'dtb_products_class.del_flg = 0';
$res = $objQuery->select($col, $this->alldtlSQL($where));
return $res;
}
2.data/Smarty/templates/default/products/list.tpl に以下のコードを追加
サンプルでは、205行目付近(コメントの下)に配置してみました。
<!--{* サブ画像 *}-->
<!--{section name=cnt loop=$smarty.const.PRODUCTSUB_MAX}-->
<!--{assign var=key1 value="sub_title`$smarty.section.cnt.iteration`"}-->
<!--{assign var=key2 value="sub_image`$smarty.section.cnt.iteration`"}-->
<!--{if $arrProduct.$key2 != ''}-->
<img src="<!--{$smarty.const.ROOT_URLPATH}-->resize_image.php?image=<!--{$arrProduct.$key2|h|nl2br}-->&width=80&height=80" alt="<!--{$arrProduct.$key1|h}-->" />
<!--{/if}-->
<!--{/section}-->













ピンバック: [EC-CUBE 2.11.2] 商品一覧ページに商品サブ画像を表示したい | NAKWEB × EC-CUBE
ピンバック: ECCUBEの小技:商品一覧ページにサブ画像を表示する【Ver.2.11.5】 | 戯れ問答
Hello! I am a starter of learning of EC-CUBE. I am Cambodian people. Thanks for this block.