商品一覧を3列のカラム(column)表示 / 横型商品一覧の導入

user_date/packages/default/css/common.css内の記述を変更
(contents.cssの可能性あり)

↓に変更。

下記はカラムへの回り込み禁則処理
(商品が1つの場合や価格順・新着順のソートバー回り込み禁則)

common.cssの中(100行目あたり)に追記

下層コンテンツあたりに追記

多分以上で出来るが、商品名や文字のボリュームで個々のheightがバラバラになることがあります。
なので、「heightLine.js」jQuery等でそろえること。
(面倒であればCSSでdiv.list_areaとdiv.list_area h3 の heightを強制固定)

買い物かごの表記は下記ファイルの200行目前後。
今回は消去しました。
template/default/products/list.php

2012年1月24日 加筆

商品一覧ブロックを作る 2.11.X

html/frontparts/bloc/product_list.php を新規作成

data/class_extends/page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Product_List_Ex.php を新規作成

[php]
<?php

// {{{ requires
require_once(CLASS_EX_REALDIR . "page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Product_List_Ex.php");

// }}}
// {{{ generate page

$objPage = new LC_Page_FrontParts_Bloc_Product_List_Ex();
register_shutdown_function(array($objPage, "destroy"));
$objPage->init();
$objPage->process();

?>
[/php]

data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Product_List.php を新規作成

[php highlight=”44″]
<?php

// {{{ requires
require_once CLASS_REALDIR . ‘pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php’;

/**
* Product_List のページクラス.
*
* @package Page
*/
class LC_Page_FrontParts_Bloc_Product_List extends LC_Page_FrontParts_Bloc {

// }}}
// {{{ functions

/**
* Page を初期化する.
*
* @return void
*/
function init() {
parent::init();
$bloc_file = ‘product_list.tpl’;
$this->setTplMainpage($bloc_file);
}

/**
* Page のプロセス.
*
* @return void
*/
function process() {
if (defined("MOBILE_SITE") && MOBILE_SITE) {
$objView = new SC_MobileView();
} else {
$objView = new SC_SiteView();
}

$objQuery = new SC_Query_Ex();
$objProduct = new SC_Product_Ex();

//$objQuery->setLimitOffset(10);
//$objQuery->setOrder("update_date desc");
$this->arrProducts = $objProduct->lists($objQuery);

$objView->assignobj($this);
$objView->display($this->tpl_mainpage);
}

/**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}
}

?>
[/php]

$this->arrProducts = $objProduct->lists(&$objQuery);の44行目で過去のバージョン2.11辺りのQueryだとlists(&$objQuery);の表記でしたが&無しで記述。 $this->arrProducts = $objProduct->lists($objQuery); data/Smarty/templates/default/frontparts/bloc/product_list.tpl を新規作成

[php]
<!–{if count($arrProducts) > 0}–>
<div class="bloc_outer clearfix">
<div id="productlist_area">
<h2>商品一覧リスト</h2>
<div class="bloc_body clearfix">
<!–{foreach from=$arrProducts item=arrProduct}–>
<div class="product_item clearfix">
<div class="productImage">
<a href="<!–{$smarty.const.P_DETAIL_URLPATH}–><!–{$arrProduct.product_id|u}–>"><img src="<!–{$smarty.const.ROOT_URLPATH}–>resize_image.php?image=<!–{$arrProduct.main_list_image|sfNoImageMainList|h}–>&width=40&height=40" alt="<!–{$arrProduct.name|h}–>" /></a>
</div>
<div class="productContents">
<h3>
<a href="<!–{$smarty.const.P_DETAIL_URLPATH}–><!–{$arrProduct.product_id|u}–>"><!–{$arrProduct.name|h}–></a>
</h3>
<p class="sale_price">
<span class="price"><!–{$arrProduct.price02_min|sfCalcIncTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}–> 円</span>
</p>
</div>
</div>
</dl>
<div class="clear"></div>
<!–{/foreach}–>
</div>
</div>
</div>
<!–{/if}–>
[/php]

スタイルシート追記

[css]
<style type="text/css">
div#productlist_area h2 {
background-color:#de5e17;
text-align:center;
color:#fff;
padding:7px 0 7px 0;
}
div#productlist_area div.productImage {
float:left;
width:40px;
padding:0 8px 0 0;
}
div#productlist_area div.productContents {
float:left;
width:100px;
}
div#productlist_area div.product_item {
padding:5px 0 5px 5px;
}
</style>
[/css]

データベースに新規ブロック情報を登録

[php]
insert into dtb_bloc values(10,10,’product_list’,’product_list.tpl’,’product_list’,now(),now(),’frontparts/bloc/product_list.php’,0);
[/php]

Warningが表示されたので掲示板等参考に下記を実行。

[php highlight=”7″]
<?php

// {{{ requires
require_once CLASS_REALDIR . ‘pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php’;
////中略////

$this->arrProducts = $objProduct->lists(&$objQuery);

$objView->assignobj($this);
$objView->display($this->tpl_mainpage);
}

/**
* デストラクタ.
*
* @return void
*/
function destroy() {
parent::destroy();
}
}

?>
[/php]

data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Product_List.phpの部分で、本文44行目(上記7行目) $this->arrProducts = $objProduct->lists(&$objQuery); $this->arrProducts = $objProduct->lists($objQuery);

としたら表示が消えました。

META tag 編集 title keywords description など ECCUBE2.11

どこで編集したか忘れそうになるので、備忘録。

編集ファイルの場所data/Smarty/site_frame.tpl

META tag 編集 title keywords description などを下記から編集できます。
で、問題は初期状態で、各ページ編集できるようになっていたかなのですが。
多分???初期状態からできたはず。
一応コードも↓

追記とか書いてるしw
んん~、自分で書いたか忘れましたw
それか、どっかから拾ってきたらしい。。。。。

元ネタサイトのかたすいません><。。
備忘録として使わせてもらいましたw