本文整理汇总了PHP中SC_Product_Ex::getCategoryIds方法的典型用法代码示例。如果您正苦于以下问题:PHP SC_Product_Ex::getCategoryIds方法的具体用法?PHP SC_Product_Ex::getCategoryIds怎么用?PHP SC_Product_Ex::getCategoryIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SC_Product_Ex
的用法示例。
在下文中一共展示了SC_Product_Ex::getCategoryIds方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lfGetRanking
/**
* おすすめ商品検索.
*
* @return array $arrBestProducts 検索結果配列
*/
public function lfGetRanking()
{
$arrRecommends = parent::lfGetRanking();
$detect = new Mobile_Detect();
$cur_category_id = 0;
if ($detect->is("AndroidOS")) {
$cur_category_id = 1;
} elseif ($detect->is("iOS")) {
$cur_category_id = 2;
} else {
return array();
}
$response = array();
if (count($arrRecommends) > 0) {
$objProduct = new SC_Product_Ex();
foreach ($arrRecommends as $value) {
$product_id = $value['product_id'];
$category_id = $objProduct->getCategoryIds($product_id);
if (in_array($cur_category_id, $category_id)) {
// nop
$response[] = $value;
}
}
}
return $response;
}
示例2: action
/**
* 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;
}
}
示例3: lfGetProductsList
/**
*
* @param SC_Product_Ex $objProduct
*/
public function lfGetProductsList($searchCondition, $disp_number, $startno, &$objProduct)
{
$objQuery =& SC_Query_Ex::getSingletonInstance();
$objDb = new SC_Helper_DB_Ex();
$arrOrderVal = array();
// 表示順序
switch ($this->orderby) {
// ダウンロード順
case 'download':
$status = ORDER_PRE_END;
$objProduct->setProductsOrder('count(*)', "(SELECT B.* FROM dtb_order A INNER JOIN dtb_order_detail B USING(order_id) WHERE A.del_flg = 0 AND A.status = {$status})", 'ASC');
break;
// 販売価格が安い順
// 販売価格が安い順
case 'price':
$objProduct->setProductsOrder('price02', 'dtb_products_class', 'ASC');
break;
// 新着順
// 新着順
case 'date':
if ($objDb->sfColumnExists('dtb_products', 'auto_display_start_date')) {
$objProduct->setProductsOrder('auto_display_start_date', 'dtb_products', 'DESC');
} else {
$objProduct->setProductsOrder('create_date', 'dtb_products', 'DESC');
}
break;
default:
// FIXME 指定した カラムが損z内下場合はそのカラムをキーとする。
if ($objDb->sfColumnExists('dtb_products', 'auto_display_start_date') && strlen($this->orderby) == 0) {
$objProduct->setProductsOrder('auto_display_start_date', 'dtb_products', 'DESC');
} elseif ($objDb->sfColumnExists('dtb_products', $this->orderby)) {
$objProduct->setProductsOrder($this->orderby, 'dtb_products', 'DESC');
break;
}
case "rank":
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 =& SC_Query_Ex::getSingletonInstance();
$arrProducts = $objProduct->getListByProductIds($objQuery, $arrProductId);
// 規格を設定
$objProduct->setProductsClassByProductIds($arrProductId);
$arrProducts['productStatus'] = $objProduct->getProductStatus($arrProductId);
foreach ($arrProducts as $product_id => &$arrProduct) {
if ($product_id == 'productStatus') {
continue;
}
$category_id = $objProduct->getCategoryIds($product_id);
$arrProduct["category_id"] = array_shift($category_id);
$arrProduct["category"] = $this->arrCategory[$arrProduct["category_id"]];
$arrProduct["category_name"] = $arrProduct["category"]["category_name"];
if ($objDb->sfColumnExists('dtb_category', 'category_code')) {
$arrProduct["category_code"] = $arrProduct["category"]["category_code"];
$arrProduct["category_image1"] = $arrProduct["category"]["category_image1"] ?: 0;
$arrProduct["category_image2"] = $arrProduct["category"]["category_image2"] ?: 0;
$arrProduct["category_image3"] = $arrProduct["category"]["category_image3"] ?: 0;
$arrProduct["category_image4"] = $arrProduct["category"]["category_image4"] ?: 0;
$arrProduct["category_image5"] = $arrProduct["category"]["category_image5"] ?: 0;
}
}
return $arrProducts;
}
示例4: array
function __construct($array, $mode = true)
{
parent::__construct($array);
GC_Utils_Ex::gfPrintLog(print_r($this->arrSql, true), DEBUG_LOG_REALFILE);
$this->arrWhereVal = array();
$objDb = new SC_Helper_DB_Ex();
$this->setEquals("0", "del_flg", "is_numeric");
if ($mode && ($_REQUEST["mode"] == "pre_edit" || $_REQUEST["mode"] == "preEdit")) {
// FIXME 端末ID(編集対象 )
$this->setEquals($this->arrSql["edit_device_id"], "device_id", "is_numeric");
return;
}
// FIXME 端末ID
$this->setEquals($this->arrSql["search_device_id"], "device_id", "is_numeric");
// FIXME 端末名
$this->setLike($this->arrSql["search_device_name"], "device_name");
// FIXME OS(発売)
$this->setFromTo($this->arrSql["search_os_min_version_min"], $this->arrSql["search_os_min_version_max"], "os_min_version");
// FIXME OS(最新)
$this->setFromTo($this->arrSql["search_os_max_version_min"], $this->arrSql["search_os_max_version_max"], "os_max_version");
// FIXME OS(発売|最新)
$this->setFromTo($this->arrSql["search_os_version_min"], $this->arrSql["search_os_version_max"], array("os_min_version", "os_max_version"));
// FIXME サイズ(幅)
if (is_numeric($this->arrSql["search_display_width_min"]) || is_numeric($this->arrSql["search_display_width_max"])) {
$this->setFromTo($this->arrSql["search_display_width_min"], $this->arrSql["search_display_width_max"], "display_width");
}
// FIXME サイズ(高)
if (is_numeric($this->arrSql["search_display_height_min"]) || is_numeric($this->arrSql["search_display_height_max"])) {
$this->setFromTo($this->arrSql["search_display_height_min"], $this->arrSql["search_display_height_max"], "display_height");
}
$base_table = $this->table;
// FIXME カテゴリーID
if (is_numeric($this->arrSql["search_category_id"])) {
list($where, $arrRet) = $objDb->sfGetCatWhere($this->arrSql["search_category_id"]);
$this->setWhere(" EXISTS (SELECT 1 FROM cp_dtb_device_categories A WHERE A.device_id = {$base_table}.device_id AND {$where})");
$this->arrWhereVal = array_merge($this->arrWhereVal, $arrRet);
} elseif ($this->arrSql["search_category_id_unset"] == "1" || $this->arrSql["search_category_id_unset"][0] == "1") {
$this->setWhere("NOT EXISTS (SELECT 1 FROM cp_dtb_device_categories A WHERE A.device_id = {$base_table}.device_id)");
}
// FIXME 商品ID
if (is_numeric($this->arrSql["search_product_id"])) {
$id = $this->arrSql["search_product_id"];
$objProduct = new SC_Product_Ex();
if ($objProduct->isValidProductId($id)) {
$arrCategory_id = $objProduct->getCategoryIds($id);
foreach ($arrCategory_id as $category_id) {
list($where, $arrRet) = $objDb->sfGetCatWhere($category_id);
// TODO cp_dtb_device_products 連携
$this->setWhere(" EXISTS (SELECT 1 FROM cp_dtb_device_categories A WHERE A.device_id = {$base_table}.device_id AND {$where})");
$this->arrWhereVal = array_merge($this->arrWhereVal, $arrRet);
}
}
}
// FIXME キャリア
if (is_numeric($this->arrSql["search_carrier"])) {
$this->setEquals($this->arrSql["search_carrier"], 'carrier');
}
// FIXME 状態
if (is_array($this->arrSql["search_status"])) {
$this->setItemTerm($this->arrSql["search_status"], 'status');
} elseif (is_numeric($this->arrSql["search_status"])) {
$this->setEquals($this->arrSql["search_status"], 'status');
}
// FIXME UA
$this->setEquals($this->arrSql["search_device_user_agent_word"], array('device_user_agent_word_1', 'device_user_agent_word_2', 'device_user_agent_word_3'));
// END
GC_Utils_Ex::gfPrintLog(print_r($this->arrWhereVal, true), DEBUG_LOG_REALFILE);
}