• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CSaleBasketHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CSaleBasketHelper的典型用法代码示例。如果您正苦于以下问题:PHP CSaleBasketHelper类的具体用法?PHP CSaleBasketHelper怎么用?PHP CSaleBasketHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CSaleBasketHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: checkQuantity

 public static function checkQuantity($arProducts)
 {
     $result = true;
     $sumQuantityOnStores = array();
     foreach ($arProducts as $id => $arProduct) {
         if (CSaleBasketHelper::isSetParent($arProduct)) {
             continue;
         }
         if (!empty($arProduct["STORES"]) && is_array($arProduct["STORES"])) {
             $sumQuantityOnStores[$id] = 0;
             foreach ($arProduct["STORES"] as $arStore) {
                 $sumQuantityOnStores[$id] += $arStore["QUANTITY"];
             }
             if ($sumQuantityOnStores[$id] != $arProduct["QUANTITY"]) {
                 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("NEWO_ERR_STORE_QUANTITY_NOT_EQUAL_TOTAL_QUANTITY", array("#PRODUCT_NAME#" => $arProduct["NAME"])) . "<br>");
                 $result = false;
                 break;
             }
         } else {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("NEWO_ERR_STORE_WRONG_INFO", array("#PRODUCT_NAME#" => $arProduct["NAME"])) . "<br>");
             $result = false;
             break;
         }
     }
     return $result;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:26,代码来源:order_helper.php


示例2: OnBasketChange

	public static function OnBasketChange($ID, $arFields = false)
	{
		if(isset($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]))
		{
			$num_products = $_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID];
		}
		else
		{
			if(!CModule::IncludeModule("sale"))
			{
				return;
			}
			$fUserID = CSaleBasket::GetBasketUserID(True);
			$fUserID = IntVal($fUserID);
			$num_products = 0;
			if ($fUserID > 0)
			{
				$dbRes = CSaleBasket::GetList(
					array(),
					array(
						"FUSER_ID" => $fUserID,
						"LID" => SITE_ID,
						"ORDER_ID" => "NULL",
						"CAN_BUY" => "Y",
						"DELAY" => "N",
						"SUBSCRIBE" => "N"
					)
				);
				while ($arItem = $dbRes->GetNext())
				{
					if (!CSaleBasketHelper::isSetItem($arItem))
						$num_products++;
				}
			}
			$_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID] = intval($num_products);
		}

		echo "<script>
			if (document.getElementById('bx_cart_num'))
				document.getElementById('bx_cart_num').innerHTML = '".(($num_products > 0) ? " (".$num_products.")" : "")."';
			</script>";
	}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:42,代码来源:include.php


