本文整理汇总了PHP中getMeasures函数的典型用法代码示例。如果您正苦于以下问题:PHP getMeasures函数的具体用法?PHP getMeasures怎么用?PHP getMeasures使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getMeasures函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBasketItems
public function getBasketItems()
{
global $APPLICATION;
if (self::$catalogIncluded === null) {
self::$catalogIncluded = Loader::includeModule('catalog');
}
self::$iblockIncluded = self::$catalogIncluded;
CSaleBasket::UpdateBasketPrices(CSaleBasket::GetBasketUserID(), SITE_ID);
$bShowReady = false;
$bShowDelay = false;
$bShowSubscribe = false;
$bShowNotAvail = false;
$allSum = 0;
$allWeight = 0;
$allCurrency = CSaleLang::GetLangCurrency(SITE_ID);
$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();
$basketKey = 0;
$basketIds = array();
$arSku2Parent = array();
$arSetParentWeight = array();
$arElementId = array();
$dbItems = CSaleBasket::GetList(array("ID" => "ASC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => "NULL"), false, false, array("ID", "NAME", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "PRICE", "WEIGHT", "DETAIL_PAGE_URL", "NOTES", "CURRENCY", "VAT_RATE", "CATALOG_XML_ID", "PRODUCT_XML_ID", "SUBSCRIBE", "DISCOUNT_PRICE", "PRODUCT_PROVIDER_CLASS", "TYPE", "SET_PARENT_ID"));
while ($arItem = $dbItems->GetNext()) {
$arItem['PROPS'] = array();
$arBasketItems[$basketKey] = $arItem;
$basketIds[$arItem['ID']] =& $arBasketItems[$basketKey];
$basketKey++;
if (CSaleBasketHelper::isSetItem($arItem)) {
continue;
}
$arElementId[] = $arItem["PRODUCT_ID"];
}
if (!empty($arElementId) && self::$catalogIncluded) {
$productList = CCatalogSKU::getProductList($arElementId);
if (!empty($productList)) {
foreach ($productList as $offerId => $offerInfo) {
$offerInfo['PRODUCT_ID'] = $offerInfo['ID'];
$arElementId[] = $offerInfo['ID'];
$arSku2Parent[$offerId] = $offerInfo['ID'];
$arParents[$offerId] = $offerInfo;
}
unset($offerInfo, $offerId);
}
unset($productList);
// get measures, ratio, sku props data and available quantity
$arBasketItems = getMeasures($arBasketItems);
$arBasketItems = getRatio($arBasketItems);
$arBasketItems = $this->getAvailableQuantity($arBasketItems);
$propsIterator = CSaleBasket::GetPropsList(array('BASKET_ID' => 'ASC', 'SORT' => 'ASC', 'ID' => 'ASC'), array('BASKET_ID' => array_keys($basketIds)));
while ($property = $propsIterator->GetNext()) {
$property['CODE'] = (string) $property['CODE'];
if ($property['CODE'] == 'CATALOG.XML_ID' || $property['CODE'] == 'PRODUCT.XML_ID') {
continue;
}
if (!isset($basketIds[$property['BASKET_ID']])) {
continue;
}
$basketIds[$property['BASKET_ID']]['PROPS'][] = $property;
}
unset($property, $propsIterator, $basketIds);
}
// get product properties data
$arProductData = getProductProps($arElementId, array_merge(array("ID"), $arImgFields, $this->arCustomSelectFields));
foreach ($arBasketItems as &$arItem) {
$quantityIsFloat = false;
if (number_format(doubleval($arItem['QUANTITY']), 2, '.', '') != intval($arItem['QUANTITY'])) {
$quantityIsFloat = true;
}
$arItem["QUANTITY"] = $quantityIsFloat === false && $this->quantityFloat != "Y" ? intval($arItem['QUANTITY']) : number_format(doubleval($arItem['QUANTITY']), 2, '.', '');
$arItem["PRICE_VAT_VALUE"] = $arItem["PRICE"] / ($arItem["VAT_RATE"] + 1) * $arItem["VAT_RATE"];
$arItem["PRICE_FORMATED"] = CCurrencyLang::CurrencyFormat($arItem["PRICE"], $arItem["CURRENCY"], true);
$arItem["WEIGHT"] = doubleval($arItem["WEIGHT"]);
$arItem["WEIGHT_FORMATED"] = roundEx(doubleval($arItem["WEIGHT"] / $this->weightKoef), SALE_WEIGHT_PRECISION) . " " . $this->weightUnit;
if (CSaleBasketHelper::isSetItem($arItem)) {
$arSetParentWeight[$arItem["SET_PARENT_ID"]] += $arItem["WEIGHT"] * $arItem["QUANTITY"];
}
if (isset($arProductData[$arItem['PRODUCT_ID']]) && is_array($arProductData[$arItem['PRODUCT_ID']])) {
foreach ($arProductData[$arItem["PRODUCT_ID"]] as $key => $value) {
if (strpos($key, "PROPERTY_") !== false || in_array($key, $arImgFields)) {
$arItem[$key] = $value;
}
}
}
if (array_key_exists($arItem["PRODUCT_ID"], $arSku2Parent)) {
$arFieldsToFill = array_merge($this->arCustomSelectFields, $arImgFields);
// fields to be filled with parents' values if empty
foreach ($arFieldsToFill as $field) {
$fieldVal = in_array($field, $arImgFields) ? $field : $field . "_VALUE";
$parentId = $arSku2Parent[$arItem["PRODUCT_ID"]];
if ((!isset($arItem[$fieldVal]) || isset($arItem[$fieldVal]) && strlen($arItem[$fieldVal]) == 0) && (isset($arProductData[$parentId][$fieldVal]) && !empty($arProductData[$parentId][$fieldVal]))) {
$arItem[$fieldVal] = $arProductData[$parentId][$fieldVal];
//.........这里部分代码省略.........
示例2: getMeasures
}
// else if ($storeCount == -1) TODO - storeCount = -1 not used at all
// storeCount = 0 - different logic?
// }
}
if (CSaleBasketHelper::isSetParent($arBasket) || CSaleBasketHelper::isSetItem($arBasket))
{
$parentItemFound = true;
}
}
}
if (!empty($arBasketItem)) // measures and ratio
{
$arBasketItem = getMeasures($arBasketItem);
$arBasketItem = getRatio($arBasketItem);
}
if ($parentItemFound === true && !empty($arBasketItem) && is_array($arBasketItem))
{
$arBasketItem = CSaleBasketHelper::reSortItems($arBasketItem, true);
}
$arProductData = array();
$arIblockProps = array();
$arTmpColumns = array();
$arColumnsOptions = CUserOptions::GetOption("order_basket_table", "table_columns");
$arCustomSelectFields = array();
if ($arColumnsOptions)
示例3: foreach
}
}
foreach ($arResult["ITEMS"]["AnDelCanBuy"] as $key => $val) {
if (array_key_exists($val["PRODUCT_ID"], $arMeasures)) {
$arResult["ITEMS"]["AnDelCanBuy"][$key]["CATALOG_MEASURE"] = $arMeasures[$val["PRODUCT_ID"]];
}
if ($arResult["ITEMS_IMG"][$val["ID"]]) {
$arResult["ITEMS"]["AnDelCanBuy"][$key]["DETAIL_PICTURE"] = $arResult["ITEMS_IMG"][$val["ID"]];
}
if ($productId = CCatalogSku::GetProductInfo($val["PRODUCT_ID"])) {
$arElementsID[] = $productId["ID"];
$arProductsToElements[$productId["ID"]][] = $val["PRODUCT_ID"];
}
}
if (function_exists(getMeasures)) {
$arResult["ITEMS"]["AnDelCanBuy"] = getMeasures($arResult["ITEMS"]["AnDelCanBuy"]);
}
if (function_exists(getRatio)) {
$arResult["ITEMS"]["AnDelCanBuy"] = getRatio($arResult["ITEMS"]["AnDelCanBuy"]);
}
$arResult["ITEMS"]["AnDelCanBuy"] = getAvailableQuantity($arResult["ITEMS"]["AnDelCanBuy"]);
foreach ($arResult["ITEMS"]["DelDelCanBuy"] as $key => $val) {
if ($arResult["ITEMS_IMG"][$val["ID"]]) {
$arResult["ITEMS"]["DelDelCanBuy"][$key]["DETAIL_PICTURE"] = $arResult["ITEMS_IMG"][$val["ID"]];
}
if ($productId = CCatalogSku::GetProductInfo($val["PRODUCT_ID"])) {
$arElementsID[] = $productId["ID"];
$arProductsToElements[$productId["ID"]][] = $val["PRODUCT_ID"];
}
}
foreach ($arResult["ITEMS"]["nAnCanBuy"] as $key => $val) {
示例4: array
$file = CFile::ResizeImageGet($ar_fields['DETAIL_PICTURE'], array('width' => 30, 'height' => 18), BX_RESIZE_IMAGE_PROPORTIONAL, true);
} else {
$res = CIBlockElement::GetProperty($ar_fields['IBLOCK_ID'], $ar_fields['ID'], "sort", "asc", array("CODE" => "MORE_PHOTO"));
while ($ob = $res->GetNext()) {
if ($ob['VALUE']) {
$file = CFile::ResizeImageGet($ob['VALUE'], array('width' => 30, 'height' => 18), BX_RESIZE_IMAGE_PROPORTIONAL, true);
continue;
}
}
}
}
$arBasketList[$i] = $arItem;
$arBasketList[$i]['PICTURE'] = $file['src'];
$i++;
}
$arBasketList = getMeasures($arBasketList);
$strOrderList = ' <table border="1" bordercolor="#f1f1f1" cellpadding="20" cellspacing="0" width="100%" style="border-collapse: collapse; background; font: 18px/20px Arial, Helvetica, sans-serif;">
<tr>
<th align="left" width="312" bgcolor="#ea543f" style="color: #fff; font-weight: normal;">' . GetMessage('SOA_TITLE_NS_1') . '</th>
<th align="left" bgcolor="#ea543f" style="color: #fff; font-weight: normal;">' . GetMessage('SOA_TITLE_NS_2') . '</th>
<th align="left" bgcolor="#ea543f" style="color: #fff; font-weight: normal;">' . GetMessage('SOA_TITLE_NS_3') . '</th>
</tr>';
foreach ($arBasketList as $arItem) {
$measureText = isset($arItem["MEASURE_TEXT"]) && strlen($arItem["MEASURE_TEXT"]) ? $arItem["MEASURE_TEXT"] : GetMessage("SOA_SHT");
$strOrderList .= ' <tr>
<td>
<span style="display: inline-block; width: 40px; text-align: center;">
<img border="0" alt="product" src="http://' . $_SERVER['SERVER_NAME'] . $arItem['PICTURE'] . '" />
</span>
<a href="#" style="text-decoration: none;">
<font face="Arial, Helvetica, sans-serif" color="#4f4f4f" size="3"><span style="margin: 1px 0 0 7px; vertical-align: top;">' . $arItem["NAME"] . '</span></font>
示例5: getColumnsHeaders
echo getColumnsHeaders($arUserColumns, "detail", false);
?>
</tr>
<?
$bXmlId = COption::GetOptionString("sale", "show_order_product_xml_id", "N");
$arCurFormat = CCurrencyLang::GetCurrencyFormat($arOrder["CURRENCY"]);
$CURRENCY_FORMAT = trim(str_replace("#", '', $arCurFormat["FORMAT_STRING"]));
$ORDER_TOTAL_PRICE = 0;
$ORDER_TOTAL_WEIGHT = 0;
$arFilterRecomendet = array();
$arBasketProps = array();
$bUseCatalog = (CModule::IncludeModule("catalog")) ? true : false;
$bUseIblock = (CModule::IncludeModule("iblock")) ? true : false;
$arBasketItems = getMeasures($arBasketItems);
if(!empty($arBasketId))
{
//select props from basket
$arPropsFilter = array("BASKET_ID" => $arBasketId);
if ($bXmlId == "N")
$arPropsFilter["!CODE"] = array("PRODUCT.XML_ID", "CATALOG.XML_ID");
$dbBasketPropsTmp = CSaleBasket::GetPropsList(
array("BASKET_ID" => "ASC", "SORT" => "ASC", "NAME" => "ASC"),
$arPropsFilter,
false,
false,
array("ID", "BASKET_ID", "NAME", "VALUE", "CODE", "SORT")
);
示例6: sendEmailNewOrder
protected function sendEmailNewOrder($newOrderId, $buyer)
{
global $DB;
$strOrderList = "";
$baseLangCurrency = CSaleLang::GetLangCurrency($this->siteId);
$orderNew = CSaleOrder::GetByID($newOrderId);
$orderNew["BASKET_ITEMS"] = array();
$userEmail = $buyer["email"];
$fio = $buyer["last-name"] . (isset($buyer["first-name"]) ? $buyer["first-name"] : "");
$dbBasketTmp = CSaleBasket::GetList(array("SET_PARENT_ID" => "DESC", "TYPE" => "DESC", "NAME" => "ASC"), array("ORDER_ID" => $newOrderId), false, false, array("ID", "PRICE", "QUANTITY", "NAME"));
while ($arBasketTmp = $dbBasketTmp->GetNext()) {
$orderNew["BASKET_ITEMS"][] = $arBasketTmp;
}
$orderNew["BASKET_ITEMS"] = getMeasures($orderNew["BASKET_ITEMS"]);
foreach ($orderNew["BASKET_ITEMS"] as $val) {
if (CSaleBasketHelper::isSetItem($val)) {
continue;
}
$measure = isset($val["MEASURE_TEXT"]) ? $val["MEASURE_TEXT"] : GetMessage("SALE_YMH_SHT");
$strOrderList .= $val["NAME"] . " - " . $val["QUANTITY"] . " " . $measure . ": " . SaleFormatCurrency($val["PRICE"], $baseLangCurrency);
$strOrderList .= "\n";
}
//send mail
$arFields = array("ORDER_ID" => $orderNew["ACCOUNT_NUMBER"], "ORDER_DATE" => Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", $this->siteId))), "ORDER_USER" => $fio, "PRICE" => SaleFormatCurrency($orderNew["PRICE"], $baseLangCurrency), "BCC" => COption::GetOptionString("sale", "order_email", "order@" . $_SERVER['SERVER_NAME']), "EMAIL" => array("PAYER_NAME" => $fio, "USER_EMAIL" => $userEmail), "ORDER_LIST" => $strOrderList, "SALE_EMAIL" => COption::GetOptionString("sale", "order_email", "order@" . $_SERVER['SERVER_NAME']), "DELIVERY_PRICE" => $orderNew["DELIVERY_PRICE"]);
$eventName = "SALE_NEW_ORDER";
$bSend = true;
foreach (GetModuleEvents("sale", "OnOrderNewSendEmail", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($newOrderId, &$eventName, &$arFields)) === false) {
$bSend = false;
}
}
if ($bSend) {
$event = new CEvent();
$event->Send($eventName, $this->siteId, $arFields, "N");
}
CSaleMobileOrderPush::send("ORDER_CREATED", array("ORDER" => $orderNew));
}
示例7: notifyNewOrder
public static function notifyNewOrder($newOrderId, $siteId, $buyerEmail = "", $buyerFio = "")
{
if (strlen($newOrderId) <= 0) {
throw new ArgumentNullException("newOrderId");
}
if (strlen($siteId) <= 0) {
throw new ArgumentNullException("siteId");
}
global $DB;
$strOrderList = "";
$baseLangCurrency = \CSaleLang::GetLangCurrency($siteId);
$orderNew = \CSaleOrder::GetByID($newOrderId);
$orderNew["BASKET_ITEMS"] = array();
$dbBasketTmp = \CSaleBasket::GetList(array("SET_PARENT_ID" => "DESC", "TYPE" => "DESC", "NAME" => "ASC"), array("ORDER_ID" => $newOrderId), false, false, array("ID", "PRICE", "QUANTITY", "NAME"));
while ($arBasketTmp = $dbBasketTmp->GetNext()) {
$orderNew["BASKET_ITEMS"][] = $arBasketTmp;
}
$orderNew["BASKET_ITEMS"] = getMeasures($orderNew["BASKET_ITEMS"]);
foreach ($orderNew["BASKET_ITEMS"] as $val) {
if (\CSaleBasketHelper::isSetItem($val)) {
continue;
}
$measure = isset($val["MEASURE_TEXT"]) ? $val["MEASURE_TEXT"] : GetMessage("SALE_YMH_SHT");
$strOrderList .= $val["NAME"] . " - " . $val["QUANTITY"] . " " . $measure . ": " . SaleFormatCurrency($val["PRICE"], $baseLangCurrency);
$strOrderList .= "\n";
}
//send mail
$arFields = array("ORDER_ID" => $orderNew["ACCOUNT_NUMBER"], "ORDER_DATE" => Date($DB->DateFormatToPHP(\CLang::GetDateFormat("SHORT", $siteId))), "ORDER_USER" => $buyerFio, "PRICE" => SaleFormatCurrency($orderNew["PRICE"], $baseLangCurrency), "BCC" => \COption::GetOptionString("sale", "order_email", "order@" . $_SERVER['SERVER_NAME']), "EMAIL_TO" => array("PAYER_NAME" => $buyerFio, "USER_EMAIL" => $buyerEmail), "ORDER_LIST" => $strOrderList, "SALE_EMAIL" => \COption::GetOptionString("sale", "order_email", "order@" . $_SERVER['SERVER_NAME']), "DELIVERY_PRICE" => $orderNew["DELIVERY_PRICE"]);
$eventName = "SALE_NEW_ORDER";
$bSend = true;
foreach (GetModuleEvents("sale", "OnOrderNewSendEmail", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($newOrderId, &$eventName, &$arFields)) === false) {
$bSend = false;
}
}
$emailSendRes = false;
if ($bSend) {
$event = new \CEvent();
$emailSendRes = $event->Send($eventName, $siteId, $arFields, "N");
}
$pushSendResult = \CSaleMobileOrderPush::send("ORDER_CREATED", array("ORDER" => $orderNew));
return $emailSendRes && $pushSendResult;
}
示例8: array
$arBasketTmp = CSaleBasket::GetByID($arBasketIDs[$i]);
if (floatval($arBasketTmp["VAT_RATE"]) > 0) {
$bUseVat = true;
}
$priceTotal += $arBasketTmp["PRICE"] * $arBasketTmp["QUANTITY"];
$arBasketTmp["PROPS"] = array();
if (isset($_GET["PROPS_ENABLE"]) && $_GET["PROPS_ENABLE"] == "Y") {
$dbBasketProps = CSaleBasket::GetPropsList(array("SORT" => "ASC", "NAME" => "ASC"), array("BASKET_ID" => $arBasketTmp["ID"]), false, false, array("ID", "BASKET_ID", "NAME", "VALUE", "CODE", "SORT"));
while ($arBasketProps = $dbBasketProps->GetNext()) {
$arBasketTmp["PROPS"][$arBasketProps["ID"]] = $arBasketProps;
}
}
$arBasketOrder[] = $arBasketTmp;
}
if (is_array($arBasketOrder) && !empty($arBasketOrder)) {
$arBasketOrder = getMeasures($arBasketOrder);
}
//разбрасываем скидку на заказ по товарам
if (floatval($arOrder["DISCOUNT_VALUE"]) > 0) {
$arBasketOrder = GetUniformDestribution($arBasketOrder, $arOrder["DISCOUNT_VALUE"], $priceTotal);
}
//налоги
$arTaxList = array();
$db_tax_list = CSaleOrderTax::GetList(array("APPLY_ORDER" => "ASC"), array("ORDER_ID" => $ORDER_ID));
$iNds = -1;
$i = 0;
while ($ar_tax_list = $db_tax_list->Fetch()) {
$arTaxList[$i] = $ar_tax_list;
// определяем, какой из налогов - НДС
// НДС должен иметь код NDS, либо необходимо перенести этот шаблон
// в каталог пользовательских шаблонов и исправить
示例9: 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", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "PRICE", "WEIGHT", "DETAIL_PAGE_URL", "NOTES", "CURRENCY", "VAT_RATE", "CATALOG_XML_ID", "PRODUCT_XML_ID", "SUBSCRIBE", "DISCOUNT_PRICE", "PRODUCT_PROVIDER_CLASS", "TYPE", "SET_PARENT_ID"));
while ($arItem = $dbItems->GetNext()) {
$arBasketItems[] = $arItem;
if (CSaleBasketHelper::isSetItem($arItem)) {
continue;
}
$arElementId[] = $arItem["PRODUCT_ID"];
if ($bUseCatalog) {
$arParent = CCatalogSku::GetProductInfo($arItem["PRODUCT_ID"]);
if ($arParent) {
$arElementId[] = $arParent["ID"];
$arSku2Parent[$arItem["PRODUCT_ID"]] = $arParent["ID"];
$arParents[$arItem["PRODUCT_ID"]]["PRODUCT_ID"] = $arParent["ID"];
$arParents[$arItem["PRODUCT_ID"]]["IBLOCK_ID"] = $arParent["IBLOCK_ID"];
}
}
}
// get measures, ratio, sku props data and available quantity
if (!empty($arBasketItems) && $bUseCatalog) {
$arBasketItems = getMeasures($arBasketItems);
$arBasketItems = getRatio($arBasketItems);
$arBasketItems = $this->getAvailableQuantity($arBasketItems);
}
// get product properties data
$arProductData = getProductProps($arElementId, array_merge(array("ID"), $arImgFields, $this->arCustomSelectFields));
foreach ($arBasketItems as &$arItem) {
$quantityIsFloat = false;
if (number_format(doubleval($arItem['QUANTITY']), 2, '.', '') != intval($arItem['QUANTITY'])) {
$quantityIsFloat = true;
}
$arItem["QUANTITY"] = $quantityIsFloat === false && $this->quantityFloat != "Y" ? intval($arItem['QUANTITY']) : number_format(doubleval($arItem['QUANTITY']), 2, '.', '');
$arItem["QUANTITY_FORMATED"] = $arItem["QUANTITY"] . " " . $arItem["MEASURE_TEXT"];
$arItem["PROPS"] = array();
$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()) {
$arItem["PROPS"][] = $arProp;
}
$arItem["PRICE_VAT_VALUE"] = $arItem["PRICE"] / ($arItem["VAT_RATE"] + 1) * $arItem["VAT_RATE"];
$arItem["PRICE_FORMATED"] = $this->getSaleFormatCurrency($arItem["PRICE"], $arItem["CURRENCY"]);
$arItem["WEIGHT"] = doubleval($arItem["WEIGHT"]);
$arItem["WEIGHT_FORMATED"] = roundEx(doubleval($arItem["WEIGHT"] / $this->weightKoef), SALE_WEIGHT_PRECISION) . " " . $this->weightUnit;
$arItem["DISCOUNT_FORMATED"] = $this->getSaleFormatCurrency($arItem["DISCOUNT_PRICE"], $arItem["CURRENCY"]);
if (CSaleBasketHelper::isSetItem($arItem)) {
$arSetParentWeight[$arItem["SET_PARENT_ID"]] += $arItem["WEIGHT"] * $arItem["QUANTITY"];
}
if (array_key_exists($arItem["PRODUCT_ID"], $arProductData) && is_array($arProductData[$arItem["PRODUCT_ID"]])) {
foreach ($arProductData[$arItem["PRODUCT_ID"]] as $key => $value) {
if (strpos($key, "PROPERTY_") !== false || in_array($key, $arImgFields)) {
$arItem[$key] = $value;
}
}
}
if (array_key_exists($arItem["PRODUCT_ID"], $arSku2Parent)) {
$arFieldsToFill = array_merge($this->arCustomSelectFields, $arImgFields);
// fields to be filled with parents' values if empty
foreach ($arFieldsToFill as $field) {
$fieldVal = in_array($field, $arImgFields) ? $field : $field . "_VALUE";
$parentId = $arSku2Parent[$arItem["PRODUCT_ID"]];
if ((!isset($arItem[$fieldVal]) || isset($arItem[$fieldVal]) && strlen($arItem[$fieldVal]) == 0) && (isset($arProductData[$parentId][$fieldVal]) && !empty($arProductData[$parentId][$fieldVal]))) {
$arItem[$fieldVal] = $arProductData[$parentId][$fieldVal];
}
}
}
foreach ($arItem as $key => $value) {
if (strpos($key, "PROPERTY_", 0) === 0 && strrpos($key, "_VALUE") == strlen($key) - 6) {
$code = str_replace(array("PROPERTY_", "_VALUE"), "", $key);
$propData = $this->arIblockProps[$code];
$arItem[$key] = CSaleHelper::getIblockPropInfo($value, $propData);
}
}
$arItem["PREVIEW_PICTURE_SRC"] = "";
if (isset($arItem["PREVIEW_PICTURE"]) && intval($arItem["PREVIEW_PICTURE"]) > 0) {
//.........这里部分代码省略.........
示例10: getBasketItems
public function getBasketItems()
{
global $APPLICATION;
$bUseCatalog = CModule::IncludeModule("catalog");
$bUseIblock = $bUseCatalog;
CSaleBasket::UpdateBasketPrices(CSaleBasket::GetBasketUserID(), SITE_ID);
$bShowReady = False;
$bShowDelay = False;
$bShowSubscribe = False;
$bShowNotAvail = False;
$allSum = 0;
$allWeight = 0;
$allCurrency = CSaleLang::GetLangCurrency(SITE_ID);
$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();
$dbItems = CSaleBasket::GetList(
array("ID" => "ASC"),
array(
"FUSER_ID" => CSaleBasket::GetBasketUserID(),
"LID" => SITE_ID,
"ORDER_ID" => "NULL"
),
false,
false,
array(
"ID", "NAME", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY",
"PRICE", "WEIGHT", "DETAIL_PAGE_URL", "NOTES", "CURRENCY", "VAT_RATE", "CATALOG_XML_ID",
"PRODUCT_XML_ID", "SUBSCRIBE", "DISCOUNT_PRICE", "PRODUCT_PROVIDER_CLASS", "TYPE", "SET_PARENT_ID"
)
);
while ($arItem = $dbItems->GetNext())
{
$arBasketItems[] = $arItem;
if (CSaleBasketHelper::isSetItem($arItem))
continue;
$arElementId[] = $arItem["PRODUCT_ID"];
if ($bUseCatalog)
{
$arParent = CCatalogSku::GetProductInfo($arItem["PRODUCT_ID"]);
if ($arParent)
{
$arElementId[] = $arParent["ID"];
$arSku2Parent[$arItem["PRODUCT_ID"]] = $arParent["ID"];
$arParents[$arItem["PRODUCT_ID"]]["PRODUCT_ID"] = $arParent["ID"];
$arParents[$arItem["PRODUCT_ID"]]["IBLOCK_ID"] = $arParent["IBLOCK_ID"];
}
}
}
// get measures, ratio, sku props data and available quantity
if (!empty($arBasketItems) && $bUseCatalog)
{
$arBasketItems = getMeasures($arBasketItems);
$arBasketItems = getRatio($arBasketItems);
$arBasketItems = $this->getAvailableQuantity($arBasketItems);
}
// get product properties data
$arProductData = getProductProps($arElementId, array_merge(array("ID"), $arImgFields, $this->arCustomSelectFields));
foreach ($arBasketItems as &$arItem)
{
$quantityIsFloat = false;
if (number_format(doubleval($arItem['QUANTITY']), 2, '.', '') != intval($arItem['QUANTITY']))
{
$quantityIsFloat = true;
}
$arItem["QUANTITY"] = ($quantityIsFloat === false && $this->quantityFloat != "Y") ? intval($arItem['QUANTITY']) : number_format(doubleval($arItem['QUANTITY']), 2, '.', '');
$arItem["PROPS"] = array();
$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())
$arItem["PROPS"][] = $arProp;
//.........这里部分代码省略.........