Example #1
0
 /**
  * 親IDの配列を元に特定のカラムを取得する.
  *
  * @param  Query $objQuery Query インスタンス
  * @param  string   $table    テーブル名
  * @param  string   $id_name  ID名
  * @param  string   $col_name カラム名
  * @param  array    $arrId    IDの配列
  * @return array    特定のカラムの配列
  */
 public function getParentsCol(Query $objQuery, $table, $id_name, $col_name, $arrId)
 {
     $col = $col_name;
     $len = count($arrId);
     $where = '';
     for ($cnt = 0; $cnt < $len; $cnt++) {
         if ($where == '') {
             $where = "{$id_name} = ?";
         } else {
             $where .= " OR {$id_name} = ?";
         }
     }
     $objQuery->setOrder('level');
     $arrRet = $objQuery->select($col, $table, $where, $arrId);
     return $arrRet;
 }
Example #2
0
    /**
     * Query インスタンスに設定された検索条件を使用して商品規格を取得する.
     *
     * @param  Query $objQuery Queryインスタンス
     * @param  array    $params   検索パラメーターの配列
     * @return array    商品規格の配列
     */
    public function getProductsClassByQuery(Query &$objQuery, $params)
    {
        // 末端の規格を取得
        $col = <<<__EOS__
            T1.product_id,
            T1.stock,
            T1.stock_unlimited,
            T1.sale_limit,
            T1.price01,
            T1.price02,
            T1.point_rate,
            T1.product_code,
            T1.product_class_id,
            T1.del_flg,
            T1.product_type_id,
            T1.down_filename,
            T1.down_realfilename,
            T3.name AS classcategory_name1,
            T3.rank AS rank1,
            T4.name AS class_name1,
            T4.class_id AS class_id1,
            T1.classcategory_id1,
            T1.classcategory_id2,
            dtb_classcategory2.name AS classcategory_name2,
            dtb_classcategory2.rank AS rank2,
            dtb_class2.name AS class_name2,
            dtb_class2.class_id AS class_id2
__EOS__;
        $table = <<<__EOS__
            dtb_products_class T1
            LEFT JOIN dtb_classcategory T3
                ON T1.classcategory_id1 = T3.classcategory_id
            LEFT JOIN dtb_class T4
                ON T3.class_id = T4.class_id
            LEFT JOIN dtb_classcategory dtb_classcategory2
                ON T1.classcategory_id2 = dtb_classcategory2.classcategory_id
            LEFT JOIN dtb_class dtb_class2
                ON dtb_classcategory2.class_id = dtb_class2.class_id
__EOS__;
        $objQuery->andWhere(' T3.classcategory_id is not null AND dtb_classcategory2.classcategory_id is not null ');
        $objQuery->setOrder('T3.rank DESC, dtb_classcategory2.rank DESC');
        // XXX
        $arrRet = $objQuery->select($col, $table, '', $params);
        return $arrRet;
    }
Example #3
0
 /**
  * 商品情報を取得する(vw_products_allclass使用)
  *
  * @param  Query $objQuery DB操作クラス
  * @return array    $arrProduct 取得結果を配列で返す
  */
 public function lfGetProductsAllclass(&$objQuery)
 {
     // --- 商品一覧の取得
     /* @var $objProduct Product */
     $objProduct = Application::alias('eccube.product');
     $objQuery->setWhere($objProduct->getProductDispConditions());
     $objQuery->setOrder('product_id');
     $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]);
         }
     }
     // 税込金額を設定する
     Application::alias('eccube.product')->setIncTaxToProducts($arrProducts);
     return $arrProducts;
 }