/**
  * お気に入りを取得する
  *
  * @param mixed $customer_id
  * @param mixed $objPage
  * @access private
  * @return array お気に入り商品一覧
  */
 public function lfGetFavoriteProduct($customer_id, &$objPage)
 {
     if (DB_TYPE != 'sqlsrv') {
         return parent::lfGetFavoriteProduct($customer_id, $objPage);
     }
     $objQuery = SC_Query_Ex::getSingletonInstance();
     $objProduct = new SC_Product_Ex();
     $objQuery->setOrder('f.create_date DESC');
     $where = 'f.customer_id = ? and p.status = 1';
     if (NOSTOCK_HIDDEN) {
         $where .= ' AND EXISTS(SELECT * FROM dtb_products_class WHERE product_id = f.product_id AND del_flg = 0 AND (stock >= 1 OR stock_unlimited = 1))';
     }
     $arrProductId = $objQuery->getCol('f.product_id', 'dtb_customer_favorite_products f inner join dtb_products p on f.product_id = p.product_id ', $where, array($customer_id));
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $objQuery->setWhere($this->lfMakeWhere('alldtl.', $arrProductId));
     $linemax = $objProduct->findProductCount($objQuery);
     $objPage->tpl_linemax = $linemax;
     // 何件が該当しました。表示用
     // ページ送りの取得
     $objNavi = new SC_PageNavi_Ex($objPage->tpl_pageno, $linemax, SEARCH_PMAX, 'eccube.movePage', NAVI_PMAX);
     $this->tpl_strnavi = $objNavi->strnavi;
     // 表示文字列
     $startno = $objNavi->start_row;
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     //$objQuery->setLimitOffset(SEARCH_PMAX, $startno);
     // 取得範囲の指定(開始行番号、行数のセット)
     $arrProductId = array_slice($arrProductId, $startno, SEARCH_PMAX);
     $where = $this->lfMakeWhere('', $arrProductId);
     $where .= ' AND del_flg = 0';
     $objQuery->setWhere($where, $arrProductId);
     $arrProducts = $objProduct->lists($objQuery);
     //取得している並び順で並び替え
     $arrProducts2 = array();
     foreach ($arrProducts as $item) {
         $arrProducts2[$item['product_id']] = $item;
     }
     $arrProductsList = array();
     foreach ($arrProductId as $product_id) {
         $arrProductsList[] = $arrProducts2[$product_id];
     }
     // 税込金額を設定する
     SC_Product_Ex::setIncTaxToProducts($arrProductsList);
     return $arrProductsList;
 }
 /**
  * 商品情報を取得する(vw_products_allclass使用)
  *
  * @param SC_Query $objQuery DB操作クラス
  * @return array $arrProduct 取得結果を配列で返す
  */
 function lfGetProductsAllclass(&$objQuery)
 {
     // --- 商品一覧の取得
     $objQuery->setWhere('del_flg = 0 AND status = 1');
     $objQuery->setOrder('product_id');
     $objProduct = new SC_Product_Ex();
     $arrProductLsit = $objProduct->lists($objQuery);
     // 各商品のカテゴリIDとランクの取得
     $arrProducts = array();
     foreach ($arrProductLsit as $key => $val) {
         $sql = '';
         $sql .= ' SELECT';
         $sql .= '   T1.category_id,';
         $sql .= '   T1.rank AS product_rank,';
         $sql .= '   T2.rank AS category_rank';
         $sql .= ' FROM';
         $sql .= '   dtb_product_categories AS T1';
         $sql .= ' LEFT JOIN';
         $sql .= '   dtb_category AS T2';
         $sql .= ' ON';
         $sql .= '   T1.category_id = T2.category_id';
         $sql .= ' WHERE';
         $sql .= '   product_id = ?';
         $arrCategory = $objQuery->getAll($sql, array($val['product_id']));
         if (!empty($arrCategory)) {
             $arrProducts[$key] = array_merge($val, $arrCategory[0]);
         }
     }
     // 税込金額を設定する
     SC_Product_Ex::setIncTaxToProducts($arrProducts);
     return $arrProducts;
 }
예제 #3
0
 /**
  * お気に入りを取得する
  *
  * @param mixed $customer_id
  * @param mixed $objPage
  * @access private
  * @return array お気に入り商品一覧
  */
 function lfGetFavoriteProduct($customer_id, &$objPage)
 {
     $objQuery = SC_Query_Ex::getSingletonInstance();
     $objProduct = new SC_Product_Ex();
     $objQuery->setOrder('create_date DESC');
     $arrProductId = $objQuery->getCol('product_id', 'dtb_customer_favorite_products', 'customer_id = ?', array($customer_id));
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $objQuery->setWhere($this->lfMakeWhere('alldtl.', $arrProductId));
     $linemax = $objProduct->findProductCount($objQuery);
     $objPage->tpl_linemax = $linemax;
     // 何件が該当しました。表示用
     // ページ送りの取得
     $objNavi = new SC_PageNavi_Ex($objPage->tpl_pageno, $linemax, SEARCH_PMAX, 'fnNaviPage', NAVI_PMAX);
     $this->tpl_strnavi = $objNavi->strnavi;
     // 表示文字列
     $startno = $objNavi->start_row;
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     //$objQuery->setLimitOffset(SEARCH_PMAX, $startno);
     // 取得範囲の指定(開始行番号、行数のセット)
     $arrProductId = array_slice($arrProductId, $startno, SEARCH_PMAX);
     $where = $this->lfMakeWhere('', $arrProductId);
     $where .= ' AND del_flg = 0';
     $objQuery->setWhere($where, $arrProductId);
     $arrProducts = $objProduct->lists($objQuery);
     //取得している並び順で並び替え
     $arrProducts2 = array();
     foreach ($arrProducts as $item) {
         $arrProducts2[$item['product_id']] = $item;
     }
     $arrProductsList = array();
     foreach ($arrProductId as $product_id) {
         $arrProductsList[] = $arrProducts2[$product_id];
     }
     // 税込金額を設定する
     SC_Product_Ex::setIncTaxToProducts($arrProductsList);
     return $arrProductsList;
 }