本文整理汇总了PHP中CSaleBasket::UpdatePrice方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleBasket::UpdatePrice方法的具体用法?PHP CSaleBasket::UpdatePrice怎么用?PHP CSaleBasket::UpdatePrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleBasket
的用法示例。
在下文中一共展示了CSaleBasket::UpdatePrice方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetBasketList
function GetBasketList($bSkipFUserInit = true)
{
$fUserID = (int) CSaleBasket::GetBasketUserID($bSkipFUserInit);
$arRes = array();
if ($fUserID > 0) {
$basketID = array();
$db_res = CSaleBasket::GetList(array(), array("FUSER_ID" => $fUserID, "LID" => SITE_ID, "ORDER_ID" => false), false, false, array('ID', 'CALLBACK_FUNC', 'PRODUCT_PROVIDER_CLASS', 'MODULE', 'PRODUCT_ID', 'QUANTITY', 'NOTES'));
while ($res = $db_res->Fetch()) {
$res['CALLBACK_FUNC'] = (string) $res['CALLBACK_FUNC'];
$res['PRODUCT_PROVIDER_CLASS'] = (string) $res['PRODUCT_PROVIDER_CLASS'];
if ($res['CALLBACK_FUNC'] != '' || $res['PRODUCT_PROVIDER_CLASS'] != '') {
CSaleBasket::UpdatePrice($res["ID"], $res["CALLBACK_FUNC"], $res["MODULE"], $res["PRODUCT_ID"], $res["QUANTITY"], 'N', $res["PRODUCT_PROVIDER_CLASS"], $res['NOTES']);
}
$basketID[] = $res['ID'];
}
unset($res, $db_res);
if (!empty($basketID)) {
$basketIterator = CSaleBasket::GetList(array('NAME' => 'ASC'), array('ID' => $basketID));
while ($basket = $basketIterator->GetNext()) {
$arRes[] = $basket;
}
unset($basket, $basketIterator);
}
unset($basketID);
}
return $arRes;
}
示例2: getUserDelay
function getUserDelay ($userId){
// Получаем список корзины
$arBasketItems = array();
$dbBasketItems = CSaleBasket::GetList(
array(
"NAME" => "ASC",
"ID" => "ASC"
),
array(
"FUSER_ID" =>$userId,
"LID" => SITE_ID,
"ORDER_ID" => "NULL"
),
false,
false,
array("ID", "CALLBACK_FUNC", "MODULE", "NAME",
"PRODUCT_ID", "QUANTITY", "DELAY",
"CAN_BUY", "PRICE", "DATE_INSERT", "DATE_UPDATE")
);
while ($arItems = $dbBasketItems->Fetch())
{
if (strlen($arItems["CALLBACK_FUNC"]) > 0)
{
CSaleBasket::UpdatePrice($arItems["ID"],
$arItems["CALLBACK_FUNC"],
$arItems["MODULE"],
$arItems["PRODUCT_ID"],
$arItems["QUANTITY"]);
$arItems = CSaleBasket::GetByID($arItems["ID"]);
}
$arBasketItems[] = $arItems;
}
// Печатаем массив, содержащий актуальную на текущий момент корзину
/* echo "<pre>";
print_r($arBasketItems);
echo "</pre>"; */
$whishlist="";
foreach ($arBasketItems as $delay){
$notBuy="Y"; // флаг для проверки покупался ли данный товар,
$difference = floor(intval(abs( time() - strtotime($delay[DATE_INSERT]) ))/(3600 * 24));
// перебираем отложенные элементы, срок которых менее 30 дней
if ($delay["DELAY"]=="Y" && $difference < 30){
foreach ($arBasketItems as $notDelay){
//перебираем купленные элементы и сравниваем с отложенными
if ($notDelay["DELAY"]!="Y" && $delay[PRODUCT_ID]==$notDelay[PRODUCT_ID] && $difference < 30){
$notBuy="N"; // товар уже покупался
}
}
if($notBuy=="Y"){
$whishlist .= ' '.$delay["NAME"].',';
}
}
}
$whishlist = trim($whishlist, ",");
return $whishlist;
}
示例3: GetBasketList
function GetBasketList($bSkipFUserInit = False)
{
$fUserID = CSaleBasket::GetBasketUserID($bSkipFUserInit);
$arRes = array();
if ($fUserID > 0) {
$db_res = CSaleBasket::GetList(array("NAME" => "ASC"), array("FUSER_ID" => $fUserID, "LID" => SITE_ID, "ORDER_ID" => "NULL"));
while ($res = $db_res->GetNext()) {
if (strlen($res["CALLBACK_FUNC"]) > 0 || strlen($res["PRODUCT_PROVIDER_CLASS"]) > 0) {
CSaleBasket::UpdatePrice($res["ID"], $res["CALLBACK_FUNC"], $res["MODULE"], $res["PRODUCT_ID"], $res["QUANTITY"], $res["PRODUCT_PROVIDER_CLASS"]);
$res = CSaleBasket::GetByID($res["ID"]);
}
$arRes[] = $res;
}
}
return $arRes;
}
示例4: json_decode
'header' => 'Content-Type: application/json'.PHP_EOL,
'content' => '{"api_auth_token": "'.$secret.'"}'
)
));
$api_answer = json_decode(file_get_contents($token_url, FALSE, $context));
if (!$api_answer) { throw new Exception(GetMessage("EXCEPTION_NO_API_ANSWER", array("#URL#" => $token_url))); }
if (!($arResult['WIDGET_TOKEN'] = $api_answer->token)) { throw new Exception(GetMessage("EXCEPTION_NO_WIDGET_TOKEN")); }
if (!($arResult['GP_DELIVERY_DESCRIPTION'] = $api_answer->description)) { throw new Exception(GetMessage("EXCEPTION_NO_DELIVERY_DESCRIPTION")); }
$arBasketItems = array();
$dbBasketItems = CSaleBasket::GetList(
array("NAME" => "ASC", "ID" => "ASC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => "NULL")
);
while ($arItems = $dbBasketItems->Fetch()) {
if (strlen($arItems["CALLBACK_FUNC"]) > 0) {
CSaleBasket::UpdatePrice($arItems["ID"], $arItems["CALLBACK_FUNC"], $arItems["MODULE"], $arItems["PRODUCT_ID"], $arItems["QUANTITY"]);
$arItems = CSaleBasket::GetByID($arItems["ID"]);
}
$arBasketItems[] = $arItems;
}
$arResult['WIDGET_ITEMS'] = array();
$ESTIMATED_PRICE_TYPE_ID = 4;
foreach($arBasketItems as $index=>$item) {
$widgetItem = array();
$widgetItem['price'] = $item['PRICE'];
$widgetItem['shop_good_code'] = $item['PRODUCT_ID'];
$widgetItem['count'] = $item['QUANTITY'];
$widgetItem['weight'] = $item['WEIGHT'];
$widgetItem['name'] = $item['NAME'];
$rsPrices = CPrice::GetList(array(), array('PRODUCT_ID' => $item['PRODUCT_ID'], 'CATALOG_GROUP_ID' => $ESTIMATED_PRICE_TYPE_ID));
示例5: Add2BasketByProductID
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
?>
<?php
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
// Если к нам идёт Ajax запрос, то ловим его
if (isset($_POST["ajax_filter"]) && $_POST["ajax_filter"] == "y") {
if (CModule::IncludeModule("sale") && CModule::IncludeModule("catalog")) {
Add2BasketByProductID($_POST["productId"], 1, array());
$arBasketItems = array();
$productsCount = 0;
$dbBasketItems = CSaleBasket::GetList(array("NAME" => "ASC", "ID" => "ASC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => "NULL"), false, false, array("ID", "QUANTITY", "PRICE"));
while ($arItems = $dbBasketItems->Fetch()) {
if (strlen($arItems["CALLBACK_FUNC"]) > 0) {
CSaleBasket::UpdatePrice($arItems["ID"], $arItems["QUANTITY"]);
$arItems = CSaleBasket::GetByID($arItems["ID"]);
}
$arBasketItems[] = $arItems;
}
$productsCount = count($arBasketItems);
$summ = 0;
for ($i = 0; $i <= $productsCount; $i++) {
$summ = $summ + $arBasketItems[$i]["PRICE"] * $arBasketItems[$i]["QUANTITY"];
}
// Склонение "товаров"
$goods_title = declOfNum($productsCount, array('товар', 'товара', 'товаров'));
?>
<span class="hc-icon"><i class="icon-cart"></i></span><span class="hidden-xs">В корзине</span> <b><?php
echo $productsCount;
?>
示例6: array
"LID" => SITE_ID,
"ORDER_ID" > 0,
"ORDER_CANCELED"=>"N"
),
false,
false,
array()
);
while ($arItems = $dbBasketItems->Fetch())
{
if ('' != $arItems['PRODUCT_PROVIDER_CLASS'] || '' != $arItems["CALLBACK_FUNC"])
{
CSaleBasket::UpdatePrice($arItems["ID"],
$arItems["NAME"],
$arItems["CALLBACK_FUNC"],
$arItems["MODULE"],
$arItems["PRODUCT_ID"],
"N"
);
$arID[] = $arItems["ID"];
}
}
if (!empty($arID))
{
$dbBasketItems = CSaleBasket::GetList(
array(
"NAME" => "ASC",
"ID" => "ASC"
),
array(
"ID" => $arID,
示例7: UpdateBasketPrices
function UpdateBasketPrices($fuserID, $siteID)
{
if (IntVal($fuserID) <= 0) {
return false;
}
if (strlen($siteID) <= 0) {
$siteID = SITE_ID;
}
$dbBasketItems = CSaleBasket::GetList(array("ALL_PRICE" => "DESC"), array("FUSER_ID" => $fuserID, "LID" => $siteID, "ORDER_ID" => "NULL", "SUBSCRIBE" => "N"), false, false, array("ID", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "PRODUCT_PROVIDER_CLASS"));
while ($arItems = $dbBasketItems->Fetch()) {
if (strlen($arItems["CALLBACK_FUNC"]) > 0 || strlen($arItems["PRODUCT_PROVIDER_CLASS"]) > 0) {
CSaleBasket::UpdatePrice($arItems["ID"], $arItems["CALLBACK_FUNC"], $arItems["MODULE"], $arItems["PRODUCT_ID"], $arItems["QUANTITY"], "N", $arItems["PRODUCT_PROVIDER_CLASS"]);
}
}
}