本文整理汇总了PHP中SC_Utils_Ex::sfGetRandomString方法的典型用法代码示例。如果您正苦于以下问题:PHP SC_Utils_Ex::sfGetRandomString方法的具体用法?PHP SC_Utils_Ex::sfGetRandomString怎么用?PHP SC_Utils_Ex::sfGetRandomString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SC_Utils_Ex
的用法示例。
在下文中一共展示了SC_Utils_Ex::sfGetRandomString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sfEditCustomerData
/**
* 会員情報の登録・編集処理を行う.
*
* @param array $arrData 登録するデータの配列(SC_FormParamのgetDbArrayの戻り値)
* @param array $customer_id nullの場合はinsert, 存在する場合はupdate
* @access public
* @return integer 登録編集したユーザーのcustomer_id
*/
public function sfEditCustomerData($arrData, $customer_id = null)
{
$objQuery =& SC_Query_Ex::getSingletonInstance();
$objQuery->begin();
$old_version_flag = false;
$arrData['update_date'] = 'CURRENT_TIMESTAMP';
// 更新日
// salt値の生成(insert時)または取得(update時)。
if (is_numeric($customer_id)) {
$salt = $objQuery->get('salt', 'dtb_customer', 'customer_id = ? ', array($customer_id));
// 旧バージョン(2.11未満)からの移行を考慮
if (strlen($salt) === 0) {
$old_version_flag = true;
}
} else {
$salt = SC_Utils_Ex::sfGetRandomString(10);
$arrData['salt'] = $salt;
}
//-- パスワードの更新がある場合は暗号化
if ($arrData['password'] == DEFAULT_PASSWORD or $arrData['password'] == '') {
//更新しない
unset($arrData['password']);
} else {
// 旧バージョン(2.11未満)からの移行を考慮
if ($old_version_flag) {
$is_password_updated = true;
$salt = SC_Utils_Ex::sfGetRandomString(10);
$arrData['salt'] = $salt;
}
$arrData['password'] = SC_Utils_Ex::sfGetHashString($arrData['password'], $salt);
}
//-- 秘密の質問の更新がある場合は暗号化
if ($arrData['reminder_answer'] == DEFAULT_PASSWORD or $arrData['reminder_answer'] == '') {
//更新しない
unset($arrData['reminder_answer']);
// 旧バージョン(2.11未満)からの移行を考慮
if ($old_version_flag && $is_password_updated) {
// パスワードが更新される場合は、平文になっている秘密の質問を暗号化する
$reminder_answer = $objQuery->get('reminder_answer', 'dtb_customer', 'customer_id = ? ', array($customer_id));
$arrData['reminder_answer'] = SC_Utils_Ex::sfGetHashString($reminder_answer, $salt);
}
} else {
// 旧バージョン(2.11未満)からの移行を考慮
if ($old_version_flag && !$is_password_updated) {
// パスワードが更新されない場合は、平文のままにする
unset($arrData['salt']);
} else {
$arrData['reminder_answer'] = SC_Utils_Ex::sfGetHashString($arrData['reminder_answer'], $salt);
}
}
//デフォルト国IDを追加
if (FORM_COUNTRY_ENABLE == false) {
$arrData['country_id'] = DEFAULT_COUNTRY_ID;
}
//-- 編集登録実行
if (is_numeric($customer_id)) {
// 編集
$objQuery->update('dtb_customer', $arrData, 'customer_id = ? ', array($customer_id));
} else {
// 新規登録
// 会員ID
$customer_id = $objQuery->nextVal('dtb_customer_customer_id');
$arrData['customer_id'] = $customer_id;
// 作成日
if (is_null($arrData['create_date'])) {
$arrData['create_date'] = 'CURRENT_TIMESTAMP';
}
$objQuery->insert('dtb_customer', $arrData);
}
$objQuery->commit();
return $customer_id;
}
示例2: action
/**
* Page のAction.
*
* @return void
*/
public function action()
{
//決済処理中ステータスのロールバック
$objPurchase = new SC_Helper_Purchase_Ex();
$objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG);
$objProduct = new SC_Product_Ex();
// パラメーター管理クラス
$objFormParam = new SC_FormParam_Ex();
// パラメーター情報の初期化
$this->lfInitParam($objFormParam);
// 値の設定
$objFormParam->setParam($_REQUEST);
// 入力値の変換
$objFormParam->convParam();
// 値の取得
$this->arrForm = $objFormParam->getHashArray();
//modeの取得
$this->mode = $this->getMode();
//表示条件の取得
$this->arrSearchData = array('category_id' => $this->lfGetCategoryId(intval($this->arrForm['category_id'])), 'maker_id' => intval($this->arrForm['maker_id']), 'name' => $this->arrForm['name']);
$this->orderby = $this->arrForm['orderby'];
//ページング設定
$this->tpl_pageno = $this->arrForm['pageno'];
$this->disp_number = $this->lfGetDisplayNum($this->arrForm['disp_number']);
// 画面に表示するサブタイトルの設定
$this->tpl_subtitle = $this->lfGetPageTitle($this->mode, $this->arrSearchData['category_id']);
// 画面に表示する検索条件を設定
$this->arrSearch = $this->lfGetSearchConditionDisp($this->arrSearchData);
// 商品一覧データの取得
$arrSearchCondition = $this->lfGetSearchCondition($this->arrSearchData);
$this->tpl_linemax = $this->lfGetProductAllNum($arrSearchCondition);
$urlParam = "category_id={$this->arrSearchData['category_id']}&pageno=#page#";
// モバイルの場合に検索条件をURLの引数に追加
if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
$searchNameUrl = urlencode(mb_convert_encoding($this->arrSearchData['name'], 'SJIS-win', 'UTF-8'));
$urlParam .= "&mode={$this->mode}&name={$searchNameUrl}&orderby={$this->orderby}";
}
$this->objNavi = new SC_PageNavi_Ex($this->tpl_pageno, $this->tpl_linemax, $this->disp_number, 'eccube.movePage', NAVI_PMAX, $urlParam, SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE);
$this->arrProducts = $this->lfGetProductsList($arrSearchCondition, $this->disp_number, $this->objNavi->start_row, $objProduct);
switch ($this->getMode()) {
case 'json':
$this->doJson($objProduct);
break;
default:
$this->doDefault($objProduct, $objFormParam);
break;
}
$this->tpl_rnd = SC_Utils_Ex::sfGetRandomString(3);
}
示例3: updateMemberData
/**
* 管理者データをUpdateする.
*
* @param array 管理者データの連想配列
* @return void
*/
function updateMemberData($member_id, $arrMemberData)
{
$objQuery =& SC_Query_Ex::getSingletonInstance();
// Updateする値を作成する.
$sqlVal = array();
$sqlVal['name'] = $arrMemberData['name'];
$sqlVal['department'] = $arrMemberData['department'];
$sqlVal['login_id'] = $arrMemberData['login_id'];
$sqlVal['authority'] = $arrMemberData['authority'];
$sqlVal['work'] = $arrMemberData['work'];
$sqlVal['update_date'] = 'CURRENT_TIMESTAMP';
if ($arrMemberData['password'] != DEFAULT_PASSWORD) {
$salt = SC_Utils_Ex::sfGetRandomString(10);
$sqlVal['salt'] = $salt;
$sqlVal['password'] = SC_Utils_Ex::sfGetHashString($arrMemberData['password'], $salt);
}
$where = 'member_id = ?';
// UPDATEの実行
$objQuery->update('dtb_member', $sqlVal, $where, array($member_id));
}
示例4: action
/**
* Page のAction.
*
* @return void
*/
function action()
{
$objProduct = new SC_Product_Ex();
$this->arrForm = $_REQUEST;
//時間が無いのでコレで勘弁してください。 tao_s
//modeの取得
$this->mode = $this->getMode();
//表示条件の取得
$this->arrSearchData = array('category_id' => $this->lfGetCategoryId(intval($this->arrForm['category_id'])), 'maker_id' => intval($this->arrForm['maker_id']), 'name' => $this->arrForm['name']);
$this->orderby = $this->arrForm['orderby'];
//ページング設定
$this->tpl_pageno = $this->arrForm['pageno'];
$this->disp_number = $this->lfGetDisplayNum($this->arrForm['disp_number']);
// 画面に表示するサブタイトルの設定
$this->tpl_subtitle = $this->lfGetPageTitle($this->mode, $this->arrSearchData['category_id']);
// 画面に表示する検索条件を設定
$this->arrSearch = $this->lfGetSearchConditionDisp($this->arrSearchData);
// 商品一覧データの取得
$arrSearchCondition = $this->lfGetSearchCondition($this->arrSearchData);
$this->tpl_linemax = $this->lfGetProductAllNum($arrSearchCondition);
$urlParam = "category_id={$this->arrSearchData['category_id']}&pageno=#page#";
// モバイルの場合に検索条件をURLの引数に追加
if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
$searchNameUrl = urlencode(mb_convert_encoding($this->arrSearchData['name'], 'SJIS-win', 'UTF-8'));
$urlParam .= "&mode={$this->mode}&name={$searchNameUrl}&orderby={$this->orderby}";
}
$this->objNavi = new SC_PageNavi_Ex($this->tpl_pageno, $this->tpl_linemax, $this->disp_number, 'fnNaviPage', NAVI_PMAX, $urlParam, SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE);
$this->arrProducts = $this->lfGetProductsList($arrSearchCondition, $this->disp_number, $this->objNavi->start_row, $this->tpl_linemax, $objProduct);
switch ($this->getMode()) {
case 'json':
$this->doJson($objProduct);
break;
default:
$this->doDefault($objProduct);
break;
}
$this->tpl_rnd = SC_Utils_Ex::sfGetRandomString(3);
}
示例5: lfMakeConfigFile
function lfMakeConfigFile()
{
global $objWebParam;
global $objDBParam;
$normal_url = $objWebParam->getValue('normal_url');
// 語尾に'/'をつける
$normal_url = rtrim($normal_url, '/') . '/';
$secure_url = $objWebParam->getValue('secure_url');
// 語尾に'/'をつける
$secure_url = rtrim($secure_url, '/') . '/';
// ディレクトリの取得
$url_dir = preg_replace('|^https?://[a-zA-Z0-9_:~=&\\?\\.\\-]+|', '', $normal_url);
//管理機能SSL制限
if ($objWebParam->getValue('admin_force_ssl') == 1 and strpos($secure_url, 'https://') !== FALSE) {
$force_ssl = 'TRUE';
} else {
$force_ssl = 'FALSE';
}
//管理機能IP制限
$allow_hosts = array();
$hosts = $objWebParam->getValue('admin_allow_hosts');
if (!empty($hosts)) {
$hosts = str_replace("\r", '', $hosts);
if (strpos($hosts, "\n") === false) {
$hosts .= "\n";
}
$hosts = explode("\n", $hosts);
foreach ($hosts as $key => $host) {
$host = trim($host);
if (strlen($host) >= 8) {
$allow_hosts[] = $host;
}
}
}
//パスワード暗号化方式決定
$arrAlgos = hash_algos();
if (array_search('sha256', $arrAlgos) !== FALSE) {
$algos = 'sha256';
} elseif (array_search('sha1', $arrAlgos) !== FALSE) {
$algos = 'sha1';
} elseif (array_search('md5', $arrAlgos) !== FALSE) {
$algos = 'md5';
} else {
$algos = '';
}
//MAGICハッシュワード決定
if ($_POST['db_skip'] && defined('AUTH_MAGIC')) {
$auth_magic = AUTH_MAGIC;
} else {
$auth_magic = SC_Utils_Ex::sfGetRandomString(40);
define('AUTH_MAGIC', $auth_magic);
}
// FIXME 変数出力はエスケープすべき
$config_data = "<?php\n" . "define('ECCUBE_INSTALL', 'ON');\n" . "define('HTTP_URL', '" . $normal_url . "');\n" . "define('HTTPS_URL', '" . $secure_url . "');\n" . "define('ROOT_URLPATH', '" . $url_dir . "');\n" . "define('DOMAIN_NAME', '" . $objWebParam->getValue('domain') . "');\n" . "define('DB_TYPE', '" . $objDBParam->getValue('db_type') . "');\n" . "define('DB_USER', '" . $objDBParam->getValue('db_user') . "');\n" . "define('DB_PASSWORD', '" . $objDBParam->getValue('db_password') . "');\n" . "define('DB_SERVER', '" . $objDBParam->getValue('db_server') . "');\n" . "define('DB_NAME', '" . $objDBParam->getValue('db_name') . "');\n" . "define('DB_PORT', '" . $objDBParam->getValue('db_port') . "');\n" . "define('ADMIN_DIR', '" . $objWebParam->getValue('admin_dir') . "/');\n" . "define('ADMIN_FORCE_SSL', " . $force_ssl . ");\n" . "define('ADMIN_ALLOW_HOSTS', '" . serialize($allow_hosts) . "');\n" . "define('AUTH_MAGIC', '" . $auth_magic . "');\n" . "define('PASSWORD_HASH_ALGOS', '" . $algos . "');\n" . "define('RELEASE_YEAR', '" . date('Y') . "');\n" . "define('MAIL_BACKEND', '" . $objWebParam->getValue('mail_backend') . "');\n" . "define('SMTP_HOST', '" . $objWebParam->getValue('smtp_host') . "');\n" . "define('SMTP_PORT', '" . $objWebParam->getValue('smtp_port') . "');\n" . "define('SMTP_USER', '" . $objWebParam->getValue('smtp_user') . "');\n" . "define('SMTP_PASSWORD', '" . $objWebParam->getValue('smtp_password') . "');\n";
if ($fp = fopen(CONFIG_REALFILE, 'w')) {
fwrite($fp, $config_data);
fclose($fp);
}
}
示例6: lfMakeConfigFile
function lfMakeConfigFile()
{
global $objWebParam;
global $objDBParam;
$normal_url = $objWebParam->getValue('normal_url');
// 語尾に'/'をつける
$normal_url = rtrim($normal_url, '/') . '/';
$secure_url = $objWebParam->getValue('secure_url');
// 語尾に'/'をつける
$secure_url = rtrim($secure_url, '/') . '/';
// ディレクトリの取得
$url_dir = preg_replace('|^https?://[a-zA-Z0-9_:~=&\\?\\.\\-]+|', '', $normal_url);
//管理機能SSL制限
if ($objWebParam->getValue('admin_force_ssl') == 1 and strpos($secure_url, 'https://') !== FALSE) {
$force_ssl = 'TRUE';
} else {
$force_ssl = 'FALSE';
}
//管理機能IP制限
$allow_hosts = array();
$hosts = $objWebParam->getValue('admin_allow_hosts');
if (!empty($hosts)) {
$hosts = str_replace("\r", '', $hosts);
if (strpos($hosts, "\n") === false) {
$hosts .= "\n";
}
$hosts = explode("\n", $hosts);
foreach ($hosts as $key => $host) {
$host = trim($host);
if (strlen($host) >= 8) {
$allow_hosts[] = $host;
}
}
}
//パスワード暗号化方式決定
$arrAlgos = hash_algos();
if (array_search('sha256', $arrAlgos) !== FALSE) {
$algos = 'sha256';
} elseif (array_search('sha1', $arrAlgos) !== FALSE) {
$algos = 'sha1';
} elseif (array_search('md5', $arrAlgos) !== FALSE) {
$algos = 'md5';
} else {
$algos = '';
}
//MAGICハッシュワード決定
if ($_POST['db_skip'] && defined('AUTH_MAGIC')) {
$auth_magic = AUTH_MAGIC;
} else {
$auth_magic = SC_Utils_Ex::sfGetRandomString(40);
define('AUTH_MAGIC', $auth_magic);
}
// FIXME 変数出力はエスケープすべき
$config_data = "<?php\n" . "define('ECCUBE_INSTALL', 'ON');\n" . "define('ADMIN_DIR', '" . $objWebParam->getValue('admin_dir') . "/');\n" . "define('ADMIN_FORCE_SSL', " . $force_ssl . ");\n" . "define('ADMIN_ALLOW_HOSTS', '" . serialize($allow_hosts) . "');\n" . "define('AUTH_MAGIC', '" . $auth_magic . "');\n" . "define('PASSWORD_HASH_ALGOS', '" . $algos . "');\n" . "define('MAIL_BACKEND', '" . $objWebParam->getValue('mail_backend') . "');\n" . "define('SMTP_HOST', '" . $objWebParam->getValue('smtp_host') . "');\n" . "define('SMTP_PORT', '" . $objWebParam->getValue('smtp_port') . "');\n" . "define('SMTP_USER', '" . $objWebParam->getValue('smtp_user') . "');\n" . "define('SMTP_PASSWORD', '" . $objWebParam->getValue('smtp_password') . "');\n";
if (!defined('DEFINE_REALFILE')) {
define('DEFINE_REALFILE', HTML_REALDIR . HTML2DATA_DIR . 'config/define.php');
}
if ($fp = fopen(DEFINE_REALFILE, 'w')) {
fwrite($fp, $config_data);
fclose($fp);
}
$webpi_data = "<?php\n" . "/* WebMatrix Connection String */\n" . sprintf("/* mysql://%s:%s@%s/%s;*/\n", $objDBParam->getValue('db_user'), $objDBParam->getValue('db_password'), $objDBParam->getValue('db_server'), $objDBParam->getValue('db_name')) . "?>\n";
$webpi_filename = HTML_REALDIR . HTML2DATA_DIR . 'config/webmatrix.php';
if ($fp = fopen($webpi_filename, 'w')) {
fwrite($fp, $webpi_data);
fclose($fp);
}
}
示例7: action
/**
* Page のアクション.
*
* @return void
*/
function action()
{
// 基本情報を渡す
$objSiteInfo = SC_Helper_DB_Ex::sfGetBasisData();
$this->arrInfo = $objSiteInfo->data;
// New Product
//おすすめ商品表示
$this->arrBestProducts = $this->lfGetRanking();
$objProduct = new SC_Product_Ex();
// パラメーター管理クラス
$objFormParam = new SC_FormParam_Ex();
// パラメーター情報の初期化
$this->lfInitParam($objFormParam);
// 値の設定
$objFormParam->setParam($_REQUEST);
// 入力値の変換
$objFormParam->convParam();
// 値の取得
$this->arrForm = $objFormParam->getHashArray();
//modeの取得
$this->mode = $this->getMode();
//表示条件の取得
$this->arrSearchData = array('category_id' => $this->lfGetCategoryId(intval($this->arrForm['category_id'])), 'maker_id' => intval($this->arrForm['maker_id']), 'name' => $this->arrForm['name']);
$this->orderby = $this->arrForm['orderby'];
//ページング設定
$this->tpl_pageno = $this->arrForm['pageno'];
$this->disp_number = $this->lfGetDisplayNum($this->arrForm['disp_number']);
// 画面に表示するサブタイトルの設定
$this->tpl_subtitle = $this->lfGetPageTitle($this->mode, $this->arrSearchData['category_id']);
// 画面に表示する検索条件を設定
$this->arrSearch = $this->lfGetSearchConditionDisp($this->arrSearchData);
// 商品一覧データの取得
$arrSearchCondition = $this->lfGetSearchCondition($this->arrSearchData);
$this->tpl_linemax = $this->lfGetProductAllNum($arrSearchCondition);
$urlParam = "category_id={$this->arrSearchData['category_id']}&pageno=#page#";
// モバイルの場合に検索条件をURLの引数に追加
if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
$searchNameUrl = urlencode(mb_convert_encoding($this->arrSearchData['name'], 'SJIS-win', 'UTF-8'));
$urlParam .= "&mode={$this->mode}&name={$searchNameUrl}&orderby={$this->orderby}";
}
$this->objNavi = new SC_PageNavi_Ex($this->tpl_pageno, $this->tpl_linemax, $this->disp_number, 'fnNaviPage', NAVI_PMAX, $urlParam, SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE);
$this->arrProducts = $this->lfGetProductsList($arrSearchCondition, $this->disp_number, $this->objNavi->start_row, $this->tpl_linemax, $objProduct);
switch ($this->getMode()) {
case 'json':
$this->doJson($objProduct);
break;
default:
$this->doDefault($objProduct);
break;
}
$this->tpl_rnd = SC_Utils_Ex::sfGetRandomString(3);
// Popular Product
$servername = "localhost";
$username = "root";
$password = "1234";
$dbname = "rise_up_shop";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
$sql = "SELECT * FROM dtb_products order by view_count desc limit 4";
$result = mysqli_query($conn, $sql);
$arr = [];
$i = 0;
while ($row = mysqli_fetch_object($result)) {
$arr[$i]['name'] = $row->name;
$arr[$i]['main_list_image'] = $row->main_list_image;
$arr[$i]['product_id'] = $row->product_id;
/* $arr[$i]['description'] = $row->description;*/
$i++;
}
$this->tpl_subtitle = "Popular Products";
$this->arrResults = $arr;
}
示例8: action
/**
* Page のAction.
*
* @return void
*/
function action()
{
$objQuery =& SC_Query_Ex::getSingletonInstance();
$objProduct = new SC_Product_Ex();
$this->arrForm = $_REQUEST;
//時間が無いのでコレで勘弁してください。 tao_s
//modeの取得
$this->mode = $this->getMode();
//表示条件の取得
$this->arrSearchData = array('category_id' => $this->lfGetCategoryId(intval($this->arrForm['category_id'])), 'maker_id' => intval($this->arrForm['maker_id']), 'name' => $this->arrForm['name']);
$this->orderby = $this->arrForm['orderby'];
//ページング設定
$this->tpl_pageno = $this->arrForm['pageno'];
$this->disp_number = $this->lfGetDisplayNum($this->arrForm['disp_number']);
// 画面に表示するサブタイトルの設定
$this->tpl_subtitle = $this->lfGetPageTitle($this->mode, $this->arrSearchData['category_id']);
// 画面に表示する検索条件を設定
$this->arrSearch = $this->lfGetSearchConditionDisp($this->arrSearchData);
// 商品一覧データの取得
$arrSearchCondition = $this->lfGetSearchCondition($this->arrSearchData);
$this->tpl_linemax = $this->lfGetProductAllNum($arrSearchCondition);
$urlParam = "category_id={$this->arrSearchData['category_id']}&pageno=#page#";
$this->objNavi = new SC_PageNavi_Ex($this->tpl_pageno, $this->tpl_linemax, $this->disp_number, 'fnNaviPage', NAVI_PMAX, $urlParam, SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE);
$this->arrProducts = $this->lfGetProductsList($arrSearchCondition, $this->disp_number, $this->objNavi->start_row, $this->tpl_linemax, $objProduct);
switch ($this->getMode()) {
case "json":
$this->arrProducts = $this->setStatusDataTo($this->arrProducts, $this->arrSTATUS, $this->arrSTATUS_IMAGE);
$this->arrProducts = $objProduct->setPriceTaxTo($this->arrProducts);
// 一覧メイン画像の指定が無い商品のための処理
foreach ($this->arrProducts as $key => $val) {
$this->arrProducts[$key]['main_list_image'] = SC_Utils_Ex::sfNoImageMainList($val['main_list_image']);
}
echo SC_Utils_Ex::jsonEncode($this->arrProducts);
exit;
break;
default:
//商品一覧の表示処理
$strnavi = $this->objNavi->strnavi;
// 表示文字列
$this->tpl_strnavi = empty($strnavi) ? " " : $strnavi;
// 規格1クラス名
$this->tpl_class_name1 = $objProduct->className1;
// 規格2クラス名
$this->tpl_class_name2 = $objProduct->className2;
// 規格1
$this->arrClassCat1 = $objProduct->classCats1;
// 規格1が設定されている
$this->tpl_classcat_find1 = $objProduct->classCat1_find;
// 規格2が設定されている
$this->tpl_classcat_find2 = $objProduct->classCat2_find;
$this->tpl_stock_find = $objProduct->stock_find;
$this->tpl_product_class_id = $objProduct->product_class_id;
$this->tpl_product_type = $objProduct->product_type;
// 商品ステータスを取得
$this->productStatus = $this->arrProducts['productStatus'];
unset($this->arrProducts['productStatus']);
$this->tpl_javascript .= 'var productsClassCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories) . ';';
//onloadスクリプトを設定. 在庫ありの商品のみ出力する
foreach ($this->arrProducts as $arrProduct) {
if ($arrProduct['stock_unlimited_max'] || $arrProduct['stock_max'] > 0) {
$js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']});";
}
}
//カート処理
$target_product_id = intval($this->arrForm['product_id']);
if ($target_product_id > 0) {
// 商品IDの正当性チェック
if (!SC_Utils_Ex::sfIsInt($this->arrForm['product_id']) || !SC_Helper_DB_Ex::sfIsRecord("dtb_products", "product_id", $this->arrForm['product_id'], "del_flg = 0 AND status = 1")) {
SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
}
// 入力内容のチェック
$arrErr = $this->lfCheckError($target_product_id, $this->arrForm, $this->tpl_classcat_find1, $this->tpl_classcat_find2);
if (empty($arrErr)) {
$this->lfAddCart($this->arrForm, $_SERVER['HTTP_REFERER']);
SC_Response_Ex::sendRedirect(CART_URLPATH);
exit;
}
$js_fnOnLoad .= $this->lfSetSelectedData($this->arrProducts, $this->arrForm, $arrErr, $target_product_id);
} else {
// カート「戻るボタン」用に保持
$netURL = new Net_URL();
//該当メソッドが無いため、$_SESSIONに直接セット
$_SESSION['cart_referer_url'] = $netURL->getURL();
}
$this->tpl_javascript .= 'function fnOnLoad(){' . $js_fnOnLoad . '}';
$this->tpl_onload .= 'fnOnLoad(); ';
break;
}
$this->tpl_rnd = SC_Utils_Ex::sfGetRandomString(3);
}