コード例 #1
0
ファイル: ItemSearch.php プロジェクト: nassos9090/plugin
 public function doAction($arrParam)
 {
     $arrRequest = $this->doInitParam($arrParam);
     if (!$this->isParamError()) {
         $masterData = new SC_DB_MasterData_Ex();
         $arrSTATUS = $masterData->getMasterData('mtb_status');
         $arrSTATUS_IMAGE = $masterData->getMasterData('mtb_status_image');
         $objProduct = new SC_Product_Ex();
         $arrSearchData = array('category_id' => $arrRequest['BrowseNode'], 'maker_name' => $arrRequest['Manufacturer'], 'name' => $arrRequest['Keywords'], 'orderby' => $arrRequest['Sort']);
         $arrSearchCondition = $this->getSearchCondition($arrSearchData);
         $disp_number = 10;
         $objQuery =& SC_Query_Ex::getSingletonInstance();
         $objQuery->setWhere($arrSearchCondition['where_for_count']);
         $objProduct = new SC_Product_Ex();
         $linemax = $objProduct->findProductCount($objQuery, $arrSearchCondition['arrval']);
         $objNavi = new SC_PageNavi_Ex($arrRequest['ItemPage'], $tpl_linemax, $disp_number);
         $arrProducts = $this->getProductsList($arrSearchCondition, $disp_number, $objNavi->start_row, $linemax, $objProduct);
         if (!SC_Utils_Ex::isBlank($arrProducts)) {
             $arrProducts = $this->setStatusDataTo($arrProducts, $arrSTATUS, $arrSTATUS_IMAGE);
             $arrProducts = $objProduct->setPriceTaxTo($arrProducts);
             foreach ($arrProducts as $key => $val) {
                 $arrProducts[$key]['main_list_image'] = SC_Utils_Ex::sfNoImageMainList($val['main_list_image']);
             }
             $arrData = array();
             foreach ($arrProducts as $key => $val) {
                 $arrData[] = array('product_id' => $val['product_id'], 'DetailPageURL' => HTTP_URL . 'products/detail.php?product_id=' . $val['product_id'], 'ItemAttributes' => $val);
             }
             $this->setResponse('Item', $arrData);
             return true;
         } else {
             $this->addError('ItemSearch.Error', '※ 要求された情報は見つかりませんでした。');
         }
     }
     return false;
 }
コード例 #2
0
 /**
  * Page のAction.
  *
  * @return void
  */
 public function action()
 {
     parent::action();
     $objProduct = new SC_Product_Ex();
     $objDb = new SC_Helper_DB_Ex();
     $this->tpl_buy_porduct = array_key_exists($this->tpl_product_id, $this->arrRedownloadProduct);
     $category_id = $objProduct->getCategoryIds($this->tpl_product_id);
     $this->arrProduct["category_id"] = array_shift($category_id);
     $this->arrProduct["category"] = $this->arrCategory[$this->arrProduct["category_id"]];
     $this->arrProduct["category_name"] = $this->arrProduct["category"]["category_name"];
     if ($objDb->sfColumnExists('dtb_category', 'category_code')) {
         $this->arrProduct["category_code"] = $this->arrProduct["category"]["category_code"];
         $this->arrProduct["category_image1"] = $this->arrProduct["category"]["category_image1"] ?: 0;
         $this->arrProduct["category_image2"] = $this->arrProduct["category"]["category_image2"] ?: 0;
         $this->arrProduct["category_image3"] = $this->arrProduct["category"]["category_image3"] ?: 0;
         $this->arrProduct["category_image4"] = $this->arrProduct["category"]["category_image4"] ?: 0;
         $this->arrProduct["category_image5"] = $this->arrProduct["category"]["category_image5"] ?: 0;
     }
     $config = SC_AuonePayment_Ex::getConfig("free_field2");
     $mode = $this->getMode();
     $this->mode = $mode;
     switch ($this->getMode()) {
         case "download":
         case "check_buy_and_download":
             $this->doCheckBuyAndDownload($config);
             break;
         case "download_ok":
         case "check_buy_and_download_ok":
             $this->doCheckBuyAndDownloadOk($config);
             break;
         case "download_ng":
         case "check_buy_and_download_ng":
             unset($_SESSION["product_ktc_vid"]);
             SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", true, "このテーマには対応していません。");
             break;
     }
     $bgcolor = $this->arrProduct["bgcolor"];
     $fgcolor = $this->arrProduct["fgcolor"];
     $lkcolor = $this->arrProduct["lkcolor"];
     if (strlen($bgcolor) && strlen($fgcolor) && strlen($fgcolor)) {
         $this->tpl_onload .= "\$('section.cont01:eq(0)  ').css({\n            'background-color':'#{$bgcolor}','color':'#{$fgcolor}'\n        });";
         $this->tpl_onload .= "\$('section.cont01:eq(0) a[href*=\"www.kisekae-touch.com\"]').css({\n            'color':'#{$lkcolor}'\n        });";
     }
     switch (basename($_SERVER["SCRIPT_NAME"], ".php")) {
         case "detail":
             $this->check_os();
             break;
         case "detail_spass":
             if (!isset($this->arrProduct["product_code_spass"])) {
                 SC_Utils::sfDispSiteError(PRODUCT_NOT_FOUND);
             }
             $objQuery = SC_Query_Ex::getSingletonInstance();
             $objQuery->setWhere("spass_provide_start_date <= NOW()");
             $objQuery->andWhere("spass_provide_end_date   >= NOW()");
             $objQuery->andWhere("product_id                = ? ");
             $this->arrSpassProduct = $objProduct->findProductCount($objQuery, array($this->tpl_product_id));
             break;
     }
 }
 /**
  * お気に入りを取得する
  *
  * @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;
 }
コード例 #4
0
 /**
  * 該当件数の取得
  *
  * @return int
  */
 public function lfGetProductAllNum($searchCondition)
 {
     // 検索結果対象となる商品の数を取得
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $objQuery->setWhere($searchCondition['where_for_count']);
     $objProduct = new SC_Product_Ex();
     return $objProduct->findProductCount($objQuery, $searchCondition['arrval']);
 }
コード例 #5
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;
 }