[EC-CUBE] 2.13.3
[PHP] 5.3.3
[データベース] PostgreSQL 8.4.20
お世話になります。
どうかお力をお貸しください。
現在、下記の「新着商品プラグイン」を利用しております。
http://www.ec-cube.net/products/detail.php?product_id=778新着順に商品が表示されるプラグインですが、
画像、商品名、値段とは別に商品ステータスも表示させたいと考えています。
http://ec-cube.nakweb.com/blog/1644.htmlそこで上記リンク先を参考に自分なりにカスタマイズしてみましたが、
うまく表示されず行き詰っております。
■LC_Page_FrontParts_Bloc_Up_NewProducts.php
( /data/downloads/plugin/Up_NewProducts)
public function init()
{
parent::init();
}
public function action()
{
//新着商品情報
$this->arrNewProducts = $this->GetNewProducts();
//商品レビュー情報を取得
$this->arrReviewList = $this->getReviewList();
//商品ステータスを取得
$this->arrProductStatus = $this->getProductStatus();
// プラグイン情報を取得
$this->arrPlugin = $this->getBlocTitle();
}
/**
* 商品ステータスIDの配列を取得する.
*
* @return array 商品IDごとのステータス一覧
*/
public function getProductStatus()
{
$objQuery =& SC_Query_Ex::getSingletonInstance();
$cols = 'product_id, product_status_id';
$from = 'dtb_product_status';
$where = 'del_flg = 0';
$productStatus = $objQuery->select($cols, $from, $where);
$results = array();
foreach ($productStatus as $status) {
$results[$status['product_id']][] = $status['product_status_id'];
}
return $productStatus;
}
↓それぞれ下記のように変更
public function init()
{
parent::init();
$masterData = new SC_DB_MasterData_Ex();
$this->arrSTATUS = $masterData->getMasterData('mtb_status');
$this->arrSTATUS_IMAGE = $masterData->getMasterData('mtb_status_image');
}
public function action()
{
//新着商品情報
$this->arrNewProducts = $this->GetNewProducts();
//商品レビュー情報を取得
$this->arrReviewList = $this->getReviewList();
//商品ステータスを取得
$this->productStatus = $this->lfGetProductStatus($this->arrBestProducts);
// プラグイン情報を取得
$this->arrPlugin = $this->getBlocTitle();
}
/**
* 商品ステータス取得関数
*
* @return array $productStatus 商品ステータス配列
*/
function lfGetProductStatus($arrBestProducts){
$objQuery =& SC_Query_Ex::getSingletonInstance();
$col = 'product_status_id';
$table = 'dtb_product_status';
$where = 'product_id = ?';
$arrval = '';
foreach($arrBestProducts as $val){
$arrval = array($val['product_id']);
$productStatus[$val['product_id']] = $objQuery->getCol($col, $table, $where, $arrval);
}
return $productStatus;
}
■plg_Up_NewProducts.tplに下記を追加
( data/Smarty/templates/default/frontparts/bloc/plg_Up_NewProducts.tpl)
<!--商品ステータス-->
<!--{assign var=id value=$arrProduct.product_id}-->
<!--{if count($productStatus[$id]) > 0}-->
<ul class="status_icon clearfix">
<!--{foreach from=$productStatus[$id] item=status}-->
<li>
<img src="<!--{$TPL_URLPATH}--><!--{$arrSTATUS_IMAGE[$status]}-->" alt="<!--{$arrSTATUS[$status]}-->"/>
</li>
<!--{/foreach}-->
</ul>
<!--{/if}-->
おすすめ商品に関しては上記方法で表示されましたが、
「新着商品プラグイン」では上記方法では表示されず、
相違点を探している最中ではありますが、
依然として解決方法が見出せません。
もしお分かりになる方がいらっしゃいましたら、教えて頂ければ幸いです。
何卒、よろしくお願い致します。