示例3: obtainDataOrders

 /**
  * Perform reading main data from database, no cache is used
  * @return void
  */
 protected function obtainDataOrders()
 {
     $select = array('ID', 'LID', 'PERSON_TYPE_ID', 'PAYED', 'DATE_PAYED', 'EMP_PAYED_ID', 'CANCELED', 'DATE_CANCELED', 'EMP_CANCELED_ID', 'REASON_CANCELED', 'MARKED', 'DATE_MARKED', 'EMP_MARKED_ID', 'REASON_MARKED', 'STATUS_ID', 'DATE_STATUS', 'PAY_VOUCHER_NUM', 'PAY_VOUCHER_DATE', 'EMP_STATUS_ID', 'PRICE_DELIVERY', 'ALLOW_DELIVERY', 'DATE_ALLOW_DELIVERY', 'EMP_ALLOW_DELIVERY_ID', 'DEDUCTED', 'DATE_DEDUCTED', 'EMP_DEDUCTED_ID', 'REASON_UNDO_DEDUCTED', 'RESERVED', 'PRICE', 'CURRENCY', 'DISCOUNT_VALUE', 'SUM_PAID', 'USER_ID', 'PAY_SYSTEM_ID', 'DELIVERY_ID', 'DATE_INSERT', 'DATE_UPDATE', 'USER_DESCRIPTION', 'ADDITIONAL_INFO', 'COMMENTS', 'TAX_VALUE', 'STAT_GID', 'RECURRING_ID', 'RECOUNT_FLAG', 'DELIVERY_DOC_NUM', 'DELIVERY_DOC_DATE', 'STORE_ID', 'ORDER_TOPIC', 'RESPONSIBLE_ID', 'DATE_PAY_BEFORE', 'DATE_BILL', 'ACCOUNT_NUMBER', 'TRACKING_NUMBER', 'XML_ID');
     $usePageNavigation = true;
     $navyParams = array();
     $navyParams = \CDBResult::GetNavParams();
     if ($navyParams['SHOW_ALL']) {
         $usePageNavigation = false;
     } else {
         $navyParams['PAGEN'] = (int) $navyParams['PAGEN'];
         $navyParams['SIZEN'] = (int) $navyParams['SIZEN'];
     }
     if (isset($this->arParams["ORDERS_PER_PAGE"]) && intval($this->arParams["ORDERS_PER_PAGE"]) > 0) {
         $navyParams['SIZEN'] = $this->arParams["ORDERS_PER_PAGE"];
     }
     if (isset($_REQUEST['show_all']) && $_REQUEST['show_all'] == "Y") {
         $usePageNavigation = false;
     }
     $getListParams = array('order' => array($this->sortBy => $this->sortOrder), 'filter' => $this->filter, 'select' => $select);
     if ($usePageNavigation) {
         $getListParams['limit'] = $navyParams['SIZEN'];
         $getListParams['offset'] = $navyParams['SIZEN'] * ($navyParams['PAGEN'] - 1);
     }
     $totalPages = 0;
     if ($usePageNavigation) {
         $countQuery = new \Bitrix\Main\Entity\Query(\Bitrix\Sale\Internals\OrderTable::getEntity());
         $countQuery->addSelect(new \Bitrix\Main\Entity\ExpressionField('CNT', 'COUNT(1)'));
         $countQuery->setFilter($getListParams['filter']);
         $totalCount = $countQuery->setLimit(null)->setOffset(null)->exec()->fetch();
         unset($countQuery);
         $totalCount = (int) $totalCount['CNT'];
         if ($totalCount > 0) {
             $totalPages = ceil($totalCount / $navyParams['SIZEN']);
             if ($navyParams['PAGEN'] > $totalPages) {
                 $navyParams['PAGEN'] = $totalPages;
             }
             $getListParams['limit'] = $navyParams['SIZEN'];
             $getListParams['offset'] = $navyParams['SIZEN'] * ($navyParams['PAGEN'] - 1);
         } else {
             $navyParams['PAGEN'] = 1;
             $getListParams['limit'] = $navyParams['SIZEN'];
             $getListParams['offset'] = 0;
         }
     }
     $this->dbQueryResult['ORDERS'] = new \CDBResult(\Bitrix\Sale\Internals\OrderTable::getList($getListParams));
     if ($usePageNavigation) {
         $this->dbQueryResult['ORDERS']->NavStart($getListParams['limit'], $navyParams['SHOW_ALL'], $navyParams['PAGEN']);
         $this->dbQueryResult['ORDERS']->NavRecordCount = $totalCount;
         $this->dbQueryResult['ORDERS']->NavPageCount = $totalPages;
         $this->dbQueryResult['ORDERS']->NavPageNomer = $navyParams['PAGEN'];
     } else {
         $this->dbQueryResult['ORDERS']->NavStart($this->arParams["ORDERS_PER_PAGE"], false);
     }
     if (empty($this->dbQueryResult['ORDERS'])) {
         return;
     }
     while ($arOrder = $this->dbQueryResult['ORDERS']->GetNext()) {
         $arOBasket = array();
         $dbBasket = CSaleBasket::GetList(array('NAME' => 'asc'), array("ORDER_ID" => $arOrder["ID"]), false, false, array('*'));
         while ($arBasket = $dbBasket->Fetch()) {
             if (CSaleBasketHelper::isSetItem($arBasket)) {
                 continue;
             }
             $arOBasket[$arBasket['ID']] = $arBasket;
         }
         $arOShipment = array();
         $dbShipment = \Bitrix\Sale\Internals\ShipmentTable::getList(array('select' => array('DELIVERY_NAME', 'SYSTEM', 'DELIVERY_ID'), 'filter' => array('ORDER_ID' => $arOrder['ID'])));
         while ($arShipment = $dbShipment->fetch()) {
             if ($arShipment['SYSTEM'] == 'Y') {
                 continue;
             }
             $arOShipment[] = $arShipment;
         }
         $dbPayment = \Bitrix\Sale\Internals\PaymentTable::getList(array('select' => array('PAY_SYSTEM_NAME', 'PAY_SYSTEM_ID'), 'filter' => array('ORDER_ID' => $arOrder['ID'])));
         $arOPayment = array();
         while ($arPayment = $dbPayment->fetch()) {
             $arOPayment[] = $arPayment;
         }
         $this->dbResult['ORDERS'][] = array("ORDER" => $arOrder, "BASKET_ITEMS" => $arOBasket, "SHIPMENT" => $arOShipment, "PAYMENT" => $arOPayment);
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:85,代码来源:class.php


示例4: recalculateBasket

 public function recalculateBasket($arPost)
 {
     global $USER;
     $arRes = array();
     if ($this->hideCoupon != "Y") {
         if (!empty($arPost['delete_coupon'])) {
             $arRes['VALID_COUPON'] = DiscountCouponsManager::delete($arPost['delete_coupon']);
         } else {
             $oldUse = false;
             if (array_key_exists('coupon', $arPost)) {
                 $arPost['coupon'] = trim((string) $arPost['coupon']);
                 if ($arPost['coupon'] != '') {
                     $arRes['VALID_COUPON'] = DiscountCouponsManager::add($arPost['coupon']);
                 } else {
                     $oldUse = true;
                 }
             }
             if ($oldUse) {
                 if (!isset($arRes["VALID_COUPON"]) || $arRes["VALID_COUPON"] === false) {
                     DiscountCouponsManager::clear(true);
                 }
             }
         }
     }
     $arTmpItems = array();
     $dbItems = CSaleBasket::GetList(array("PRICE" => "DESC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => "NULL"), false, false, array("ID", "NAME", "PRODUCT_PROVIDER_CLASS", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "CURRENCY", "SUBSCRIBE", "TYPE", "SET_PARENT_ID", "NOTES"));
     while ($arItem = $dbItems->Fetch()) {
         if (CSaleBasketHelper::isSetItem($arItem)) {
             continue;
         }
         $arTmpItems[] = $arItem;
     }
     if (!empty($arTmpItems)) {
         if (self::$catalogIncluded === null) {
             self::$catalogIncluded = Loader::includeModule('catalog');
         }
         if (self::$catalogIncluded) {
             $arTmpItems = getRatio($arTmpItems);
         }
         foreach ($arTmpItems as $arItem) {
             $isFloatQuantity = isset($arItem["MEASURE_RATIO"]) && floatval($arItem["MEASURE_RATIO"]) > 0 && $arItem["MEASURE_RATIO"] != 1 || $this->quantityFloat == "Y" ? true : false;
             if (!isset($arPost["QUANTITY_" . $arItem["ID"]]) || floatval($arPost["QUANTITY_" . $arItem["ID"]]) <= 0) {
                 $quantityTmp = $isFloatQuantity === true ? floatval($arItem["QUANTITY"]) : intval($arItem["QUANTITY"]);
             } else {
                 $quantityTmp = $isFloatQuantity === true ? floatval($arPost["QUANTITY_" . $arItem["ID"]]) : intval($arPost["QUANTITY_" . $arItem["ID"]]);
             }
             $deleteTmp = $arPost["DELETE_" . $arItem["ID"]] == "Y" ? "Y" : "N";
             $delayTmp = $arPost["DELAY_" . $arItem["ID"]] == "Y" ? "Y" : "N";
             if ($arItem["CAN_BUY"] == "Y") {
                 $res = $this->checkQuantity($arItem, $quantityTmp);
                 if (!empty($res)) {
                     $arRes["WARNING_MESSAGE"][] = $res["ERROR"];
                 }
             }
             if ($deleteTmp == "Y" && in_array("DELETE", $this->columns)) {
                 if ($arItem["SUBSCRIBE"] == "Y" && is_array($_SESSION["NOTIFY_PRODUCT"][$USER->GetID()])) {
                     unset($_SESSION["NOTIFY_PRODUCT"][$USER->GetID()][$arItem["PRODUCT_ID"]]);
                 }
                 CSaleBasket::Delete($arItem["ID"]);
             } elseif ($arItem["DELAY"] == "N" && $arItem["CAN_BUY"] == "Y") {
                 $arFields = array();
                 if (in_array("QUANTITY", $this->columns)) {
                     $arFields["QUANTITY"] = $quantityTmp;
                 }
                 if (in_array("DELAY", $this->columns)) {
                     $arFields["DELAY"] = $delayTmp;
                 }
                 if (!empty($arFields) && ($arItem["QUANTITY"] != $arFields["QUANTITY"] && in_array("QUANTITY", $this->columns) || $arItem["DELAY"] != $arFields["DELAY"] && in_array("DELAY", $this->columns))) {
                     CSaleBasket::Update($arItem["ID"], $arFields);
                 }
             } elseif ($arItem["DELAY"] == "Y" && $arItem["CAN_BUY"] == "Y") {
                 $arFields = array();
                 if (in_array("DELAY", $this->columns)) {
                     $arFields["DELAY"] = $delayTmp;
                 }
                 if (!empty($arFields) && ($arItem["DELAY"] != $arFields["DELAY"] && in_array("DELAY", $this->columns))) {
                     CSaleBasket::Update($arItem["ID"], $arFields);
                 }
             }
         }
     }
     return $arRes;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:83,代码来源:class.php


示例5: foreach

        $arBasketItems[] = $arItem;
        if (CSaleBasketHelper::isSetItem($arItem)) {
            $arSetParentWeight[$arItem["SET_PARENT_ID"]] += $arItem["WEIGHT"] * $arItem['QUANTITY'];
        }
    }
}
if (!empty($arBasketItems)) {
    // count weight for set parent products
    foreach ($arBasketItems as &$arItem) {
        if (CSaleBasketHelper::isSetParent($arItem)) {
            $arItem["WEIGHT"] = $arSetParentWeight[$arItem["ID"]] / $arItem["QUANTITY"];
        }
    }
    unset($arItem);
    foreach ($arBasketItems as &$arItem) {
        if (CSaleBasketHelper::isSetItem($arItem)) {
            continue;
        }
        $boolOneReady = false;
        if ($arItem["DELAY"] == "N" && $arItem["CAN_BUY"] == "Y") {
            $boolOneReady = true;
            $bReady = true;
            $allSum += $arItem["PRICE"] * $arItem["QUANTITY"];
            $allWeight += $arItem["WEIGHT"] * $arItem["QUANTITY"];
        } elseif ($arItem["DELAY"] == "Y" && $arItem["CAN_BUY"] == "Y") {
            if ('N' == $arParams['SHOW_DELAY']) {
                continue;
            }
            $bDelay = true;
        } elseif ($arItem["CAN_BUY"] == "N" && $arItem["SUBSCRIBE"] == "N") {
            if ('N' == $arParams['SHOW_NOTAVAIL']) {
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:component.php


示例6: parseBasketItems

 /**
  * @param Sale\Basket $basket
  * @param array $requestBasketItems
  *
  * @return Sale\Result
  * @throws Main\ArgumentNullException
  * @throws Main\ArgumentTypeException
  * @throws Main\ObjectException
  * @throws Main\ObjectNotFoundException
  */
 protected function parseBasketItems(Sale\Basket $basket, array $requestBasketItems)
 {
     $result = new Sale\Result();
     $basketCodeList = array();
     $basketItemList = array();
     $basketParentList = array();
     $basketChildList = array();
     $basketChanged = false;
     $publicMode = DiscountCompatibility::usedByClient();
     foreach ($requestBasketItems as $basketIndex => $basketItemData) {
         if (isset($basketItemData['SET_PARENT_ID']) && strval($basketItemData['SET_PARENT_ID']) != '') {
             $parentId = intval($basketItemData['SET_PARENT_ID']);
             if ($basketItemData['TYPE'] != Sale\Basket::TYPE_SET && !array_key_exists($parentId, $basketParentList)) {
                 $basketChildList[intval($basketItemData['SET_PARENT_ID'])] = $basketItemData['SET_PARENT_ID'];
             }
         }
     }
     $orderCompatibility = $this->getOrderCompatibility();
     /** @var Sale\Order $order */
     $order = $orderCompatibility->getOrder();
     $basketItemsIndexList = array();
     foreach ($basket as $basketItem) {
         $basketItemsIndexList[$basketItem->getId()] = true;
     }
     foreach ($requestBasketItems as $basketIndex => $basketItemData) {
         $basketItem = null;
         if (isset($basketItemData['ID']) && intval($basketItemData['ID']) > 0) {
             /** @var Sale\BasketItem $basketItem */
             if ($basketItem = $basket->getItemById($basketItemData['ID'])) {
                 if (isset($basketItemsIndexList[$basketItem->getId()])) {
                     unset($basketItemsIndexList[$basketItem->getId()]);
                 }
             }
         }
         if (!$basketItem) {
             /** @var Sale\BasketItem $basketItem */
             $basketItem = Sale\BasketItem::create($basket, $basketItemData['MODULE'], $basketItemData['PRODUCT_ID']);
             $basketChanged = true;
         }
         $itemDuplicate = isset($basketItemData['DUPLICATE']) && $basketItemData['DUPLICATE'] == "Y";
         $basketFields = static::clearFields($basketItemData);
         //			$basketFields['BASKET_CODE'] = $basketItem->getBasketCode();
         if ($order->getId() > 0) {
             /** @var Sale\ShipmentCollection $shipmentCollection */
             if ($shipmentCollection = $order->getShipmentCollection()) {
                 if (count($shipmentCollection) == 2 && (isset($basketItemData['QUANTITY']) && floatval($basketItemData['QUANTITY']) <= $basketItem->getQuantity())) {
                     /** @var Sale\Shipment $shipment */
                     foreach ($shipmentCollection as $shipment) {
                         if ($shipment->isSystem()) {
                             continue;
                         }
                         $basketQuantity = $shipment->getBasketItemQuantity($basketItem);
                         if ($basketQuantity <= floatval($basketItemData['QUANTITY'])) {
                             continue;
                         }
                         /** @var Sale\ShipmentItemCollection $shipmentItemCollection */
                         if ($shipmentItemCollection = $shipment->getShipmentItemCollection()) {
                             /** @var Sale\ShipmentItem $shipmentItem */
                             if (!($shipmentItem = $shipmentItemCollection->getItemByBasketCode($basketItem->getBasketCode()))) {
                                 continue;
                             }
                             $shipmentItem->setQuantity(floatval($basketItemData['QUANTITY']));
                         }
                     }
                 }
             }
         }
         $isBasketItemCanBeAdded = true;
         if ($publicMode) {
             if (\CSaleBasketHelper::isSetParent($basketItemData)) {
                 $parentId = (int) $basketItemData['ID'];
                 $parentCode = $basketItemData['ID'];
             } else {
                 $parentId = (int) $basketItemData['SET_PARENT_ID'];
                 $parentCode = $basketItemData['SET_PARENT_ID'];
             }
         } else {
             $parentId = (int) $basketItemData['SET_PARENT_ID'];
             $parentCode = $basketItemData['SET_PARENT_ID'];
         }
         if ($parentId > 0) {
             if ($basketItem->isBundleParent()) {
                 $basketParentList[$parentCode] = $basketItem->getBasketCode();
             } else {
                 $isBasketItemCanBeAdded = false;
                 $basketItemList[$parentCode][$basketIndex] = $basketItem;
             }
         }
         if ($isBasketItemCanBeAdded) {
             $propList = array();
//.........这里部分代码省略.........
开发者ID:webgksupport,项目名称:alpina,代码行数:101,代码来源:basketcompatibility.php


示例7: array

		if ($id > 0)
		{
			$dbBasketItems = CSaleBasket::GetList(
				array("ID" => "ASC"),
				array(
					"FUSER_ID" => CSaleBasket::GetBasketUserID(),
					"LID" => SITE_ID,
					"ORDER_ID" => "NULL",
					"ID" => $id,
				),
				false,
				false,
				array("ID", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "CURRENCY")
			);
			$arItem = $dbBasketItems->Fetch();
			if ($arItem && !CSaleBasketHelper::isSetItem($arItem))
			{
				if ($_REQUEST[$arParams["ACTION_VARIABLE"]] == "delete" && in_array("DELETE", $arParams["COLUMNS_LIST"]))
				{
					CSaleBasket::Delete($arItem["ID"]);
				}
				elseif ($_REQUEST[$arParams["ACTION_VARIABLE"]] == "delay" && in_array("DELAY", $arParams["COLUMNS_LIST"]))
				{
					if ($arItem["DELAY"] == "N" && $arItem["CAN_BUY"] == "Y")
						CSaleBasket::Update($arItem["ID"], array("DELAY" => "Y"));
				}
				elseif ($_REQUEST[$arParams["ACTION_VARIABLE"]] == "add" && in_array("DELAY", $arParams["COLUMNS_LIST"]))
				{
					if ($arItem["DELAY"] == "Y" && $arItem["CAN_BUY"] == "Y")
						CSaleBasket::Update($arItem["ID"], array("DELAY" => "N"));
				}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:31,代码来源:component.php


示例8: array

    $arParams["NOTIFY_ACTION"] = "action";
}
$arParams["NOTIFY_USE_CAPTHA"] = $arParams["NOTIFY_USE_CAPTHA"] == "Y" ? "Y" : "N";
$arResult = array("STATUS" => "N", "NOTIFY_URL" => "", "ERRORS" => "");
$notifyOption = COption::GetOptionString("sale", "subscribe_prod", "");
$arNotify = array();
if (strlen($notifyOption) > 0) {
    $arNotify = unserialize($notifyOption);
}
if (CModule::IncludeModule('sale') && CModule::IncludeModule('catalog') && $arParams["NOTIFY_ID"] > 0 && !empty($arNotify) && $arNotify[SITE_ID]['use'] == 'Y') {
    if ($USER->IsAuthorized() && !isset($_SESSION["NOTIFY_PRODUCT"][$USER->GetID()])) {
        $_SESSION["NOTIFY_PRODUCT"][$USER->GetID()] = array();
        if ($USER->IsAuthorized()) {
            $dbNotifyList = CSaleBasket::GetList(array(), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "ORDER_ID" => "NULL", "SUBSCRIBE" => "Y", "CAN_BUY" => "N"), false, false, array('PRODUCT_ID', 'TYPE', 'SET_PARENT_ID'));
            while ($arNotifyList = $dbNotifyList->Fetch()) {
                if (CSaleBasketHelper::isSetItem($arNotifyList)) {
                    continue;
                }
                $_SESSION["NOTIFY_PRODUCT"][$USER->GetID()][] = $arNotifyList["PRODUCT_ID"];
            }
        }
    }
    if ($USER->IsAuthorized() && isset($_GET[$arParams["NOTIFY_ACTION"]]) && $_GET[$arParams["NOTIFY_ACTION"]] == "SUBSCRIBE_PRODUCT") {
        $_SESSION["NOTIFY_PRODUCT"][$USER->GetID()][$arParams["NOTIFY_ID"]] = $arParams["NOTIFY_ID"];
    }
    if ($USER->IsAuthorized()) {
        if (is_array($_SESSION["NOTIFY_PRODUCT"][$USER->GetID()]) && in_array($arParams["NOTIFY_ID"], $_SESSION["NOTIFY_PRODUCT"][$USER->GetID()])) {
            $arResult["STATUS"] = "Y";
        } else {
            $arResult["STATUS"] = "N";
            //$arResult["NOTIFY_URL"] = htmlspecialcharsbx($APPLICATION->GetCurPageParam($arParams["NOTIFY_ACTION"]."=SUBSCRIBE_PRODUCT&".$arParams["NOTIFY_PRODUCT_ID"]."=".$arParams["NOTIFY_ID"], array($arParams["NOTIFY_PRODUCT_ID"], $arParams["NOTIFY_ACTION"])));
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php


示例9: Array

			if (strlen($arItem["DETAIL_PAGE_URL"]) > 0)
				$fieldValue .= "</a>";

			$fieldValue .= " <nobr>(".$arItem["QUANTITY"]." ".$measure.")</nobr>";

			if ($bShowBasketProps)
			{
				$dbProp = CSaleBasket::GetPropsList(Array("SORT" => "ASC", "ID" => "ASC"), Array("BASKET_ID" => $arItem["ID"], "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID")));
				while($arProp = $dbProp -> GetNext())
				{
					if (strlen($arProp["VALUE"]) > 0)
						$fieldValue .= "<div><small>".$arProp["NAME"].": ".$arProp["VALUE"]."</small></div>";
				}
			}

			if (CSaleBasketHelper::isSetParent($arItem)):
				$fieldValue .= "<div class=\"set-link-block\">";
				$fieldValue	.= "<a class=\"dashed-link show-set-link\" href=\"javascript:void(0);\" id=\"set_toggle_link_".$arItem["SET_PARENT_ID"]."\" onclick=\"fToggleSetItems(".$arItem["SET_PARENT_ID"].")\">".GetMessage("SOA_SHOW_SET")."</a>";
				$fieldValue .= "</div>";
			endif;

			if ($bNeedLine)
				$fieldValue .= "<hr size=\"1\" width=\"90%\">";

			$fieldValue .= "</div>";

			if(strlen($arItem["NAME"]) > 0)
			{
				$fieldName .= "<nobr>";
				if (strlen($arItem["DETAIL_PAGE_URL"]) > 0)
					$fieldName .= "<a href=\"".$url."\">";
开发者ID:akniyev,项目名称:arteva.ru,代码行数:31,代码来源:order.php


示例10: getProducts

 private function getProducts()
 {
     if (!($arFilter = $this->getUserFilter())) {
         return array();
     }
     if ($this->arParams['SHOW_NOTAVAIL'] == 'N') {
         $arFilter['CAN_BUY'] = 'Y';
     }
     if ($this->arParams['SHOW_DELAY'] == 'N') {
         $arFilter['DELAY'] = 'N';
     }
     if ($this->arParams['SHOW_SUBSCRIBE'] == 'N') {
         $arFilter["SUBSCRIBE"] = 'N';
     }
     $dbItems = CSaleBasket::GetList(array("NAME" => "ASC", "ID" => "ASC"), $arFilter, false, false, array("ID", "NAME", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "PRICE", "WEIGHT", "DETAIL_PAGE_URL", "CURRENCY", "VAT_RATE", "CATALOG_XML_ID", "MEASURE_NAME", "PRODUCT_XML_ID", "SUBSCRIBE", "DISCOUNT_PRICE", "PRODUCT_PROVIDER_CLASS", "TYPE", "SET_PARENT_ID"));
     $arBasketItems = array();
     $arElementId = array();
     $arSku2Parent = array();
     while ($arItem = $dbItems->GetNext(true, false)) {
         if (CSaleBasketHelper::isSetItem($arItem)) {
             continue;
         }
         $arItem["PRICE_FMT"] = CCurrencyLang::CurrencyFormat($arItem["PRICE"], $arItem["CURRENCY"], true);
         $arItem["FULL_PRICE"] = CCurrencyLang::CurrencyFormat($arItem["PRICE"] + $arItem["DISCOUNT_PRICE"], $arItem["CURRENCY"], true);
         $arItem['QUANTITY'] += 0;
         // remove excessive zeros after period
         if (!$arItem['MEASURE_NAME']) {
             $arItem['MEASURE_NAME'] = GetMessage('TSB1_MEASURE_NAME');
         }
         if ($this->arParams['SHOW_IMAGE'] == 'Y' && $this->bUseCatalog && $arItem["MODULE"] == 'catalog') {
             $arElementId[] = $arItem["PRODUCT_ID"];
             $arParent = CCatalogSku::GetProductInfo($arItem["PRODUCT_ID"]);
             if ($arParent) {
                 $arElementId[] = $arParent["ID"];
                 $arSku2Parent[$arItem["PRODUCT_ID"]] = $arParent["ID"];
             }
         }
         $arBasketItems[] = $arItem;
     }
     $arResult = array('CATEGORIES' => array(), 'TOTAL_PRICE' => 0);
     if ($arBasketItems) {
         if ($this->arParams['SHOW_IMAGE'] == 'Y') {
             $this->setImgSrc($arBasketItems, $arElementId, $arSku2Parent);
         }
         $arResult["CATEGORIES"] = array("READY" => array(), "DELAY" => array(), "SUBSCRIBE" => array(), "NOTAVAIL" => array());
         // fill item arrays for templates
         foreach ($arBasketItems as $arItem) {
             if ($arItem["CAN_BUY"] == "Y") {
                 if ($arItem["DELAY"] == "Y") {
                     $arResult["CATEGORIES"]["DELAY"][] = $arItem;
                 } else {
                     $arResult["CATEGORIES"]["READY"][] = $arItem;
                 }
             } else {
                 if ($arItem["SUBSCRIBE"] == "Y") {
                     $arResult["CATEGORIES"]["SUBSCRIBE"][] = $arItem;
                 } else {
                     $arResult["CATEGORIES"]["NOTAVAIL"][] = $arItem;
                 }
             }
         }
         if ($this->arParams['SHOW_PRICE'] == 'Y' || $this->arParams['SHOW_SUMMARY'] == 'Y' || $this->arParams['SHOW_TOTAL_PRICE'] == 'Y') {
             $arOrder = $this->calculateOrder($arResult["CATEGORIES"]["READY"]);
             $arResult["CATEGORIES"]["READY"] = $arOrder['BASKET_ITEMS'];
             foreach ($arResult["CATEGORIES"]["READY"] as &$arItem) {
                 $arItem["SUM"] = CCurrencyLang::CurrencyFormat($arItem["PRICE"] * $arItem["QUANTITY"], $arItem["CURRENCY"], true);
                 $arItem["PRICE_FMT"] = CCurrencyLang::CurrencyFormat($arItem["PRICE"], $arItem["CURRENCY"], true);
             }
             $arResult["TOTAL_PRICE"] = $arOrder['ORDER_PRICE'];
         }
     }
     return array('NUM_PRODUCTS' => count($arBasketItems), 'TOTAL_PRICE' => $arResult["TOTAL_PRICE"], 'CATEGORIES' => $arResult["CATEGORIES"]);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:73,代码来源:class.php


示例11: GetMessage

         $status = GetMessage("BUYER_B_STATUS_DELAY");
     }
     if ($arBasket["CAN_BUY"] == "N" && $arBasket["SUBSCRIBE"] == "N") {
         $status = GetMessage("BUYER_B_STATUS_NO");
     }
     if ($arBasket["CAN_BUY"] == "N" && $arBasket["SUBSCRIBE"] == "Y") {
         $status = GetMessage("BUYER_B_STATUS_NOTIFY");
     }
     $row->AddField("DELAY", $status);
     $name = "<a href=\"" . $arBasket["DETAIL_PAGE_URL"] . "\">" . $arBasket["NAME"] . "</a>\n\t\t\t<input type=\"hidden\" value=\"" . $arBasket["PRODUCT_ID"] . "\" name=\"PRODUCT_ID[" . $arBasket["LID"] . "][]\" />";
     $name .= "<input type=\"hidden\" name=\"table_id\" value=\"" . $sTableID_tab4 . "\">";
     $dbProp = CSaleBasket::GetPropsList(array("SORT" => "ASC", "ID" => "ASC"), array("BASKET_ID" => $arBasket["ID"], "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID")));
     while ($arProp = $dbProp->GetNext()) {
         $name .= "<div><small>" . $arProp["NAME"] . ": " . $arProp["VALUE"] . "</small></div>";
     }
     if (CSaleBasketHelper::isSetParent($arBasket)) {
         $name .= "<br/><a href=\"javascript:void(0);\" class=\"dashed-link show-set-link\" id=\"set_toggle_link_b2" . $arBasket["ID"] . "\" onclick=\"fToggleSetItems('b2" . $arBasket["ID"] . "', 'set_toggle_link_');\">" . GetMessage("BUYER_F_SHOW_SET") . "</a><br/>";
         if (!empty($arSetData) && array_key_exists($arBasket["ID"], $arSetData)) {
             $name .= "<div class=\"set_item_b2" . $arBasket["ID"] . "\" style=\"display:none\">";
             foreach ($arSetData[$arBasket["ID"]] as $set) {
                 $name .= "<p style=\"display:inline; font-style:italic\">" . $set["NAME"] . "</p><br/>";
             }
             $name .= "</div>";
         }
     }
     $row->AddField("NAME", $name);
     $row->AddField("PRICE", SaleFormatCurrency($arBasket["PRICE"], $arBasket["CURRENCY"]));
     if (count($arSites) > 1) {
         $row->AddField("LID", "[" . $arBasket["LID"] . "] " . htmlspecialcharsbx($arSites[$arBasket["LID"]]["NAME"]) . "");
     }
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:buyers_profile.php


示例12: Delete

 /**
  * <p>Метод удаляет запись корзины с кодом ID. Метод динамичный.</p> <a name="examples"></a>
  *
  *
  * @param int $ID  
  *
  * @return bool 
  *
  * <h4>Example</h4> 
  * <pre>
  * &lt;?
  * if (CSaleBasket::Delete(22))
  *     echo "Запись успешно удалена";
  * ?&gt;
  * </htmМетод может использоваться и для удаления записей корзин, которые уже превращены в заказы. То есть, мы можем удалить запись из состава заказа. Но следует помнить, что после использования метода необходимо обновлять итоговую сумму заказа, например, так: 
  * 
  * 
  *  $contents = array();
  *  $dbBasketItems = CSaleBasket::GetList(
  *             array(
  *                "NAME" =&gt; "ASC",
  *                "ID" =&gt; "ASC"
  *             ),
  *             array(
  *               "LID" =&gt; SITE_ID,
  *               "ORDER_ID" =&gt; $order_id,
  *             )
  *          );
  *   while ($arItems = $dbBasketItems-&gt;Fetch()){
  *             $contents[] = $arItems;
  *          }
  *   $sum = 0;
  *   foreach($contents as $basket_item){
  *             if($basket_item['DISCOUNT_PRICE']&gt;0){
  *                $sum += $basket_item['DISCOUNT_PRICE']*$basket_item['QUANTITY'];
  *             }else{
  *                $sum += $basket_item['PRICE']*$basket_item['QUANTITY'];
  *             }
  *          }
  *    $arFields = array(
  *             "PRICE" =&gt; $sum,
  *          );
  *    CSaleOrder::Update($order_id, $arFields);
  * </pre>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/sale/classes/csalebasket/csalebasket__delete.e0d06223.php
  * @author Bitrix
  */
 public static function Delete($ID)
 {
     global $DB, $APPLICATION;
     $isOrderConverted = \Bitrix\Main\Config\Option::get("main", "~sale_converted_15", 'N');
     $ID = intval($ID);
     if (0 >= $ID) {
         return false;
     }
     if ($isOrderConverted == "Y") {
         /** @var \Bitrix\Sale\Result $r */
         $r = \Bitrix\Sale\Compatible\BasketCompatibility::delete($ID);
         if (!$r->isSuccess(true)) {
             foreach ($r->getErrorMessages() as $error) {
                 $APPLICATION->ThrowException($error);
             }
             return false;
         }
         return true;
     }
     $rsBaskets = CSaleBasket::GetList(array(), array('ID' => $ID), false, false, array('ID', 'ORDER_ID', 'PRODUCT_ID', 'NAME', 'SUBSCRIBE', 'FUSER_ID', 'TYPE', 'SET_PARENT_ID'));
     if (!($arBasket = $rsBaskets->Fetch())) {
         return false;
     }
     foreach (GetModuleEvents("sale", "OnBeforeBasketDelete", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
             return false;
         }
     }
     if (CSaleBasketHelper::isSetParent($arBasket)) {
         $rsSetItems = CSaleBasket::GetList(array(), array("SET_PARENT_ID" => $ID, "TYPE" => ""), false, false, array('ID', 'ORDER_ID', 'PRODUCT_ID', 'NAME', 'SUBSCRIBE', 'FUSER_ID', 'TYPE', 'SET_PARENT_ID'));
         while ($arSetItem = $rsSetItems->GetNext()) {
             CSaleBasket::Delete($arSetItem["ID"]);
         }
     }
     if (0 < intval($arBasket["ORDER_ID"])) {
         CSaleOrderChange::AddRecord($arBasket["ORDER_ID"], "BASKET_REMOVED", array("PRODUCT_ID" => $arBasket["PRODUCT_ID"], "NAME" => $arBasket["NAME"]));
     }
     $DB->Query("DELETE FROM b_sale_basket_props WHERE BASKET_ID = " . $ID, true);
     if (intval($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]) > 0 && !CSaleBasketHelper::isSetItem($arBasket)) {
         $_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]--;
     }
     $DB->Query("DELETE FROM b_sale_store_barcode WHERE BASKET_ID = " . $ID, true);
     $DB->Query("DELETE FROM b_sale_basket WHERE ID = " . $ID, true);
     if ('Y' == $arBasket['SUBSCRIBE'] && array_key_exists('NOTIFY_PRODUCT', $_SESSION)) {
         $intUserID = CSaleUser::GetUserID($arBasket['FUSER_ID']);
         if ($intUserID && array_key_exists($intUserID, $_SESSION['NOTIFY_PRODUCT'])) {
             if (array_key_exists($arBasket['PRODUCT_ID'], $_SESSION['NOTIFY_PRODUCT'][$intUserID])) {
                 unset($_SESSION['NOTIFY_PRODUCT'][$intUserID][$arBasket['PRODUCT_ID']]);
             }
         }
//.........这里部分代码省略.........
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:basket.php


示例13: UpdateBasketPrices

 function UpdateBasketPrices($fuserID, $siteID)
 {
     $fuserID = (int) $fuserID;
     if ($fuserID <= 0) {
         return false;
     }
     $siteID = (string) $siteID;
     if ($siteID == '') {
         $siteID = SITE_ID;
     }
     $isOrderConverted = \Bitrix\Main\Config\Option::get("main", "~sale_converted_15", 'N');
     DiscountCouponsManager::clearApply(false);
     $basketItems = array();
     /*
     if (!empty($arBasketItems) && is_array($arBasketItems))
     			{
     				foreach ($arBasketItems as &$basketItemData)
     				{
     					if (array_key_exists('MEASURE_RATIO', $basketItemData))
     					{
     						$basketItemQuantity = floatval($basketItemData['QUANTITY']);
     						$basketItemRatio = floatval($basketItemData['MEASURE_RATIO']);
     
     						$mod = roundEx(($basketItemQuantity / $basketItemRatio - intval($basketItemQuantity / $basketItemRatio)), 6);
     
     						if ($mod !== 0)
     						{
     							$basketItemData['QUANTITY'] = ceil(ceil($basketItemQuantity) / $basketItemRatio)* $basketItemRatio;
     							CSaleBasket::Update($basketItemData['ID'], array('QUANTITY' => $basketItemData['QUANTITY']));
     						}
     					}
     				}
     				unset($basketItemData);
     			}
     */
     $dbBasketItems = CSaleBasket::GetList(array("ALL_PRICE" => "DESC"), array("FUSER_ID" => $fuserID, "LID" => $siteID, "ORDER_ID" => "NULL", "SUBSCRIBE" => "N"), false, false, array("ID", "MODULE", "PRODUCT_ID", "QUANTITY", "CALLBACK_FUNC", "PRODUCT_PROVIDER_CLASS", "CAN_BUY", "DELAY", "NOTES", "TYPE", "SET_PARENT_ID"));
     while ($arItem = $dbBasketItems->Fetch()) {
         $basketItems[] = $arItem;
     }
     if (!empty($basketItems) && is_array($basketItems)) {
         $basketItems = getRatio($basketItems);
         foreach ($basketItems as $basketItem) {
             $fields = array();
             $basketItem['CALLBACK_FUNC'] = (string) $basketItem['CALLBACK_FUNC'];
             $basketItem['PRODUCT_PROVIDER_CLASS'] = (string) $basketItem['PRODUCT_PROVIDER_CLASS'];
             if (strval(trim($basketItem['PRODUCT_PROVIDER_CLASS'])) !== '' || strval(trim($basketItem['CALLBACK_FUNC'])) !== '') {
                 $basketItem['MODULE'] = (string) $basketItem['MODULE'];
                 $basketItem['PRODUCT_ID'] = (int) $basketItem['PRODUCT_ID'];
                 $basketItem['QUANTITY'] = (double) $basketItem['QUANTITY'];
                 if ($productProvider = CSaleBasket::GetProductProvider($basketItem)) {
                     $fields = $productProvider::GetProductData(array("PRODUCT_ID" => $basketItem["PRODUCT_ID"], "QUANTITY" => $basketItem["QUANTITY"], "RENEWAL" => "N", "CHECK_COUPONS" => 'Y' == $basketItem['CAN_BUY'] && 'N' == $basketItem['DELAY'] ? 'Y' : 'N', "CHECK_DISCOUNT" => CSaleBasketHelper::isSetItem($basketItem) ? 'N' : 'Y', "BASKET_ID" => $basketItem["ID"], "NOTES" => $basketItem["NOTES"]));
                 } else {
                     $fields = CSaleBasket::ExecuteCallbackFunction($basketItem["CALLBACK_FUNC"], $basketItem["MODULE"], $basketItem["PRODUCT_ID"], $basketItem["QUANTITY"], "N");
                 }
                 if (!empty($fields) && is_array($fields)) {
                     if ($isOrderConverted == 'Y' && $basketItem['DELAY'] == 'N') {
                         if (!Sale\Compatible\DiscountCompatibility::isInited()) {
                             Sale\Compatible\DiscountCompatibility::init();
                         }
                         if (Sale\Compatible\DiscountCompatibility::usedByClient()) {
                             Sale\Compatible\DiscountCompatibility::setBasketItemData($basketItem['ID'], $fields);
                         }
                     }
                     $fields['CAN_BUY'] = 'Y';
                     $fields['TYPE'] = (int) $basketItem['TYPE'];
                     $fields['SET_PARENT_ID'] = (int) $basketItem['SET_PARENT_ID'];
                 } else {
                     $fields = array('CAN_BUY' => 'N');
                 }
             }
             if (array_key_exists('MEASURE_RATIO', $basketItem)) {
                 $basketItemQuantity = floatval($basketItem['QUANTITY']);
                 $basketItemRatio = floatval($basketItem['MEASURE_RATIO']);
                 $mod = roundEx($basketItemQuantity / $basketItemRatio - intval($basketItemQuantity / $basketItemRatio), 6);
                 if ($mod != 0) {
                     $fields['QUANTITY'] = floor(ceil($basketItemQuantity) / $basketItemRatio) * $basketItemRatio;
                 }
             }
             if (!empty($fields) && is_array($fields)) {
                 CSaleBasket::Update($basketItem['ID'], $fields);
             }
         }
     }
     return true;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:85,代码来源:basket.php


示例14: getBasketItems

 public function getBasketItems()
 {
     global $APPLICATION;
     $bUseCatalog = CModule::IncludeModule("catalog");
     $bUseIblock = $bUseCatalog;
     $bShowReady = False;
     $bShowDelay = False;
     $bShowSubscribe = False;
     $bShowNotAvail = False;
     $allSum = 0;
     $allWeight = 0;
     $allCurrency = CSaleLang::GetLangCurrency($this->getSiteId());
     $allVATSum = 0;
     $arParents = array();
     $arResult["ITEMS"]["AnDelCanBuy"] = array();
     $arResult["ITEMS"]["DelDelCanBuy"] = array();
     $arResult["ITEMS"]["nAnCanBuy"] = array();
     $arResult["ITEMS"]["ProdSubscribe"] = array();
     $DISCOUNT_PRICE_ALL = 0;
     // BASKET PRODUCTS (including measures, ratio, iblock properties data)
     $arImgFields = array("PREVIEW_PICTURE", "DETAIL_PICTURE");
     $arBasketItems = array();
     $arSku2Parent = array();
     $arSetParentWeight = array();
     $basketItemsFilter = array("USER_ID" => $this->userId, "ORDER_ID" => "NULL");
     if ($this->showDelay != 'Y') {
         $basketItemsFilter['DELAY'] = 'N';
     }
     $dbItems = CSaleBasket::GetList(array("ID" => "ASC"), $basketItemsFilter, false, false, array("ID", "NAME", "CALLBACK_FUNC", &q 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CSaleDelivery类代码示例发布时间:2022-05-20
下一篇:
PHP CSaleBasket类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap