カテゴリブロックの複製(2.13.2)
参考にしている記事のバージョンは低い(たぶん)けど、通用したので。
参考:http://eccubenote.blogspot.jp/2012/01/ec-cube-2114_26.html
1.
まず、data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Category.phpをコピーして、LC_Page_FrontParts_Bloc_Category2.phpを作成する。
作成したファイルを開き、33行目
class LC_Page_FrontParts_Bloc_Category extends LC_Page_FrontParts_Bloc_Ex
を
class LC_Page_FrontParts_Bloc_Category2 extends LC_Page_FrontParts_Bloc_Ex
に書き換える。
2.
次に、data/class_extends/pages_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Category_EX.phpをコピーして、LC_Page_FrontParts_Bloc_Category2_EX.phpを作成する。参考文献によっては、ここでひっかかる。LC_Page_FrontParts_Bloc_Category_EX2.phpでは動かないので。
で、24行目
require_once CLASS_REALDIR . 'pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Category.php';
を
require_once CLASS_REALDIR . 'pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Category2.php';
それから35行目
class LC_Page_FrontParts_Bloc_Category_Ex extends LC_Page_FrontParts_Bloc_Category
を
class LC_Page_FrontParts_Bloc_Category2_Ex extends LC_Page_FrontParts_Bloc_Category2
にする。
3.
それから、/html/frontparts/bloc/category.phpをコピーしてcategory2.phpを作成する。
25行目から
require_once CLASS_EX_REALDIR . 'page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Category_Ex.php'; $objPage = new LC_Page_FrontParts_BLoc_Category_Ex();
を
require_once CLASS_EX_REALDIR . 'page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Category2_Ex.php'; $objPage = new LC_Page_FrontParts_BLoc_Category2_Ex();
に書き換える。
4.
次に管理画面のデザイン管理⇒ブロック設定から新規ブロックを作成。
ブロックのファイル名はcategory2(.tpl)にする。
5.
DBのdtb_blocの最終行に作成したブロックの設定等が追加されているので、php_pathの欄に「frontparts/bloc/category2.php」と記入する。
以上。