本文整理汇总了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;
}