[Svn-src-all:1307] [version-2_5-dev 20196] #986 再リファクタリング
yomoro
admin @ mail.ec-cube.net
2011年 2月 18日 (金) 17:07:50 JST
Subversion committed to /home/svn/open 20196
http://svn.ec-cube.net/open_trac/changeset/20196
┌────────────────────────────┐
│更新者 : yomoro │
│更新日時: 2011-02-18 17:07:49 +0900 (金, 18 2月 2011)│
└────────────────────────────┘
Log:
--------------------------------------------------------
#986 再リファクタリング
Changed: [U:修正,A:追加,D:削除]
--------------------------------------------------------
U branches/version-2_5-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Best5.php
変更: branches/version-2_5-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Best5.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Best5.php 2011-02-18 07:53:46 UTC (rev 20195)
+++ branches/version-2_5-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Best5.php 2011-02-18 08:07:49 UTC (rev 20196)
@@ -64,7 +64,7 @@
function action() {
// 基本情報を渡す
- $objSiteInfo = new SC_SiteInfo();
+ $objSiteInfo = SC_Helper_DB_Ex::sfGetBasisData();
$this->arrInfo = $objSiteInfo->data;
//おすすめ商品表示
@@ -86,6 +86,7 @@
* @return array $arrBestProducts 検索結果配列
*/
function lfGetRanking(){
+ $arrProduct = array();
// おすすめ商品取得
$objQuery = SC_Query::getSingletonInstance();
$sql = '';
@@ -105,27 +106,28 @@
$objQuery->setOrder('rank');
$objQuery->setLimit(RECOMMEND_NUM);
$arrBestProducts = $objQuery->getAll($sql);
- // 各商品の詳細情報を取得
- $objQuery = SC_Query::getSingletonInstance();
- $objProduct = new SC_Product();
- // where条件生成&セット
- $arrBestProductIds = array();
- $where = 'product_id IN ( ';
- foreach( $arrBestProducts as $key => $val ) {
- $arrBestProductIds[] = $val['product_id'];
- }
- $where .= implode(', ', $arrBestProductIds);
- $where .= ' )';
- $objQuery->setWhere($where);
- // 取得
- $arrProductList = $objProduct->lists($objQuery);
- // おすすめ商品情報とマージ
- $arrProduct = array();
- foreach( $arrProductList as $pdct_key => $pdct_val ) {
- foreach( $arrBestProducts as $best_key => $best_val ) {
- if ( $pdct_val['product_id'] == $best_val['product_id'] ) {
- $arrProduct[$best_key] = array_merge($best_val, $pdct_val);
- break;
+ if ( is_array($arrBestProducts) && count($arrBestProducts) > 0 ) {
+ // 各商品の詳細情報を取得
+ $objQuery = SC_Query::getSingletonInstance();
+ $objProduct = new SC_Product();
+ // where条件生成&セット
+ $arrBestProductIds = array();
+ $where = 'product_id IN ( ';
+ foreach( $arrBestProducts as $key => $val ) {
+ $arrBestProductIds[] = $val['product_id'];
+ }
+ $where .= implode(', ', $arrBestProductIds);
+ $where .= ' )';
+ $objQuery->setWhere($where);
+ // 取得
+ $arrProductList = $objProduct->lists($objQuery);
+ // おすすめ商品情報とマージ
+ foreach( $arrProductList as $pdct_key => $pdct_val ) {
+ foreach( $arrBestProducts as $best_key => $best_val ) {
+ if ( $pdct_val['product_id'] == $best_val['product_id'] ) {
+ $arrProduct[$best_key] = array_merge($best_val, $pdct_val);
+ break;
+ }
}
}
}
Svn-src-all メーリングリストの案内