/** * SC_Queryインスタンスに設定された検索条件を元に並び替え済みの検索結果商品IDの配列を取得する。 * * 検索条件は, SC_Query::setWhere() 関数で設定しておく必要があります. * * @param SC_Query $objQuery SC_Query インスタンス * @param array $arrVal 検索パラメーターの配列 * @return array 商品IDの配列 */ function findProductIdsOrder(&$objQuery, $arrVal = array()) { if (DB_TYPE != 'sqlsrv') { return parent::findProductIdsOrder($objQuery, $arrVal); } else { $table = <<<__EOS__ dtb_products AS alldtl __EOS__; $objQuery->setGroupBy('alldtl.product_id'); if (is_array($this->arrOrderData) and $objQuery->order == '') { $o_col = $this->arrOrderData['col']; $o_table = $this->arrOrderData['table']; $o_order = $this->arrOrderData['order']; $order = <<<__EOS__ ( SELECT TOP 1 {$o_col} FROM {$o_table} as T2 WHERE T2.product_id = alldtl.product_id ORDER BY T2.{$o_col} {$o_order} ) {$o_order}, product_id __EOS__; $objQuery->setOrder($order); } $results = $objQuery->select('alldtl.product_id', $table, '', $arrVal, MDB2_FETCHMODE_ORDERED); $resultValues = array(); foreach ($results as $val) { $resultValues[] = $val[0]; } return $resultValues; } }
/** * Page のAction. * * @return void */ public function action() { //決済処理中ステータスのロールバック $objPurchase = new SC_Helper_Purchase_Ex(); $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG); $objCustomer = new SC_Customer_Ex(); $objProduct = new SC_Product(); if (!SC_Utils_Ex::sfIsInt($_GET['order_id'])) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } $order_id = $_GET['order_id']; $this->is_price_change = false; //受注データの取得 $this->tpl_arrOrderData = $objPurchase->getOrder($order_id, $objCustomer->getValue('customer_id')); if (empty($this->tpl_arrOrderData)) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } $this->arrShipping = $this->lfGetShippingDate($objPurchase, $order_id, $this->arrWDAY); $this->isMultiple = count($this->arrShipping) > 1; // 支払い方法の取得 $this->arrPayment = SC_Helper_Payment_Ex::getIDValueList(); // 受注商品明細の取得 $this->tpl_arrOrderDetail = $objPurchase->getOrderDetail($order_id); foreach ($this->tpl_arrOrderDetail as $product_index => $arrOrderProductDetail) { //必要なのは商品の販売金額のみなので、遅い場合は、別途SQL作成した方が良い $arrTempProductDetail = $objProduct->getProductsClass($arrOrderProductDetail['product_class_id']); // 税計算 $this->tpl_arrOrderDetail[$product_index]['price_inctax'] = $this->tpl_arrOrderDetail[$product_index]['price'] + SC_Helper_TaxRule_Ex::calcTax($this->tpl_arrOrderDetail[$product_index]['price'], $this->tpl_arrOrderDetail[$product_index]['tax_rate'], $this->tpl_arrOrderDetail[$product_index]['tax_rule']); $arrTempProductDetail['price02_inctax'] = SC_Helper_TaxRule_Ex::sfCalcIncTax($arrTempProductDetail['price02'], $arrTempProductDetail['product_id'], $arrTempProductDetail['product_class_id']); if ($this->tpl_arrOrderDetail[$product_index]['price_inctax'] != $arrTempProductDetail['price02_inctax']) { $this->is_price_change = true; } $this->tpl_arrOrderDetail[$product_index]['product_price_inctax'] = $arrTempProductDetail['price02_inctax'] ? $arrTempProductDetail['price02_inctax'] : 0; } $this->tpl_arrOrderDetail = $this->setMainListImage($this->tpl_arrOrderDetail); $objPurchase->setDownloadableFlgTo($this->tpl_arrOrderDetail); // モバイルダウンロード対応処理 $this->lfSetAU($this->tpl_arrOrderDetail); // 受注メール送信履歴の取得 $this->tpl_arrMailHistory = $this->lfGetMailHistory($order_id); }
/** * 商品を検索する. * * @param string $where 検索条件の WHERE 句 * @param array $arrValues 検索条件のパラメーター * @param integer $limit 表示件数 * @param integer $offset 開始件数 * @param string $order 検索結果の並び順 * @param SC_Product $objProduct SC_Product インスタンス * @return array 商品の検索結果 */ function findProducts($where, $arrValues, $limit, $offset, $order, &$objProduct) { $objQuery =& SC_Query_Ex::getSingletonInstance(); // 読み込む列とテーブルの指定 $col = 'product_id, name, main_list_image, status, product_code_min, product_code_max, price02_min, price02_max, stock_min, stock_max, stock_unlimited_min, stock_unlimited_max, update_date'; $from = $objProduct->alldtlSQL(); $objQuery->setLimitOffset($limit, $offset); $objQuery->setOrder($order); return $objQuery->select($col, $from, $where, $arrValues); }
/** * 商品取得 * * @param array $arrProductId * @param SC_Product $objProduct */ function getProductList($arrProductId, &$objProduct) { $objQuery =& SC_Query_Ex::getSingletonInstance(); // 表示順序 $order = 'update_date DESC, product_id DESC'; $objQuery->setOrder($order); return $objProduct->getListByProductIds($objQuery, $arrProductId); }
/** * * 検索結果対象となる商品の数を返す。 * @param array $whereAndBind * @param SC_Product $objProduct */ function getLineCount($whereAndBind, &$objProduct) { $where = $whereAndBind['where']; $bind = $whereAndBind['bind']; // 検索結果対象となる商品の数を取得 $objQuery =& SC_Query_Ex::getSingletonInstance(); $objQuery->setWhere($where); $linemax = $objProduct->findProductCount($objQuery, $bind); return $linemax; // 何件が該当しました。表示用 }
function lfGetProduct($category_id) { // FIXME SC_Product クラスを使用した実装 $objQuery =& SC_Query_Ex::getSingletonInstance(); $col = "alldtl.product_id, name, main_list_image, product_code_min, product_code_max, status"; $objProduct = new SC_Product(); $table = $objProduct->alldtlSQL(); $table .= " LEFT JOIN dtb_product_categories AS T5 ON T5.product_id = alldtl.product_id"; $where = "del_flg = 0 AND category_id = ?"; // 行数の取得 $linemax = $objQuery->count($table, $where, array($category_id)); // 該当件数表示用 $this->tpl_linemax = $linemax; $objNavi = new SC_PageNavi_Ex($this->tpl_pageno, $linemax, SEARCH_PMAX, 'fnNaviPage', NAVI_PMAX); $startno = $objNavi->start_row; $this->tpl_start_row = $objNavi->start_row; $this->tpl_strnavi = $objNavi->strnavi; // Navi表示文字列 $this->tpl_pagemax = $objNavi->max_page; // ページ最大数(「上へ下へ」表示判定用) $this->tpl_disppage = $objNavi->now_page; // 表示ページ番号(「上へ下へ」表示判定用) // 取得範囲の指定(開始行番号、行数のセット) $objQuery->setLimitOffset(SEARCH_PMAX, $startno); $objQuery->setOrder("rank DESC, alldtl.product_id DESC"); $arrRet = $objQuery->select($col, $table, $where, array($category_id)); return $arrRet; }
/** * 商品を検索する. * * @param string $where 検索条件の WHERE 句 * @param array $arrValues 検索条件のパラメーター * @param integer $limit 表示件数 * @param integer $offset 開始件数 * @param string $order 検索結果の並び順 * @param SC_Product $objProduct SC_Product インスタンス * @return array 商品の検索結果 */ public function findProducts($where, $arrValues, $limit, $offset, $order, &$objProduct) { $objQuery =& SC_Query_Ex::getSingletonInstance(); // 読み込む列とテーブルの指定 $col = '*'; $from = $objProduct->alldtlSQL(); $objQuery->setLimitOffset($limit, $offset); $objQuery->setOrder($order); return $objQuery->select($col, $from, $where, $arrValues); }
/** * プロダクトIDの正当性チェック * * @param string $admin_mode * @param int $product_id * @param SC_Product $objProduct * @return integer */ public function lfCheckProductId($admin_mode, $product_id, SC_Product $objProduct) { // 管理機能からの確認の場合は、非公開の商品も表示する。 if (isset($admin_mode) && $admin_mode == 'on' && SC_Utils_Ex::sfIsSuccess(new SC_Session_Ex(), false)) { $include_hidden = true; } else { $include_hidden = false; } if (!$objProduct->isValidProductId($product_id, $include_hidden)) { SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND); } return $product_id; }