本文整理匯總了PHP中CSaleBasket::TransferBasket方法的典型用法代碼示例。如果您正苦於以下問題:PHP CSaleBasket::TransferBasket方法的具體用法?PHP CSaleBasket::TransferBasket怎麽用?PHP CSaleBasket::TransferBasket使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CSaleBasket
的用法示例。
在下文中一共展示了CSaleBasket::TransferBasket方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: OnUserLogin
function OnUserLogin($new_user_id)
{
$cookie_name = COption::GetOptionString("main", "cookie_name", "BITRIX_SM");
CSaleUser::UpdateSessionSaleUserID();
$ID = $_SESSION["SALE_USER_ID"];
if (COption::GetOptionString("sale", "encode_fuser_id", "N") != "Y") {
$ID = intval($ID);
}
if (intval($ID) <= 0 && isset($_COOKIE[$cookie_name . "_SALE_UID"])) {
$CODE = (string) $_COOKIE[$cookie_name . "_SALE_UID"];
if (COption::GetOptionString("sale", "encode_fuser_id", "N") == "Y" && strval($CODE) != "") {
$arRes = CSaleUser::GetList(array("CODE" => $CODE));
if (!empty($arRes)) {
$ID = $arRes["ID"];
}
} elseif (intval($CODE) > 0) {
$ID = intval($CODE);
}
}
$res = CSaleUser::GetList(array("!ID" => IntVal($ID), "USER_ID" => IntVal($new_user_id)));
if (!empty($res)) {
if ($ID > 0) {
if (CSaleBasket::TransferBasket($ID, $res["ID"])) {
CSaleUser::Delete($ID);
}
}
$ID = IntVal($res["ID"]);
}
CSaleUser::Update($ID);
$_SESSION["SALE_USER_ID"] = $ID;
$_SESSION["SALE_BASKET_NUM_PRODUCTS"] = array();
return true;
}
示例2: OnUserLogin
function OnUserLogin($new_user_id)
{
$cookie_name = COption::GetOptionString("main", "cookie_name", "BITRIX_SM");
CSaleUser::UpdateSessionSaleUserID();
$ID = $_SESSION["SALE_USER_ID"];
if (COption::GetOptionString("sale", "encode_fuser_id", "N") != "Y") {
$ID = IntVal($ID);
}
if (strlen($ID) <= 0 || $ID === 0) {
$ID = $_COOKIE[$cookie_name . "_SALE_UID"];
}
if (COption::GetOptionString("sale", "encode_fuser_id", "N") == "Y" && strlen($ID) > 0) {
$arRes = CSaleUser::GetList(array("CODE" => $ID));
if (!empty($arRes)) {
$ID = $arRes["ID"];
}
}
$res = CSaleUser::GetList(array("!ID" => IntVal($ID), "USER_ID" => IntVal($new_user_id)));
if (!empty($res)) {
if ($ID > 0) {
if (CSaleBasket::TransferBasket($ID, $res["ID"])) {
CSaleUser::Delete($ID);
}
}
$ID = IntVal($res["ID"]);
}
CSaleUser::Update($ID);
$secure = false;
if (COption::GetOptionString("sale", "use_secure_cookies", "N") == "Y" && CMain::IsHTTPS()) {
$secure = true;
}
if (COption::GetOptionString("sale", "encode_fuser_id", "N") == "Y") {
$arRes = CSaleUser::GetList(array("ID" => $ID));
if (!empty($arRes)) {
if (strlen($arRes["CODE"]) <= 0) {
$arRes["CODE"] = md5(time() . randString(10));
CSaleUser::_Update($arRes["ID"], array("CODE" => $arRes["CODE"]));
}
$_SESSION["SALE_USER_ID"] = $arRes["ID"];
$GLOBALS["APPLICATION"]->set_cookie("SALE_UID", $arRes["CODE"], false, "/", false, $secure, "Y", false);
$_COOKIE[$cookie_name . "_SALE_UID"] = $arRes["CODE"];
}
} else {
$_SESSION["SALE_USER_ID"] = $ID;
$GLOBALS["APPLICATION"]->set_cookie("SALE_UID", $ID, false, "/", false, $secure, "Y", false);
$_COOKIE[$cookie_name . "_SALE_UID"] = $ID;
}
$_SESSION["SALE_BASKET_NUM_PRODUCTS"] = array();
return true;
}
示例3: OnUserLogin
function OnUserLogin($new_user_id)
{
$cookie_name = COption::GetOptionString("main", "cookie_name", "BITRIX_SM");
$ID = IntVal($_SESSION["SALE_USER_ID"]);
if ($ID <= 0) {
$ID = IntVal($_COOKIE[$cookie_name . "_SALE_UID"]);
}
$res = CSaleUser::GetList(array("!ID" => IntVal($ID), "USER_ID" => IntVal($new_user_id)));
if (!empty($res)) {
if ($ID > 0) {
if (CSaleBasket::TransferBasket($ID, $res["ID"])) {
CSaleUser::Delete($ID);
}
}
$ID = IntVal($res["ID"]);
}
CSaleUser::Update($ID);
$_SESSION["SALE_USER_ID"] = $ID;
$_SESSION["SALE_BASKET_NUM_PRODUCTS"] = array();
return true;
}