Exemple #1
0
 /**
  * 商品を検索する.
  *
  * @param  string     $where      検索条件の WHERE 句
  * @param  array      $arrValues  検索条件のパラメーター
  * @param  integer    $limit      表示件数
  * @param  integer    $offset     開始件数
  * @param  string     $order      検索結果の並び順
  * @param  Product $objProduct Product インスタンス
  * @return array      商品の検索結果
  */
 public function findProducts($where, $arrValues, $limit, $offset, $order, Product &$objProduct)
 {
     $objQuery = Application::alias('eccube.query');
     // 読み込む列とテーブルの指定
     $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);
 }
Exemple #2
0
 /**
  * プロダクトIDの正当性チェック
  *
  * @param string $admin_mode
  * @param int $product_id
  * @param Product $objProduct
  * @return integer
  */
 public function lfCheckProductId($admin_mode, $product_id, Product $objProduct)
 {
     // 管理機能からの確認の場合は、非公開の商品も表示する。
     if (isset($admin_mode) && $admin_mode == 'on' && Utils::sfIsSuccess(new Session(), false)) {
         $include_hidden = true;
     } else {
         $include_hidden = false;
     }
     if (!$objProduct->isValidProductId($product_id, $include_hidden)) {
         Utils::sfDispSiteError(PRODUCT_NOT_FOUND);
     }
     return $product_id;
 }
 /**
  * 商品取得
  *
  * @param array      $arrProductId
  * @param Product $objProduct
  */
 public function getProductList($arrProductId, Product &$objProduct)
 {
     $objQuery = Application::alias('eccube.query');
     // 表示順序
     $order = 'update_date DESC, product_id DESC';
     $objQuery->setOrder($order);
     return $objProduct->getListByProductIds($objQuery, $arrProductId);
 }
 /**
  * @param Product $objProduct
  */
 public function lfGetProductsList($searchCondition, $disp_number, $startno, &$objProduct)
 {
     $objQuery = Application::alias('eccube.query');
     $arrOrderVal = array();
     // 表示順序
     switch ($this->orderby) {
         // 販売価格が安い順
         case 'price':
             $objProduct->setProductsOrder('price02', 'dtb_products_class', 'ASC');
             break;
             // 新着順
         // 新着順
         case 'date':
             $objProduct->setProductsOrder('create_date', 'dtb_products', 'DESC');
             break;
         default:
             if (strlen($searchCondition['where_category']) >= 1) {
                 $dtb_product_categories = '(SELECT * FROM dtb_product_categories WHERE ' . $searchCondition['where_category'] . ')';
                 $arrOrderVal = $searchCondition['arrvalCategory'];
             } else {
                 $dtb_product_categories = 'dtb_product_categories';
             }
             $col = 'MAX(T3.rank * 2147483648 + T2.rank)';
             $from = "{$dtb_product_categories} T2 JOIN dtb_category T3 ON T2.category_id = T3.category_id";
             $where = 'T2.product_id = alldtl.product_id';
             $sub_sql = $objQuery->getSql($col, $from, $where);
             $objQuery->setOrder("({$sub_sql}) DESC ,product_id DESC");
             break;
     }
     // 取得範囲の指定(開始行番号、行数のセット)
     $objQuery->setLimitOffset($disp_number, $startno);
     $objQuery->setWhere($searchCondition['where']);
     // 表示すべきIDとそのIDの並び順を一気に取得
     $arrProductId = $objProduct->findProductIdsOrder($objQuery, array_merge($searchCondition['arrval'], $arrOrderVal));
     $objQuery = Application::alias('eccube.query');
     $arrProducts = $objProduct->getListByProductIds($objQuery, $arrProductId);
     // 規格を設定
     $objProduct->setProductsClassByProductIds($arrProductId);
     $arrProducts['productStatus'] = $objProduct->getProductStatus($arrProductId);
     return $arrProducts;
 }
 /**
  *
  * 検索結果対象となる商品の数を返す。
  * @param array      $whereAndBind
  * @param Product $objProduct
  */
 public function getLineCount($whereAndBind, &$objProduct)
 {
     $where = $whereAndBind['where'];
     $bind = $whereAndBind['bind'];
     // 検索結果対象となる商品の数を取得
     $objQuery = Application::alias('eccube.query');
     $objQuery->setWhere($where);
     $linemax = $objProduct->findProductCount($objQuery, $bind);
     return $linemax;
     // 何件が該当しました。表示用
 }