本文整理汇总了PHP中CSaleUser类的典型用法代码示例。如果您正苦于以下问题:PHP CSaleUser类的具体用法?PHP CSaleUser怎么用?PHP CSaleUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSaleUser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getData
/** @return \CDBResult */
public function getData()
{
$lid = $this->getFieldValue('LID', null);
$orderCountFrom = $this->getFieldValue('ORDER_COUNT_FROM', null);
$orderCountTo = $this->getFieldValue('ORDER_COUNT_TO', null);
$orderSumFrom = $this->getFieldValue('ORDER_SUM_FROM', null);
$orderSumTo = $this->getFieldValue('ORDER_SUM_TO', null);
$orderLastDateFrom = $this->getFieldValue('LAST_ORDER_DATE_FROM', null);
$orderLastDateTo = $this->getFieldValue('LAST_ORDER_DATE_TO', null);
$filter = array();
if ($lid) {
$filter['LID'] = $lid;
}
if ($orderCountFrom) {
$filter['>=ORDER_COUNT'] = $orderCountFrom;
}
if ($orderCountTo) {
$filter['<ORDER_COUNT'] = $orderCountTo;
}
if ($orderSumFrom) {
$filter['>=ORDER_SUM'] = $orderSumFrom;
}
if ($orderSumTo) {
$filter['<ORDER_SUM'] = $orderSumTo;
}
if ($orderLastDateFrom) {
$filter['>=LAST_ORDER_DATE'] = $orderLastDateFrom;
}
if ($orderLastDateTo) {
$filter['<LAST_ORDER_DATE'] = $orderLastDateTo;
}
$dbBuyerList = \CSaleUser::GetBuyersList(array('ID' => 'ASC'), $filter, false, false, array("EMAIL", "NAME", "USER_ID"));
return $dbBuyerList;
}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:35,代码来源:senderconnector.php
示例2: getEdit
public static function getEdit(Order $order, $showProfiles = false)
{
$data = self::prepareData($order);
$result = '
<div class="adm-bus-table-container">
<table border="0" cellspacing="0" cellpadding="0" width="100%" class="adm-detail-content-table edit-table">
<tbody>
<tr' . (intval($data["USER_ID"]) > 0 && $data["USER_ID"] != \CSaleUser::GetAnonymousUserID() ? ' style="display: none"' : '') . ' id="sale-order-buyer-find-button-wrap">
<td class="adm-detail-content-cell-l fwb" width="40%">
</td>
<td class="adm-detail-content-cell-r">
<input type="button" name="FIND_BUYER" value="' . Loc::getMessage("SALE_ORDER_BUYER_FIND") . '" onclick="BX.Sale.Admin.OrderBuyer.showChooseBuyerWindow(\'' . LANGUAGE_ID . '\')"><br>
<i>' . Loc::getMessage("SALE_ORDER_BUYER_START_TO_CREATE") . ':</i>
</td>
</tr>
<tr' . (intval($data["USER_ID"]) <= 0 || $data["USER_ID"] == \CSaleUser::GetAnonymousUserID() ? ' style="display: none"' : '') . ' id="sale-order-buyer-name-wrap">
<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage("SALE_ORDER_BUYER") . ':</td>
<td class="adm-detail-content-cell-r">
<div class="adm-s-order-person-choose">
<a id="BUYER_USER_NAME" href="/bitrix/admin/user_edit.php?lang=' . LANGUAGE_ID . '&ID=' . $data["USER_ID"] . '">' . htmlspecialcharsbx($data["BUYER_USER_NAME"]) . '</a>
<a class="adm-s-bus-morelinkqhsw" onclick="BX.Sale.Admin.OrderBuyer.showChooseBuyerWindow(\'' . LANGUAGE_ID . '\')" href="javascript:void(0);">
' . Loc::getMessage("SALE_ORDER_BUYER_CHANGE") . '
</a>
<a class="adm-s-bus-morelinkqhsw" onclick="BX.Sale.Admin.OrderBuyer.clearBuyer();" href="javascript:void(0);">
' . Loc::getMessage("SALE_ORDER_BUYER_CLEAR") . '
</a>
<input type="hidden" name="USER_ID" id="USER_ID" value="' . $data["USER_ID"] . '" onchange="BX.Sale.Admin.OrderBuyer.onBuyerIdChange(this);">
</div>
</td>
</tr>
<tr>
<td class="adm-detail-content-cell-l fwb">' . Loc::getMessage("SALE_ORDER_BUYER_PAYER_TYPE") . ':</td>
<td class="adm-detail-content-cell-r">' . \Bitrix\Sale\Helpers\Admin\OrderEdit::makeSelectHtml("PERSON_TYPE_ID", self::getBuyerTypesList($order->getSiteId()), isset($data["PERSON_TYPE_ID"]) ? $data["PERSON_TYPE_ID"] : "", false, array("class" => "adm-bus-select", "id" => "PERSON_TYPE_ID", "onchange" => "BX.Sale.Admin.OrderBuyer.onBuyerTypeChange(this.value);")) . '</td>
</tr>
<tr id="sale-order-buyer-profiles-list-row"' . ($showProfiles ? '' : ' style="display:none;"') . '>
<td class="adm-detail-content-cell-l">' . Loc::getMessage("SALE_ORDER_BUYER_CHOOSE_PROFILE") . ':</td>
<td class="adm-detail-content-cell-r"><div id="BUYER_PROFILE_ID_CONTAINER">';
if ($showProfiles) {
$result .= \Bitrix\Sale\Helpers\Admin\OrderEdit::makeSelectHtml("BUYER_PROFILE_ID", self::getBuyerProfilesList($data["USER_ID"], $data["PERSON_TYPE_ID"]), isset($data["BUYER_PROFILE_ID"]) ? $data["BUYER_PROFILE_ID"] : "", false, array("class" => "adm-bus-select", "id" => "BUYER_PROFILE_ID", "onchange" => "BX.Sale.Admin.OrderBuyer.onBuyerProfileChange();"));
}
$result .= '</div></td>
</tr>
</tbody>
</table>
</div>' . '<div id="order_properties_container"></div>' . '<div>' . self::getOrderPropertiesByJS($order) . '</div>' . '<div class="adm-bus-table-container caption border sale-order-props-group">' . '<div class="adm-bus-table-caption-title">' . Loc::getMessage("SALE_ORDER_BUYER_COMMENT") . '</div>
<table border="0" cellspacing="0" cellpadding="0" width="100%" class="adm-detail-content-table edit-table ">
<tbody>
<tr>
<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage("SALE_ORDER_BUYER_ORDERCOMMENT") . ':</td>
<td class="adm-detail-content-cell-r">
<textarea style="width:400px;min-height:100px;" name="USER_DESCRIPTION" id="USER_DESCRIPTION">' . $data["USER_DESCRIPTION"] . '</textarea>
</td>
</tr>
</tbody>
</table>
</div>';
return $result;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:59,代码来源:orderbuyer.php
示例3: catchCatalogBasket
public static function catchCatalogBasket($id, $arFields)
{
global $APPLICATION;
// alter b_sale_basket - add recommendation, update it here
if (!static::isOn()) {
return;
}
// get product id by offer id
$productInfo = \CCatalogSKU::GetProductInfo($arFields['PRODUCT_ID']);
if (!empty($productInfo['ID'])) {
$realProductId = $productInfo['ID'];
} else {
$realProductId = $arFields['PRODUCT_ID'];
}
// select site user id & recommendation id
$siteUserId = 0;
$recommendationId = '';
// first, try to find in cookies
$recommendationCookie = $APPLICATION->get_cookie(static::getCookieLogName());
if (!empty($recommendationCookie)) {
$recommendations = static::decodeProductLog($recommendationCookie);
if (is_array($recommendations) && isset($recommendations[$realProductId])) {
$recommendationId = $recommendations[$realProductId][0];
}
}
if (empty($recommendationId)) {
// ok then, lets see in views history
//if(\COption::GetOptionString("sale", "encode_fuser_id", "N") == "Y")
if (!is_numeric($arFields['FUSER_ID'])) {
$filter = array('CODE' => $arFields['FUSER_ID']);
} else {
$filter = array('ID' => $arFields['FUSER_ID']);
}
$result = \CSaleUser::getList($filter);
if (!empty($result)) {
$siteUserId = $result['USER_ID'];
// select recommendation id
$fuser = $result['ID'];
$viewResult = CatalogViewedProductTable::getList(array('select' => array('RECOMMENDATION'), 'filter' => array('=FUSER_ID' => $fuser, '=PRODUCT_ID' => $arFields['PRODUCT_ID']), 'order' => array('DATE_VISIT' => 'DESC')))->fetch();
if (!empty($viewResult['RECOMMENDATION'])) {
$recommendationId = $viewResult['RECOMMENDATION'];
}
}
}
// prepare data
$data = array('product_id' => $realProductId, 'user_id' => $siteUserId, 'bx_user_id' => static::getBxUserId(), 'domain' => Context::getCurrent()->getServer()->getHttpHost(), 'recommendation' => $recommendationId, 'date' => date(DATE_ISO8601));
CounterDataTable::add(array('TYPE' => 'basket', 'DATA' => $data));
// update basket with recommendation id
if (!empty($recommendationId)) {
$conn = Application::getConnection();
$helper = $conn->getSqlHelper();
$conn->query("UPDATE " . $helper->quote('b_sale_basket') . " SET RECOMMENDATION='" . $helper->forSql($recommendationId) . "' WHERE ID=" . (int) $id);
}
}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:54,代码来源:catalog.php
示例4: transferBasket
/**
* Transfers basket from one user to another one
*
* @param integer $from
* @param integer $to
* @global object $DB
* @return boolean
*/
public static function transferBasket($from, $to)
{
global $DB;
$from = intval($from);
$to = intval($to);
CModule::IncludeModule('sale');
if ($to > 0 && CSaleUser::GetList(array("ID" => $to))) {
$deleteQuery = "DELETE FROM b_sale_basket WHERE FUSER_ID = " . $to . " ";
$updateQuery = "UPDATE b_sale_basket SET " . " FUSER_ID = " . $to . " " . "WHERE FUSER_ID = " . $from . " ";
$DB->Query($deleteQuery, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$DB->Query($updateQuery, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
return true;
}
return false;
}
开发者ID:ASDAFF,项目名称:bitrix-snippets,代码行数:23,代码来源:class.SaleHelper.php
示例5: catchCatalogBasket
public static function catchCatalogBasket($id, $arFields)
{
if (!static::isOn()) {
return;
}
// select site user id
$siteUserId = 0;
if (\COption::GetOptionString("sale", "encode_fuser_id", "N") == "Y") {
$filter = array('CODE' => $arFields['FUSER_ID']);
} else {
$filter = array('ID' => $arFields['FUSER_ID']);
}
$result = \CSaleUser::getList($filter);
if (!empty($result)) {
$siteUserId = $result['USER_ID'];
}
// prepare data
$data = array('product_id' => $arFields['PRODUCT_ID'], 'user_id' => $siteUserId, 'bx_user_id' => static::getBxUserId(), 'domain' => Context::getCurrent()->getServer()->getHttpHost(), 'recommendation' => '0', 'date' => date(DATE_ISO8601));
CounterDataTable::add(array('TYPE' => 'basket', 'DATA' => $data));
}
开发者ID:rasuldev,项目名称:torino,代码行数:20,代码来源:catalog.php
示例6: getCode
/**
* Return fuser code.
*
* @return int
*/
protected static function getCode()
{
return \CSaleUser::getFUserCode();
}
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:9,代码来源:fuser.php
示例7: NextPayment
//.........这里部分代码省略.........
for ($di = 0, $intCount = count($arTaxList); $di < $intCount; $di++)
{
$arTaxList[$di]["VALUE_MONEY"] += $arTaxList[$di]["TAX_VAL"];
}
for ($di = 0, $intCount = count($arTaxList); $di < $intCount; $di++)
{
$arTaxSums[$arTaxList[$di]["TAX_ID"]]["VALUE"] = $arTaxList[$di]["VALUE_MONEY"];
$arTaxSums[$arTaxList[$di]["TAX_ID"]]["NAME"] = $arTaxList[$di]["NAME"];
if ($arTaxList[$di]["IS_IN_PRICE"] != "Y")
{
$taxPrice += $arTaxList[$di]["VALUE_MONEY"];
}
}
}
else
{
$arTaxList[0]["VALUE_MONEY"] = (($discountPrice / ($vatRate +1)) * $vatRate) * DoubleVal($arProduct["QUANTITY"]);
$taxVatPrice = $arTaxList[0]["VALUE_MONEY"];
}
}
// Changed by Sigurd, 2007-08-16
$totalOrderPrice = $discountPrice * DoubleVal($arProduct["QUANTITY"]) + $deliveryPrice + $taxPrice;
$arProduct["WITHOUT_ORDER"] = (($arProduct["WITHOUT_ORDER"]=="Y") ? "Y" : "N");
if ($arProduct["WITHOUT_ORDER"] == "N")
{
$DB->StartTransaction();
// Saving
$arSaleUser = CSaleUser::GetList(Array(), Array("USER_ID" => $arOrder["USER_ID"]));
if(!empty($arSaleUser))
{
$currentFUser = $arSaleUser["ID"];
}
else
{
$currentFUser = CSaleUser::_Add(
array(
"=DATE_INSERT" => $DB->GetNowFunction(),
"=DATE_UPDATE" => $DB->GetNowFunction(),
"USER_ID" => $arOrder["USER_ID"]
)
);
}
$arFields = array(
"FUSER_ID" => $currentFUser,
"PRODUCT_ID" => $arProduct["PRODUCT_ID"],
"PRODUCT_NAME" => $arProduct["PRODUCT_NAME"],
"PRODUCT_URL" => $arProduct["PRODUCT_URL"],
"PRODUCT_PRICE_ID" => $arProduct["PRODUCT_PRICE_ID"],
"PRICE" => $arProduct["PRICE"],
"CURRENCY" => $arProduct["CURRENCY"],
"WEIGHT" => $arProduct["WEIGHT"],
"QUANTITY" => $arProduct["QUANTITY"],
"LID" => $arOrder["LID"],
"DELAY" => "N",
"CAN_BUY" => "Y",
"NAME" => $arProduct["NAME"],
"CALLBACK_FUNC" => $arProduct["CALLBACK_FUNC"],
"ORDER_CALLBACK_FUNC" => $arProduct["ORDER_CALLBACK_FUNC"],
"CANCEL_CALLBACK_FUNC" => $arProduct["CANCEL_CALLBACK_FUNC"],
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:67,代码来源:recurring.php
示例8: Add
/**
* The function add viewed product
*
* @param array $arFields - params for add
* @return true false
*/
public static function Add($arFields)
{
global $DB;
global $USER;
global $APPLICATION;
foreach (GetModuleEvents("sale", "OnBeforeViewedAdd", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
return false;
}
}
if (isset($arFields["ID"])) {
unset($arFields["ID"]);
}
$arFields["PRODUCT_ID"] = IntVal($arFields["PRODUCT_ID"]);
$arFields["USER_ID"] = IntVal($arFields["USER_ID"]);
$arFields["FUSER_ID"] = IntVal($arFields["FUSER_ID"]);
$arFields["IBLOCK_ID"] = IntVal($arFields["IBLOCK_ID"]);
if (strlen($arFields["CALLBACK_FUNC"]) <= 0) {
$arFields["CALLBACK_FUNC"] = "CatalogViewedProductCallback";
}
if (strlen($arFields["MODULE"]) <= 0) {
$arFields["MODULE"] = "catalog";
}
if (strlen($arFields["PRODUCT_PROVIDER_CLASS"]) <= 0 && $arFields["MODULE"] == "catalog") {
$arFields["PRODUCT_PROVIDER_CLASS"] = "CCatalogProductProvider";
}
if ($arFields["PRODUCT_ID"] <= 0) {
return false;
}
if (strlen($arFields["LID"]) <= 0) {
return false;
}
if (\Bitrix\Main\Loader::includeModule("catalog")) {
if (\Bitrix\Main\Config\Option::get("sale", "viewed_capability", "") == "Y") {
return \Bitrix\Catalog\CatalogViewedProductTable::refresh($arFields["PRODUCT_ID"], CSaleBasket::GetBasketUserID(), $arFields["LID"]);
}
}
$arFilter = array();
$arFilter["PRODUCT_ID"] = $arFields["PRODUCT_ID"];
if ($arFields["USER_ID"] > 0) {
$arFuserItems = CSaleUser::GetList(array("USER_ID" => $arFields["USER_ID"]));
$FUSER_ID = $arFuserItems["ID"];
} elseif (IntVal($arFields["FUSER_ID"]) > 0) {
$FUSER_ID = $arFields["FUSER_ID"];
} else {
$FUSER_ID = CSaleBasket::GetBasketUserID();
}
$arFilter["FUSER_ID"] = $FUSER_ID;
$arFields["FUSER_ID"] = $FUSER_ID;
$db_res = CSaleViewedProduct::GetList(array(), $arFilter, false, false, array('ID'));
if (!($arItems = $db_res->Fetch())) {
if (CModule::IncludeModule('catalog')) {
/** @var $productProvider IBXSaleProductProvider */
if ($productProvider = CSaleBasket::GetProductProvider($arFields)) {
$arResultTmp = $productProvider::ViewProduct(array("PRODUCT_ID" => $arFields["PRODUCT_ID"], "USER_ID" => $arFields["USER_ID"], "SITE_ID" => $arFields["LID"]));
} else {
$arResultTmp = CSaleBasket::ExecuteCallbackFunction($arFields["CALLBACK_FUNC"], $arFields["MODULE"], $arFields["PRODUCT_ID"], $arFields["USER_ID"], $arFields["LID"]);
}
if ($arResultTmp && count($arResultTmp) > 0) {
$arFields = array_merge($arFields, $arResultTmp);
}
if (strlen($arFields["NAME"]) <= 0) {
return false;
}
$arInsert = $DB->PrepareInsert("b_sale_viewed_product", $arFields);
//chance deleted
$rnd = mt_rand(0, 1000);
if ($rnd < 100) {
$db_res = CSaleViewedProduct::GetList(array(), array("FUSER_ID" => $FUSER_ID), array("COUNT" => "ID"), false);
$arCount = $db_res->Fetch();
$viewedCount = COption::GetOptionString("sale", "viewed_count", "100");
if ($arCount["ID"] > IntVal($viewedCount)) {
$limit = $arCount["ID"] - $viewedCount + $viewedCount * 0.2;
CSaleViewedProduct::DeleteForUser($FUSER_ID, $limit);
}
}
$strSql = "INSERT INTO b_sale_viewed_product (" . $arInsert[0] . ", DATE_VISIT) VALUES(" . $arInsert[1] . ", " . $DB->GetNowFunction() . ")";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$ID = IntVal($DB->LastID());
}
} else {
$ID = IntVal($arItems["ID"]);
$arFields["DATE_VISIT"] = $DB->GetNowFunction();
$arInsert = $DB->PrepareInsert("b_sale_viewed_product", $arFields);
CSaleViewedProduct::Update($ID, $arFields);
}
foreach (GetModuleEvents("sale", "OnViewedAdd", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($arFields));
}
return $ID;
}
开发者ID:rasuldev,项目名称:torino,代码行数:97,代码来源:product.php
示例9: catchCatalogBasket
public static function catchCatalogBasket($id, $arFields)
{
// exclude empty cookie
if (!static::getBxUserId()) {
return;
}
if (!isset($arFields['MODULE']) || $arFields['MODULE'] != 'catalog') {
// catalog items only
return;
}
global $APPLICATION;
// alter b_sale_basket - add recommendation, update it here
if (!static::isOn()) {
return;
}
// get product id by offer id
$productInfo = \CCatalogSKU::GetProductInfo($arFields['PRODUCT_ID']);
$iblockId = 0;
if (!empty($productInfo['ID'])) {
$realProductId = $productInfo['ID'];
$iblockId = $productInfo['IBLOCK_ID'];
} else {
$realProductId = $arFields['PRODUCT_ID'];
// get iblock id
$element = \Bitrix\Iblock\ElementTable::getRow(array('select' => array('IBLOCK_ID'), 'filter' => array('=ID' => $realProductId)));
if (!empty($element)) {
$iblockId = $element['IBLOCK_ID'];
}
}
// select site user id & recommendation id
$siteUserId = 0;
$recommendationId = '';
// first, try to find in cookies
$recommendationCookie = $APPLICATION->get_cookie(static::getCookieLogName());
if (!empty($recommendationCookie)) {
$recommendations = static::decodeProductLog($recommendationCookie);
if (is_array($recommendations) && isset($recommendations[$realProductId])) {
$recommendationId = $recommendations[$realProductId][0];
}
}
if (empty($recommendationId)) {
// ok then, lets see in views history
//if(\COption::GetOptionString("sale", "encode_fuser_id", "N") == "Y")
if (!is_numeric($arFields['FUSER_ID'])) {
$filter = array('CODE' => $arFields['FUSER_ID']);
} else {
$filter = array('ID' => $arFields['FUSER_ID']);
}
$result = \CSaleUser::getList($filter);
if (!empty($result)) {
$siteUserId = $result['USER_ID'];
// select recommendation id
$fuser = $result['ID'];
$viewResult = CatalogViewedProductTable::getList(array('select' => array('RECOMMENDATION'), 'filter' => array('=FUSER_ID' => $fuser, '=PRODUCT_ID' => $arFields['PRODUCT_ID']), 'order' => array('DATE_VISIT' => 'DESC')))->fetch();
if (!empty($viewResult['RECOMMENDATION'])) {
$recommendationId = $viewResult['RECOMMENDATION'];
}
}
}
// prepare data
$data = array('product_id' => $realProductId, 'iblock_id' => $iblockId, 'user_id' => $siteUserId, 'bx_user_id' => static::getBxUserId(), 'domain' => Context::getCurrent()->getServer()->getHttpHost(), 'recommendation' => $recommendationId, 'date' => date(DATE_ISO8601));
// debug info
global $USER;
$data['real_user_id'] = $USER->getId() ?: 0;
$data['is_admin'] = (int) $USER->IsAdmin();
$data['admin_section'] = (int) (defined('ADMIN_SECTION') && ADMIN_SECTION);
$data['admin_panel'] = (int) \CTopPanel::shouldShowPanel();
// try to guess unnatural baskets
$data['artificial_basket'] = (int) ($data['user_id'] > 0 && $data['user_id'] != $data['real_user_id'] || $data['is_admin'] || $data['admin_section'] || $data['admin_panel']);
// save
CounterDataTable::add(array('TYPE' => 'basket', 'DATA' => $data));
// update basket with recommendation id
if (!empty($recommendationId)) {
$conn = Application::getConnection();
$helper = $conn->getSqlHelper();
$conn->query("UPDATE " . $helper->quote('b_sale_basket') . " SET RECOMMENDATION='" . $helper->forSql($recommendationId) . "' WHERE ID=" . (int) $id);
}
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:78,代码来源:catalog.php
示例10: createUserFromForm
/**
* @param Order $order
* @param array $formData
* @param array $files
* @return bool|int|string
* @throws UserMessageException
*/
protected static function createUserFromForm(Order &$order, array $formData)
{
$errors = array();
$orderProps = $order->getPropertyCollection();
if ($email = $orderProps->getUserEmail()) {
$email = $email->getValue();
}
if ($name = $orderProps->getPayerName()) {
$name = $name->getValue();
}
$userId = \CSaleUser::DoAutoRegisterUser($email, $name, $formData["SITE_ID"], $errors);
if (!empty($errors)) {
$errorMessage = "";
foreach ($errors as $val) {
$errorMessage .= $val["TEXT"];
}
throw new UserMessageException($errorMessage);
}
return $userId;
}
开发者ID:webgksupport,项目名称:alpina,代码行数:27,代码来源:orderedit.php
示例11: __MakeOrder
function __MakeOrder($prdCnt=1, $arData = Array())
{
global $APPLICATION, $USER, $DB;
CModule::IncludeModule("iblock");
CModule::IncludeModule("sale");
CModule::IncludeModule("catalog");
$arPrd = Array();
$dbItem = CIBlockElement::GetList(Array("PROPERTY_MORE_PHOTO" => "DESC", "ID" => "ASC"), Array("IBLOCK_TYPE" => "offers", "IBLOCK_SITE_ID" => WIZARD_SITE_ID, "PROPERTY_NEWPRODUCT" => false), false, Array("nTopCount" => 10), Array("ID", "IBLOCK_ID", "XML_ID", "NAME", "DETAIL_PAGE_URL", "IBLOCK_XML_ID"));
while($arItem = $dbItem->GetNext())
$arPrd[] = $arItem;
if(!empty($arPrd))
{
for($i=0; $i<$prdCnt;$i++)
{
$prdID = $arPrd[mt_rand(0, 9)];
$arProduct = CCatalogProduct::GetByID($prdID["ID"]);
$CALLBACK_FUNC = "";
$arCallbackPrice = CSaleBasket::ReReadPrice($CALLBACK_FUNC, "catalog", $prdID["ID"], 1);
$arFields = array(
"PRODUCT_ID" => $prdID["ID"],
"PRODUCT_PRICE_ID" => $arCallbackPrice["PRODUCT_PRICE_ID"],
"PRICE" => $arCallbackPrice["PRICE"],
"CURRENCY" => $arCallbackPrice["CURRENCY"],
"WEIGHT" => $arProduct["WEIGHT"],
"QUANTITY" => 1,
"LID" => WIZARD_SITE_ID,
"DELAY" => "N",
"CAN_BUY" => "Y",
"NAME" => $prdID["NAME"],
"CALLBACK_FUNC" => $CALLBACK_FUNC,
"MODULE" => "catalog",
"PRODUCT_PROVIDER_CLASS" => "CCatalogProductProvider",
"ORDER_CALLBACK_FUNC" => "",
"CANCEL_CALLBACK_FUNC" => "",
"PAY_CALLBACK_FUNC" => "",
"DETAIL_PAGE_URL" => $prdID["DETAIL_PAGE_URL"],
"CATALOG_XML_ID" => $prdID["IBLOCK_XML_ID"],
"PRODUCT_XML_ID" => $prdID["XML_ID"],
"VAT_RATE" => $arCallbackPrice['VAT_RATE'],
);
$addres = CSaleBasket::Add($arFields);
}
$arOrder = Array(
"LID" => $arData["SITE_ID"],
"PERSON_TYPE_ID" => $arData["PERSON_TYPE_ID"],
"PAYED" => "N",
"CANCELED" => "N",
"STATUS_ID" => "N",
"PRICE" => 1,
"CURRENCY" => $arData["CURRENCY"],
"USER_ID" => $arData["USER_ID"],
"PAY_SYSTEM_ID" => $arData["PAY_SYSTEM_ID"],
//"PRICE_DELIVERY" => $arData["PRICE_DELIVERY"],
//"DELIVERY_ID" => $arData["DELIVERY_ID"],
);
$dbFUserListTmp = CSaleUser::GetList(array("USER_ID" => $arData["USER_ID"]));
if(empty($dbFUserListTmp))
{
$arFields = array(
"=DATE_INSERT" => $DB->GetNowFunction(),
"=DATE_UPDATE" => $DB->GetNowFunction(),
"USER_ID" => $arData["USER_ID"]
);
$ID = CSaleUser::_Add($arFields);
}
$orderID = CSaleOrder::Add($arOrder);
CSaleBasket::OrderBasket($orderID, CSaleBasket::GetBasketUserID(), WIZARD_SITE_ID);
$dbBasketItems = CSaleBasket::GetList(
array("NAME" => "ASC"),
array(
"FUSER_ID" => CSaleBasket::GetBasketUserID(),
"LID" => WIZARD_SITE_ID,
"ORDER_ID" => $orderID
),
false,
false,
array("ID", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "PRICE", "WEIGHT", "NAME")
);
$ORDER_PRICE = 0;
while ($arBasketItems = $dbBasketItems->GetNext())
{
$ORDER_PRICE += roundEx($arBasketItems["PRICE"], SALE_VALUE_PRECISION) * DoubleVal($arBasketItems["QUANTITY"]);
}
$totalOrderPrice = $ORDER_PRICE + $arData["PRICE_DELIVERY"];
CSaleOrder::Update($orderID, Array("PRICE" => $totalOrderPrice));
foreach($arData["PROPS"] as $val)
{
$arFields = Array(
"ORDER_ID" => $orderID,
"ORDER_PROPS_ID" => $val["ID"],
"NAME" => $val["NAME"],
"CODE" => $val["CODE"],
"VALUE" => $val["VALUE"],
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:101,代码来源:step1.php
示例12: nodeHandler
//.........这里部分代码省略.........
$arOrder["USER_PROPS"][$arUPropValue["ORDER_PROPS_ID"]] = $arUPropValue["VALUE"];
}
}
else
{
if(strlen($arOrder["AGENT"]["ID"]) > 0)
{
$arAI = explode("#", $arOrder["AGENT"]["ID"]);
if(IntVal($arAI[0]) > 0)
{
$dbUser = CUser::GetByID($arAI[0]);
if($arU = $dbUser->Fetch())
{
if(htmlspecialcharsback(substr(htmlspecialcharsbx($arU["ID"]."#".$arU["LOGIN"]."#".$arU["LAST_NAME"]." ".$arU["NAME"]." ".$arU["SECOND_NAME"]), 0, 80)) == $arOrder["AGENT"]["ID"])
{
$arOrder["USER_ID"] = $arU["ID"];
}
}
}
}
if(IntVal($arOrder["USER_ID"]) <= 0)
{
//create new user
$arUser = array(
"NAME" => $arOrder["AGENT"]["ITEM_NAME"],
"EMAIL" => $arOrder["AGENT"]["CONTACT"]["MAIL_NEW"],
);
if (strlen($arUser["NAME"]) <= 0)
$arUser["NAME"] = $arOrder["AGENT"]["CONTACT"]["CONTACT_PERSON"];
if (strlen($arUser["EMAIL"]) <= 0)
$arUser["EMAIL"] = "buyer".time().GetRandomCode(2)."@".$_SERVER["SERVER_NAME"];
$arOrder["USER_ID"] = CSaleUser::DoAutoRegisterUser($arUser["EMAIL"], $arUser["NAME"], $this->arParams["SITE_NEW_ORDERS"], $arErrors);
}
}
if(empty($this->arPersonTypesIDs))
{
$dbPT = CSalePersonType::GetList(array(), array("ACTIVE" => "Y", "LIDS" => $this->arParams["SITE_NEW_ORDERS"]));
while($arPT = $dbPT->Fetch())
{
$this->arPersonTypesIDs[] = $arPT["ID"];
}
}
if(empty($this->arExportInfo))
{
$dbExport = CSaleExport::GetList(array(), array("PERSON_TYPE_ID" => $this->arPersonTypesIDs));
while($arExport = $dbExport->Fetch())
{
$this->arExportInfo[$arExport["PERSON_TYPE_ID"]] = unserialize($arExport["VARS"]);
}
}
if(IntVal($arOrder["PERSON_TYPE_ID"]) <= 0)
{
foreach($this->arExportInfo as $pt => $value)
{
if(
(($value["IS_FIZ"] == "Y" && $arOrder["AGENT"]["TYPE"] == "FIZ")
|| ($value["IS_FIZ"] == "N" && $arOrder["AGENT"]["TYPE"] != "FIZ"))
)
$arOrder["PERSON_TYPE_ID"] = $pt;
}
}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:67,代码来源:order_loader.php
示例13: realpath
<?php
$_SERVER["DOCUMENT_ROOT"] = realpath(dirname(__FILE__) . "/..");
$DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"];
define("NO_KEEP_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS", true);
define('CHK_EVENT', true);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
@set_time_limit(0);
@ignore_user_abort(true);
CModule::IncludeModule('sale');
$arBasketItemsToUser = array();
$dbBasketItems = CSaleBasket::GetList(array(), array(">DATE_INSERT" => date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT")), mktime() - 60 * 60 * 24 * 30), ">USER_ID" => 0, "DELAY" => "Y"));
//get list of positions inserted in 30 days
while ($arItem = $dbBasketItems->Fetch()) {
$arUser = CSaleUser::GetList(array('ID' => $arItem['FUSER_ID']));
$arItem["USER_ID"] = $arUser["USER_ID"];
$dbBasketItemsCheck = CSaleBasket::GetList(array(), array("PRODUCT_ID" => $arItem["PRODUCT_ID"], "USER_ID" => $arItem["USER_ID"], ">ORDER_ID" => 0));
if (!$dbBasketItemsCheck->Fetch()) {
$arBasketItemsToUser[$arItem["USER_ID"]][] = $arItem;
//filling array with list of positions to user
}
}
$ORDERLIST = '';
$arEventFields = array();
//Parameters for post template
foreach ($arBasketItemsToUser as $USER_ID => $basketItems) {
$rsUser = CUser::GetByID($USER_ID);
if ($arUser = $rsUser->Fetch()) {
foreach ($basketItems as $basketItem) {
$ORDERLIST .= $basketItem["NAME"] . ' - ' . $basketItem["PRICE"] . " " . $basketItem["CURRENCY"] . "<br />";
开发者ID:stspb,项目名称:all,代码行数:31,代码来源:forgotten_cart.php
示例14: GetMessage
}
}
$lAdmin_tab4->AddGroupActionTable(array("order_basket" => GetMessage("BUYER_PD_ORDER"), "delay_y" => GetMessage("BUYER_PD_DELAY_Y"), "delay_n" => GetMessage("BUYER_PD_DELAY_N"), "delete_basket" => GetMessage("BUYER_PD_DELETE")));
if ($_REQUEST["table_id"] == $sTableID_tab4) {
$lAdmin_tab4->CheckListMode();
}
//END BUYERS BASKET
//BUYERS VIEWED PRODUCT
$sTableID_tab5 = "t_stat_list_tab5";
$oSort_tab5 = new CAdminSorting($sTableID_tab5);
$lAdmin_tab5 = new CAdminList($sTableID_tab5, $oSort_tab5);
//FILTER VIEWED
$arFilterFields = array("filter_viewed_date_visit", "filter_date_visit_from", "filter_date_visit_to", "filter_viewed_lid");
$lAdmin_tab5->InitFilter($arFilterFields);
$arFilter = array();
$arFuserItems = CSaleUser::GetList(array("USER_ID" => $ID));
$arFilter["FUSER_ID"] = $arFuserItems["ID"];
if (strlen($filter_viewed_lid) > 0) {
$arFilter["LID"] = trim($filter_viewed_lid);
}
if (strlen(trim($filter_date_visit_from)) > 0) {
$arFilter["DATE_FROM"] = FmtDate($filter_date_visit_from, "D.M.Y");
}
if (strlen(trim($filter_date_visit_to)) > 0) {
if ($arDate = ParseDateTime($filter_date_visit_to, CSite::GetDateFormat("FULL", SITE_ID))) {
if (StrLen($filter_date_visit_to) < 11) {
$arDate["HH"] = 23;
$arDate["MI"] = 59;
$arDate["SS"] = 59;
}
$filter_date_visit_to = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL", SITE_ID)), mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:buyers_profile.php
示例15: DeleteOld
public static function DeleteOld($nDays)
{
global $DB;
$nDays = IntVal($nDays);
$strSql = "SELECT f.ID " . "FROM b_sale_fuser f " . "LEFT JOIN b_sale_order o ON (o.USER_ID = f.USER_ID) " . "WHERE " . "\tTO_DAYS(f.DATE_UPDATE)<(TO_DAYS(NOW())-" . $nDays . ") " . "\tAND o.ID is null " . "\tAND f.USER_ID is null " . "LIMIT 300";
$db_res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
while ($ar_res = $db_res->Fetch()) {
CSaleBasket::DeleteAll($ar_res["ID"], false);
CSaleUser::Delete($ar_res["ID"]);
}
return true;
}
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:12,代码来源:basket.php
示例16: array
$arResult["ERRORS"] = 'NOTIFY_ERR_NULL';
}
if (COption::GetOptionString("main", "captcha_registration", "N") == "Y" || isset($_SESSION["NOTIFY_PRODUCT"]["CAPTHA"]) && $_SESSION["NOTIFY_PRODUCT"]["CAPTHA"] == "Y") {
if (!$APPLICATION->CaptchaCheckCode($_REQUEST["captcha_word"], $_REQUEST["captcha_sid"])) {
$arResult["ERRORS"] = 'NOTIFY_ERR_CAPTHA';
}
}
if (strlen($user_mail) > 0 && strlen($arResult["ERRORS"]) <= 0) {
$res = CUser::GetList($b, $o, array("=EMAIL" => $user_mail));
if ($res->Fetch()) {
$arResult["ERRORS"] = 'NOTIFY_ERR_MAIL_EXIST';
}
}
if (strlen($arResult["ERRORS"]) <= 0) {
if (strlen($user_mail) > 0 && COption::GetOptionString("main", "new_user_registration", "N") == "Y") {
$user_id = CSaleUser::DoAutoRegisterUser($user_mail, array(), SITE_ID, $arErrors);
if ($user_id > 0) {
$USER->Authorize($user_id);
if (count($arErrors) > 0) {
$arResult["ERRORS"] = $arErrors[0]["TEXT"];
}
} else {
$arResult["ERRORS"] = 'NOTIFY_ERR_REG';
}
} else {
$arAuthResult = $USER->Login($user_login, $user_password, "Y");
$rs = $APPLICATION->arAuthResult = $arAuthResult;
if (count($rs) > 0 && $rs["TYPE"] == "ERROR") {
$arResult["ERRORS"] = $rs["MESSAGE"];
}
}
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:ajax.php
示例17: HasProductRows
public static function HasProductRows($productID)
{
if (!CModule::IncludeModule('sale')) {
return false;
}
$result = false;
$saleUserId = intval(CSaleUser::GetAnonymousUserID());
$CSaleBasket = new CSaleBasket();
$dbRes = $CSaleBasket->GetList(array(), array('PRODUCT_ID' => $productID, '>ORDER_ID' => 0, 'USER_ID' => $saleUserId), false, array('nTopCount' => 1), array('ID'));
if (is_object($dbRes)) {
$arRes = $dbRes->Fetch();
if (is_array($arRes) && isset($arRes['ID']) && intval($arRes['ID']) > 0) {
$result = true;
}
}
return $result;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:17,代码来源:crm_invoice.php
|
请发表评论