Пример #1
0
 } else {
     $currentTotalPriceFormat = CurrencyFormatNumber($currentTotalPrice, $arPrice["PRICE"]["CURRENCY"]);
     $summaFormated = CurrencyFormatNumber($currentPrice * $QUANTITY, $arPrice["PRICE"]["CURRENCY"]);
 }
 $urlEdit = "/bitrix/admin/iblock_element_edit.php?ID=" . $arItems["ID"] . "&type=" . $arItems["IBLOCK_TYPE_ID"] . "&lang=" . LANG . "&IBLOCK_ID=" . $arItems["IBLOCK_ID"] . "&find_section_section=" . $arItems["IBLOCK_SECTION_ID"];
 $bCanBuy = true;
 if ($arCatalogProduct["CAN_BUY_ZERO"] != "Y" && ($arCatalogProduct["QUANTITY_TRACE"] == "Y" && doubleval($arCatalogProduct["QUANTITY"]) <= 0)) {
     $bCanBuy = false;
 }
 $arStores = array();
 /** @var $productProvider IBXSaleProductProvider */
 if ($productProvider = CSaleBasket::GetProductProvider(array("MODULE" => "catalog", "PRODUCT_PROVIDER_CLASS" => "CCatalogProductProvider"))) {
     $arStores = $productProvider::GetProductStores(array("PRODUCT_ID" => $arItems["ID"]));
 }
 if ($addDefault == "Y" || $bCanBuy && $addDefault == "N") {
     $arParams = "{'id' : '" . $arItems["ID"] . "',\n\t\t\t\t'name' : '" . CUtil::JSEscape($arItems["NAME"]) . "',\n\t\t\t\t'url' : '" . CUtil::JSEscape($URL) . "',\n\t\t\t\t'urlEdit' : '" . CUtil::JSEscape($urlEdit) . "',\n\t\t\t\t'urlImg' : '" . CUtil::JSEscape($ImgUrl) . "',\n\t\t\t\t'price' : '" . CUtil::JSEscape($currentPrice) . "',\n\t\t\t\t'priceFormated' : '" . CUtil::JSEscape(CurrencyFormatNumber($currentPrice, $arPrice["PRICE"]["CURRENCY"])) . "',\n\t\t\t\t'valutaFormat' : '" . CUtil::JSEscape($priceValutaFormat) . "',\n\t\t\t\t'priceDiscount' : '" . CUtil::JSEscape($currentDiscount) . "',\n\t\t\t\t'priceBase' : '" . CUtil::JSEscape($currentBasePrice) . "',\n\t\t\t\t'priceBaseFormat' : '" . CUtil::JSEscape(CurrencyFormatNumber($currentBasePrice, $arPrice["PRICE"]["CURRENCY"])) . "',\n\t\t\t\t'discountPercent' : '" . CUtil::JSEscape($discountPercent) . "',\n\t\t\t\t'summaFormated' : '" . CUtil::JSEscape($summaFormated) . "',\n\t\t\t\t'quantity' : '" . CUtil::JSEscape($QUANTITY) . "',\n\t\t\t\t'module' : 'catalog',\n\t\t\t\t'currency' : '" . CUtil::JSEscape($arPrice["PRICE"]["CURRENCY"]) . "',\n\t\t\t\t'weight' : '" . DoubleVal($arCatalogProduct["WEIGHT"]) . "',\n\t\t\t\t'vatRate' : '" . DoubleVal($vatRate) . "',\n\t\t\t\t'priceType' : '" . CUtil::JSEscape($PriceType) . "',\n\t\t\t\t'balance' : '" . CUtil::JSEscape($balance) . "',\n\t\t\t\t'catalogXmlID' : '" . CUtil::JSEscape($arIBlock["XML_ID"]) . "',\n\t\t\t\t'productXmlID' : '" . CUtil::JSEscape($arItems["XML_ID"]) . "',\n\t\t\t\t'barcodeMulti' : '" . CUtil::JSEscape($arCatalogProduct["BARCODE_MULTI"]) . "',\n\t\t\t\t'stores' : '" . CUtil::JSEscape(CUtil::PhpToJSObject($arStores)) . "',\n\t\t\t\t'orderCallback' : '', 'cancelCallback' : '', 'payCallback' : '', 'callback' : '','productProviderClass' : 'CCatalogProductProvider'}";
     // 'callback' : 'CatalogBasketCallback',
     // 'orderCallback' : 'CatalogBasketOrderCallback',
     // 'cancelCallback' : 'CatalogBasketCancelCallback',
     // 'payCallback' : 'CatalogPayOrderCallback',
     foreach (GetModuleEvents("sale", "OnProductSearchForm", true) as $arEvent) {
         $arParams = ExecuteModuleEventEx($arEvent, array($arItems["ID"], $arParams));
     }
     $arParams = "var el" . $arItems["ID"] . " = " . $arParams;
     $act = "<script>" . $arParams . "</script><input type='button' onClick=\"SelEl(el" . $arItems["ID"] . ", " . $arItems["ID"] . ")\" name='btn_select_" . $arItems["ID"] . "' id='btn_select_" . $arItems["ID"] . "' value='" . GetMessage("SPS_SELECT") . "' >";
     $countField = "<input type=\"text\" name=\"quantity_" . $arItems["ID"] . "\" id=\"quantity_" . $arItems["ID"] . "\" value=\"1\" size=\"3\" >";
     $active = GetMEssage('SPS_PRODUCT_ACTIVE');
 } else {
     $act = GetMessage("SPS_CAN_BUY_NOT_PRODUCT");
     $countField = "&nbsp;";
     $active = GetMEssage('SPS_PRODUCT_NO_ACTIVE');
Пример #2
0
									</div>
								</td>
							</tr>
						<tr>
						<td class="title">
							<?php 
echo GetMessage("NEWO_TOTAL_PAY_ACCOUNT2");
?>
						</td>
						<td nowrap class="sum_paid" onclick="fEditSumPaid(true);">
							<span id="ORDER_PAY_FROM_ACCOUNT" style="white-space:nowrap;" onclick="fEditSumPaid(true);">
								<?
								$str_SUM_PAID = floatval($str_SUM_PAID);
								?>
								<?php 
echo CurrencyFormatNumber($str_SUM_PAID, $str_CURRENCY);
?>
							</span>

							<span id="sum_paid_edit" style="display:none">
								<input type="text"
									size="5"
									value="<?php 
echo floatval($str_SUM_PAID);
?>
"
									id="ORDER_PAY_FROM_ACCOUNT_EDIT"
									name="SUM_PAID"
									onblur="fEditSumPaid(false)"
									maxlength="9">
							</span>
Пример #3
0
function getProductDataToFillBasket($productId, $quantity, $userId, $LID, $userColumns, $tmpId = "")
{
	if (!\Bitrix\Main\Loader::includeModule("catalog"))
		return array();

	$arParams = array();

	$productId = (int)$productId;
	if ($productId <= 0)
	{
		return $arParams;
	}
	$iblockId = (int)CIBlockElement::GetIBlockByID($productId);
	if ($iblockId <= 0)
	{
		return $arParams;
	}

	$arSku2Parent = array();
	$arElementId = array();

	$arElementId[] = $productId;
	$arParent = CCatalogSku::GetProductInfo($productId, $iblockId);
	if ($arParent)
	{
		$arElementId[] = $arParent["ID"];
		$arSku2Parent[$productId] = $arParent["ID"];
	}

	$arPropertyInfo = array();
	$userColumns = (string)$userColumns;
	$arUserColumns = ($userColumns != '') ? explode(",", $userColumns) : array();
	foreach ($arUserColumns as $key => $column)
	{
		if (strncmp($column, 'PROPERTY_', 9) != 0)
		{
			unset($arUserColumns[$key]);
		}
		else
		{
			$propertyCode = substr($column, 9);
			if ($propertyCode == '')
			{
				unset($arUserColumns[$key]);
				continue;
			}
			$dbres = CIBlockProperty::GetList(array(), array("CODE" => $propertyCode));
			if ($arPropData = $dbres->GetNext())
				$arPropertyInfo[$column] = $arPropData;
		}
	}

	$arSelect = array_merge(
		array("ID", "NAME", "LID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "DETAIL_PICTURE", "PREVIEW_PICTURE", "DETAIL_PAGE_URL", "XML_ID", "IBLOCK_XML_ID"),
		$arUserColumns
	);

	$arProductData = getProductProps($arElementId, $arSelect);

	$defaultMeasure = CCatalogMeasure::getDefaultMeasure(true, true);

	if (!empty($arProductData))
	{
		$arElementInfo = array();
		foreach ($arProductData as $elemId => &$arElement)
		{
			foreach ($arElement as $key => $value)
			{
				if (strncmp($key, 'PROPERTY_', 9) == 0 && substr($key, -6) == "_VALUE")
				{
					$columnCode = str_replace("_VALUE", "", $key);
					$arElement[$key] = getIblockPropInfo($value, $arPropertyInfo[$columnCode], array("WIDTH" => 90, "HEIGHT" => 90));
				}
			}
		}
		unset($arElement);

		if (isset($arProductData[$productId]))
			$arElementInfo = $arProductData[$productId];

		if (isset( $arSku2Parent[$productId]))
			$arParent = $arProductData[$arSku2Parent[$productId]];

		if (!empty($arSku2Parent)) // if sku element doesn't have value of some property - we'll show parent element value instead
		{
			foreach ($arUserColumns as $field)
			{
				$fieldVal = $field."_VALUE";
				$parentId = $arSku2Parent[$productId];

				if ((!isset($arElementInfo[$fieldVal]) || (isset($arElementInfo[$fieldVal]) && strlen($arElementInfo[$fieldVal]) == 0))
					&& (isset($arProductData[$parentId][$fieldVal]) && !empty($arProductData[$parentId][$fieldVal]))) // can be array or string
				{
					$arElementInfo[$fieldVal] = $arProductData[$parentId][$fieldVal];
				}
			}
			if (strpos($arElementInfo["~XML_ID"], '#') === false)
			{
				$arElementInfo["~XML_ID"] = $arParent['~XML_ID'].'#'.$arElementInfo["~XML_ID"];
			}
		}

		$arElementInfo["MODULE"] = "catalog";
		$arElementInfo["PRODUCT_PROVIDER_CLASS"] = "CCatalogProductProvider";

		$arElementInfo["PRODUCT_ID"] = $arElementInfo["ID"];

		if ($arElementInfo["IBLOCK_ID"] > 0)
		{
			$arElementInfo["EDIT_PAGE_URL"] = CIBlock::GetAdminElementEditLink($arElementInfo["IBLOCK_ID"], $arElementInfo["PRODUCT_ID"], array(
				"find_section_section" => $arElementInfo["IBLOCK_SECTION_ID"],
				'WF' => 'Y',
			));
		}

		$arBuyerGroups = CUser::GetUserGroup($userId);

		// price
		$arPrice = CCatalogProduct::GetOptimalPrice($arElementInfo["ID"], 1, $arBuyerGroups, "N", array(), $LID);
		$currentPrice = $arPrice["DISCOUNT_PRICE"];
		$arElementInfo["PRICE"] = $currentPrice;
		$arElementInfo["CURRENCY"] = $arPrice["PRICE"]["CURRENCY"];
		$arElementInfo["DISCOUNT_PRICE"] = $arPrice["PRICE"]["PRICE"] - $arPrice["DISCOUNT_PRICE"];
		$currentTotalPrice = ($arElementInfo["PRICE"] + $arElementInfo["DISCOUNT_PRICE"]);
		$discountPercent = 0;
		if ($arElementInfo["DISCOUNT_PRICE"] > 0)
			$discountPercent = intval(($arElementInfo["DISCOUNT_PRICE"] * 100) / $currentTotalPrice);

		$rsProducts = CCatalogProduct::GetList(
			array(),
			array('ID' => $productId),
			false,
			false,
			array('ID', 'QUANTITY', 'WEIGHT', 'MEASURE', 'TYPE', 'BARCODE_MULTI')
		);
		if (!($arProduct = $rsProducts->Fetch()))
		{
			return array();
		}
		$balance = floatval($arProduct["QUANTITY"]);

		// sku props
		$arSkuData = array();
		$arProps[] = array(
			"NAME" => "Catalog XML_ID",
			"CODE" => "CATALOG.XML_ID",
			"VALUE" => $arElementInfo['~IBLOCK_XML_ID']
		);
		$arSkuProperty = CSaleProduct::GetProductSkuProps($productId, '', true);
		if (!empty($arSkuProperty))
		{
			foreach ($arSkuProperty as &$val)
			{
				$arSkuData[] = array(
					'NAME' => $val['NAME'],
					'VALUE' => $val['VALUE'],
					'CODE' => $val['CODE']
				);
			}
			unset($val);
		}
		$arSkuData[] = array(
			"NAME" => "Product XML_ID",
			"CODE" => "PRODUCT.XML_ID",
			"VALUE" => $arElementInfo["~XML_ID"]
		);

		// currency
		$arCurFormat = CCurrencyLang::GetCurrencyFormat($arElementInfo["CURRENCY"]);
		$priceValutaFormat = str_replace("#", "", $arCurFormat["FORMAT_STRING"]);

		$arElementInfo["WEIGHT"] = $arProduct["WEIGHT"];

		// measure
		$arElementInfo["MEASURE_TEXT"] = "";
		if ((int)$arProduct["MEASURE"] > 0)
		{
			$dbMeasure = CCatalogMeasure::GetList(array(), array("ID" => intval($arProduct["MEASURE"])), false, false, array("ID", "SYMBOL_RUS", "SYMBOL_INTL"));
			if ($arMeasure = $dbMeasure->Fetch())
				$arElementInfo["MEASURE_TEXT"] = ($arMeasure["SYMBOL_RUS"] != '' ? $arMeasure["SYMBOL_RUS"] : $arMeasure["SYMBOL_INTL"]);
		}
		if ($arElementInfo["MEASURE_TEXT"] == '')
		{
			$arElementInfo["MEASURE_TEXT"] = ($defaultMeasure["SYMBOL_RUS"] != '' ? $defaultMeasure["SYMBOL_RUS"] : $defaultMeasure["SYMBOL_INTL"]);
		}


		// ratio
		$arElementInfo["RATIO"] = 1;
		$dbratio = CCatalogMeasureRatio::GetList(array(), array("PRODUCT_ID" => $productId));
		if ($arRatio = $dbratio->Fetch())
			$arElementInfo["RATIO"] = $arRatio["RATIO"];

		// image
		if ($arElementInfo["PREVIEW_PICTURE"] > 0)
			$imgCode = $arElementInfo["PREVIEW_PICTURE"];
		elseif ($arElementInfo["DETAIL_PICTURE"] > 0)
			$imgCode = $arElementInfo["DETAIL_PICTURE"];

		if ($imgCode == "" && count($arParent) > 0)
		{
			if ($arParent["PREVIEW_PICTURE"] > 0)
				$imgCode = $arParent["PREVIEW_PICTURE"];
			elseif ($arParent["DETAIL_PICTURE"] > 0)
				$imgCode = $arParent["DETAIL_PICTURE"];
		}

		if ($imgCode > 0)
		{
			$arFile = CFile::GetFileArray($imgCode);
			$arImgProduct = CFile::ResizeImageGet($arFile, array('width'=>80, 'height'=>80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false);
			if (is_array($arImgProduct))
				$imgUrl = $arImgProduct["src"];
		}

		$arSetInfo = array();
		$arStores = array();

		/** @var $productProvider IBXSaleProductProvider */
		if ($productProvider = CSaleBasket::GetProductProvider(array("MODULE" => $arElementInfo["MODULE"], "PRODUCT_PROVIDER_CLASS" => $arElementInfo["PRODUCT_PROVIDER_CLASS"])))
		{
			// get set items if it is set
			if ($arProduct["TYPE"] == CCatalogProduct::TYPE_SET)
			{
				if (method_exists($productProvider, "GetSetItems"))
				{
					$arSets = $productProvider::GetSetItems($productId, CSaleBasket::TYPE_SET);

					if ($tmpId == "")
						$tmpId = randString(7);

					if (!empty($arSets))
					{
						foreach ($arSets as $arSetData)
						{
							foreach ($arSetData["ITEMS"] as $setItem)
							{
								$arSetItemParams = getProductDataToFillBasket($setItem["PRODUCT_ID"], $setItem["QUANTITY"], $userId, $LID, $userColumns, $tmpId); // recursive call

								// re-define some fields with set data values
								$arSetItemParams["id"] = $setItem["PRODUCT_ID"];
								$arSetItemParams["name"] = $setItem["NAME"];
								$arSetItemParams["module"] = $setItem["MODULE"];
								$arSetItemParams["productProviderClass"] = $setItem["PRODUCT_PROVIDER_CLASS"];
								$arSetItemParams["url"] = $setItem["DETAIL_PAGE_URL"];
								$arSetItemParams["quantity"] = $setItem["QUANTITY"] * $quantity;
								$arSetItemParams["barcodeMulti"] = $setItem["BARCODE_MULTI"];
								$arSetItemParams["productType"] = $setItem["TYPE"];
								$arSetItemParams["weight"] = $setItem["WEIGHT"];
								$arSetItemParams["vatRate"] = $setItem["VAT_RATE"];
								$arSetItemParams["setItems"] = "";

								$arSetItemParams["setParentId"] = $productId."_tmp".$tmpId;
								$arSetItemParams["isSetItem"] = "Y";
								$arSetItemParams["isSetParent"] = "N";

								$arSetInfo[] = $arSetItemParams;
							}
						}
					}
				}
			}

			// get stores
			$storeCount = $productProvider::GetStoresCount(array("SITE_ID" => $LID)); // with exact SITE_ID or SITE_ID = NULL

			if ($storeCount > 0)
			{
				if ($arProductStore = $productProvider::GetProductStores(array("PRODUCT_ID" => $productId, "SITE_ID" => $LID)))
					$arStores = $arProductStore;
			}
		}

		// params array
		$arParams["id"] = $productId;
		$arParams["name"] = $arElementInfo["~NAME"];
		$arParams["url"] = htmlspecialcharsex($arElementInfo["~DETAIL_PAGE_URL"]);
		$arParams["urlEdit"] = $arElementInfo["EDIT_PAGE_URL"];
		$arParams["urlImg"] = $imgUrl;
		$arParams["price"] = floatval($arElementInfo["PRICE"]);
		$arParams["priceBase"] = floatval($currentTotalPrice);
		$arParams["priceBaseFormat"] = CurrencyFormatNumber(floatval($currentTotalPrice), $arElementInfo["CURRENCY"]);
		$arParams["priceFormated"] = CurrencyFormatNumber(floatval($arElementInfo["PRICE"]), $arElementInfo["CURRENCY"]);
		$arParams["valutaFormat"] = $priceValutaFormat;
		$arParams["dimensions"] = serialize(array("WIDTH" => $arElementInfo["WIDTH"], "HEIGHT" => $arElementInfo["HEIGHT"], "LENGTH" => $arElementInfo["LENGTH"]));
		$arParams["priceDiscount"] = floatval($arElementInfo["DISCOUNT_PRICE"]);
		$arParams["priceTotalFormated"] = SaleFormatCurrency($currentTotalPrice, $arElementInfo["CURRENCY"]);
		$arParams["discountPercent"] = $discountPercent;
		$arParams["summaFormated"] = CurrencyFormatNumber($arElementInfo["PRICE"], $arElementInfo["CURRENCY"]);
		$arParams["quantity"] = $quantity;
		$arParams["module"] = $arElementInfo["MODULE"];
		$arParams["currency"] = $arElementInfo["CURRENCY"];
		$arParams["weight"] = $arElementInfo["WEIGHT"];
		$arParams["vatRate"] = $arPrice["PRICE"]["VAT_RATE"];
		$arParams["priceType"] = $arPrice["PRICE"]["CATALOG_GROUP_NAME"];
		$arParams["balance"] = $balance;
		$arParams["notes"] = (is_array($arPrice["PRICE"]) && array_key_exists("CATALOG_GROUP_NAME", $arPrice["PRICE"])) ? $arPrice["PRICE"]["CATALOG_GROUP_NAME"] : "";
		$arParams["catalogXmlID"] = $arElementInfo["~IBLOCK_XML_ID"];
		$arParams["productXmlID"] = $arElementInfo["~XML_ID"];
		$arParams["callback"] = "";
		$arParams["orderCallback"] = "";
		$arParams["cancelCallback"] = "";
		$arParams["payCallback"] = "";
		$arParams["productProviderClass"] = $arElementInfo["PRODUCT_PROVIDER_CLASS"];
		$arParams["skuProps"] = $arSkuData;
		$arParams["measureText"] = $arElementInfo["MEASURE_TEXT"];
		$arParams["ratio"] = $arElementInfo["RATIO"];
		$arParams["barcodeMulti"] = $arProduct["BARCODE_MULTI"];

		$arParams["productType"] = empty($arSetInfo) ? "" : CSaleBasket::TYPE_SET;
		$arParams["setParentId"] = empty($arSetInfo) ? "" : $productId."_tmp".$tmpId;

		$arParams["setItems"] = $arSetInfo;
		$arParams["isSetItem"] = "N";
		$arParams["isSetParent"] = empty($arSetInfo) ? "N" : "Y";

		$arParams["stores"] = empty($arSetInfo) ? $arStores : array();
		$arParams["productPropsValues"] = $arElementInfo; // along with other information also contains values of properties with correct keys (after getProductProps)
	}

	return $arParams;
}
Пример #4
0
 /**
  * get sku for product
  *
  * @param integer $USER_ID
  * @param string  $LID
  * @param integer $PRODUCT_ID
  * @param string  $PRODUCT_NAME
  * @return array
  */
 function GetProductSku($USER_ID, $LID, $PRODUCT_ID, $PRODUCT_NAME = '', $CURRENCY = '')
 {
     $USER_ID = IntVal($USER_ID);
     $PRODUCT_ID = IntVal($PRODUCT_ID);
     if ($PRODUCT_ID <= 0) {
         return false;
     }
     $LID = trim($LID);
     if (strlen($LID) <= 0) {
         return false;
     }
     $PRODUCT_NAME = trim($PRODUCT_NAME);
     $arResult = array();
     $arOffers = array();
     $arGroups = CUser::GetUserGroup($USER_ID);
     $dbProduct = CIBlockElement::GetList(array(), array("ID" => $PRODUCT_ID), false, false, array('IBLOCK_ID', 'IBLOCK_SECTION_ID', 'PREVIEW_PICTURE', 'DETAIL_PICTURE'));
     $arProduct = $dbProduct->Fetch();
     static $arOffersIblock = array();
     if (!is_set($arOffersIblock[$arProduct["IBLOCK_ID"]])) {
         $mxResult = CCatalogSKU::GetInfoByProductIBlock($arProduct["IBLOCK_ID"]);
         if (is_array($mxResult)) {
             $arOffersIblock[$arProduct["IBLOCK_ID"]] = $mxResult["IBLOCK_ID"];
         }
     }
     if ($arOffersIblock[$arProduct["IBLOCK_ID"]] > 0) {
         static $arCacheOfferProperties = array();
         if (!is_set($arCacheOfferProperties[$arOffersIblock[$arProduct["IBLOCK_ID"]]])) {
             $dbOfferProperties = CIBlock::GetProperties($arOffersIblock[$arProduct["IBLOCK_ID"]], array(), array("!XML_ID" => "CML2_LINK"));
             while ($arOfferProperties = $dbOfferProperties->Fetch()) {
                 $arCacheOfferProperties[$arOffersIblock[$arProduct["IBLOCK_ID"]]][] = $arOfferProperties;
             }
         }
         $arOfferProperties = $arCacheOfferProperties[$arOffersIblock[$arProduct["IBLOCK_ID"]]];
         $arIblockOfferProps = array();
         $arIblockOfferPropsFilter = array();
         if (is_array($arOfferProperties)) {
             foreach ($arOfferProperties as $val) {
                 $arIblockOfferProps[] = array("CODE" => $val["CODE"], "NAME" => $val["NAME"]);
                 $arIblockOfferPropsFilter[] = $val["CODE"];
             }
         }
         $arOffers = CIBlockPriceTools::GetOffersArray($arProduct["IBLOCK_ID"], $PRODUCT_ID, array("ID" => "DESC"), array("NAME"), $arIblockOfferPropsFilter, 0, array(), 1, array(), $USER_ID, $LID);
         $arSku = array();
         $minItemPrice = 0;
         $minItemPriceFormat = "";
         $arSkuId = array();
         $arImgSku = array();
         foreach ($arOffers as $arOffer) {
             $arSkuId[] = $arOffer['ID'];
         }
         if (count($arSkuId) > 0) {
             $res = CIBlockElement::GetList(array(), array("ID" => $arSkuId), false, false, array("ID", "NAME", "PREVIEW_PICTURE", "DETAIL_PICTURE", "DETAIL_PAGE_URL", "IBLOCK_TYPE_ID"));
             while ($arOfferImg = $res->Fetch()) {
                 $arImgSku[$arOfferImg["ID"]] = $arOfferImg;
             }
         }
         foreach ($arOffers as $arOffer) {
             $arPrice = CCatalogProduct::GetOptimalPrice($arOffer['ID'], 1, $arGroups, "N", array(), $LID);
             if (count($arPrice) <= 0) {
                 break;
             } elseif (strlen($CURRENCY) > 0) {
                 $arPrice["PRICE"]["PRICE"] = CCurrencyRates::ConvertCurrency($arPrice["PRICE"]["PRICE"], $arPrice["PRICE"]["CURRENCY"], $CURRENCY);
                 if ($arPrice["DISCOUNT_PRICE"] > 0) {
                     $arPrice["DISCOUNT_PRICE"] = CCurrencyRates::ConvertCurrency($arPrice["DISCOUNT_PRICE"], $arPrice["PRICE"]["CURRENCY"], $CURRENCY);
                 }
                 $arPrice["PRICE"]["CURRENCY"] = $CURRENCY;
             }
             $arSkuTmp = array();
             $arOffer["CAN_BUY"] = "N";
             if ($arCatalogProduct = CCatalogProduct::GetByID($arOffer['ID'])) {
                 if ($arCatalogProduct["CAN_BUY_ZERO"] != "Y" && ($arCatalogProduct["QUANTITY_TRACE"] == "Y" && doubleval($arCatalogProduct["QUANTITY"]) <= 0)) {
                     $arOffer["CAN_BUY"] = "N";
                 } else {
                     $arOffer["CAN_BUY"] = "Y";
                 }
             }
             $arSkuTmp["ImageUrl"] = '';
             if ($arOffer["CAN_BUY"] == "Y") {
                 $productImg = "";
                 if (isset($arImgSku[$arOffer['ID']]) && count($arImgSku[$arOffer['ID']]) > 0) {
                     if (strlen($PRODUCT_NAME) <= 0) {
                         $PRODUCT_NAME = $arImgSku[$arOffer['ID']]["NAME"];
                     }
                     if ($arImgSku[$arOffer['ID']]["PREVIEW_PICTURE"] != "") {
                         $productImg = $arImgSku[$arOffer['ID']]["PREVIEW_PICTURE"];
                     } elseif ($arImgSku[$arOffer['ID']]["DETAIL_PICTURE"] != "") {
                         $productImg = $arImgSku[$arOffer['ID']]["DETAIL_PICTURE"];
                     }
                     if ($productImg == "") {
                         if ($arProduct["PREVIEW_PICTURE"] != "") {
                             $productImg = $arProduct["PREVIEW_PICTURE"];
                         } elseif ($arProduct["DETAIL_PICTURE"] != "") {
                             $productImg = $arProduct["DETAIL_PICTURE"];
                         }
                     }
                     if ($productImg != "") {
                         $arFile = CFile::GetFileArray($productImg);
                         $productImg = CFile::ResizeImageGet($arFile, array('width' => 80, 'height' => 80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false);
                         $arSkuTmp["ImageUrl"] = $productImg["src"];
                     }
                 }
             }
             if ($minItemPrice === 0 || $arPrice["DISCOUNT_PRICE"] < $minItemPrice) {
                 $minItemPrice = $arPrice["DISCOUNT_PRICE"];
                 $minItemPriceFormat = SaleFormatCurrency($arPrice["DISCOUNT_PRICE"], $arPrice["PRICE"]["CURRENCY"]);
             }
             foreach ($arIblockOfferProps as $arCode) {
                 if (array_key_exists($arCode["CODE"], $arOffer["PROPERTIES"])) {
                     if (is_array($arOffer["PROPERTIES"][$arCode["CODE"]]["VALUE"])) {
                         $arSkuTmp[] = implode("/", $arOffer["PROPERTIES"][$arCode["CODE"]]["VALUE"]);
                     } else {
                         $arSkuTmp[] = $arOffer["PROPERTIES"][$arCode["CODE"]]["VALUE"];
                     }
                 }
             }
             $arCatalogProduct = CCatalogProduct::GetByID($arOffer['ID']);
             $arSkuTmp["BALANCE"] = FloatVal($arCatalogProduct["QUANTITY"]);
             $discountPercent = 0;
             $arSkuTmp["USER_ID"] = $USER_ID;
             $arSkuTmp["ID"] = $arOffer["ID"];
             $arSkuTmp["NAME"] = CUtil::JSEscape($arOffer["NAME"]);
             $arSkuTmp["PRODUCT_NAME"] = CUtil::JSEscape($PRODUCT_NAME);
             $arSkuTmp["PRODUCT_ID"] = $PRODUCT_ID;
             $arSkuTmp["LID"] = CUtil::JSEscape($LID);
             $arSkuTmp["MIN_PRICE"] = $minItemPriceFormat;
             $arSkuTmp["URL_EDIT"] = CUtil::JSEscape("/bitrix/admin/iblock_element_edit.php?ID=" . $PRODUCT_ID . "&type=" . $arImgSku[$arOffer['ID']]["IBLOCK_TYPE_ID"] . "&lang=" . LANG . "&IBLOCK_ID=" . $arProduct["IBLOCK_ID"] . "&find_section_section=" . $arProduct["IBLOCK_SECTION_ID"]);
             $arSkuTmp["DISCOUNT_PRICE"] = '';
             $arSkuTmp["DISCOUNT_PRICE_FORMATED"] = '';
             $arSkuTmp["PRICE"] = $arPrice["PRICE"]["PRICE"];
             $arSkuTmp["PRICE_FORMATED"] = CurrencyFormatNumber($arPrice["PRICE"]["PRICE"], $arPrice["PRICE"]["CURRENCY"]);
             $arPriceType = GetCatalogGroup($arPrice["PRICE"]["CATALOG_GROUP_ID"]);
             $arSkuTmp["PRICE_TYPE"] = $arPriceType["NAME_LANG"];
             $arSkuTmp["VAT_RATE"] = $arPrice["PRICE"]["VAT_RATE"];
             if (count($arPrice["DISCOUNT"]) > 0) {
                 $discountPercent = IntVal($arPrice["DISCOUNT"]["VALUE"]);
                 $arSkuTmp["DISCOUNT_PRICE"] = $arPrice["DISCOUNT_PRICE"];
                 $arSkuTmp["DISCOUNT_PRICE_FORMATED"] = CurrencyFormatNumber($arPrice["DISCOUNT_PRICE"], $arPrice["PRICE"]["CURRENCY"]);
             }
             $arCurFormat = CCurrencyLang::GetCurrencyFormat($arPrice["PRICE"]["CURRENCY"]);
             $arSkuTmp["VALUTA_FORMAT"] = str_replace("#", '', $arCurFormat["FORMAT_STRING"]);
             $arSkuTmp["DISCOUNT_PERCENT"] = $discountPercent;
             $arSkuTmp["CURRENCY"] = $arPrice["PRICE"]["CURRENCY"];
             $arSkuTmp["CAN_BUY"] = $arOffer["CAN_BUY"];
             $arSku[] = $arSkuTmp;
         }
         if ((!is_array($arIblockOfferProps) || empty($arIblockOfferProps)) && is_array($arSku) && !empty($arSku)) {
             $arIblockOfferProps[0] = array("CODE" => "TITLE", "NAME" => GetMessage("SKU_TITLE"));
             foreach ($arSku as $key => $val) {
                 $arSku[$key][0] = $val["NAME"];
             }
         }
         $arResult["SKU_ELEMENTS"] = $arSku;
         $arResult["SKU_PROPERTIES"] = $arIblockOfferProps;
         $arResult["OFFERS_IBLOCK_ID"] = $arOffersIblock[$arProduct["IBLOCK_ID"]];
     }
     //if OFFERS_IBLOCK_ID > 0
     return $arResult;
 }
Пример #5
0
echo 'Y' == $arItem["CUSTOM_PRICE"] ? GetMessage("SOD_BASE_CATALOG_PRICE") : $arItem["NOTES"];
?>
												</div>
										</td>
										<?
									}

									if ($columnCode == "COLUMN_SUM")
									{
										?>
										<td class="COLUMN_SUM" nowrap>
											<?
											if (!CSaleBasketHelper::isSetItem($arItem)):
											?>
												<div><?php 
echo CurrencyFormatNumber($arItem["QUANTITY"] * $arItem["PRICE"], $arItem["CURRENCY"]);
?>
 <span><?php 
echo $CURRENCY_FORMAT;
?>
</span></div>
											<?
											endif;
											?>
										</td>
										<?
									}

									if (substr($columnCode, 0, 9) == "PROPERTY_")
									{
										?>
Пример #6
0
 if ($productImg != "") {
     $arFile = CFile::GetFileArray($productImg);
     $productImg = CFile::ResizeImageGet($arFile, array('width' => 80, 'height' => 80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false);
     $ImgUrl = $productImg["src"];
 }
 $arPrice = CCatalogProduct::GetOptimalPrice($arItems["ID"], 1, $arBuyerGroups, "N", array(), $LID);
 $arCurFormat = CCurrencyLang::GetCurrencyFormat($arPrice["PRICE"]["CURRENCY"]);
 $priceValutaFormat = str_replace("#", '', $arCurFormat["FORMAT_STRING"]);
 if (!is_array($arPrice["DISCOUNT"]) || count($arPrice["DISCOUNT"]) <= 0) {
     $arPrice["DISCOUNT_PRICE"] = 0;
     $price = $arPrice["PRICE"]["PRICE"];
 } else {
     $price = $arPrice["DISCOUNT_PRICE"];
 }
 $summaFormated = CurrencyFormatNumber($price, $arPrice["PRICE"]["CURRENCY"]);
 $currentTotalPriceFormat = CurrencyFormatNumber($price, $arPrice["PRICE"]["CURRENCY"]);
 $balance = 0;
 $weight = 0;
 if ($ar_res = CCatalogProduct::GetByID($arItems["ID"])) {
     $balance = FloatVal($ar_res["QUANTITY"]);
     $weight = FloatVal($ar_res["WEIGHT"]);
 }
 $discountPercent = 0;
 if ($arPrice["DISCOUNT_PRICE"] > 0) {
     $discountPercent = ($arPrice["PRICE"]["PRICE"] - $arPrice["DISCOUNT_PRICE"]) * 100 / $arPrice["PRICE"]["PRICE"];
     $discountPercent = roundEx($discountPercent, SALE_VALUE_PRECISION);
     $priceDiscount = $arPrice["PRICE"]["PRICE"] - $arPrice["DISCOUNT_PRICE"];
 }
 $urlEdit = "/bitrix/admin/iblock_element_edit.php?ID=" . $arItems["ID"] . "&type=" . $arItems["IBLOCK_TYPE_ID"] . "&lang=" . LANG . "&IBLOCK_ID=" . $arItems["IBLOCK_ID"] . "&find_section_section=" . IntVal($arItems["IBLOCK_SECTION_ID"]);
 $arParams = array('id' => $arItems["ID"], 'name' => CUtil::JSEscape($arItems["NAME"]), 'url' => CUtil::JSEscape($arItems["DETAIL_PAGE_URL"]), 'urlImg' => CUtil::JSEscape($ImgUrl), 'urlEdit' => CUtil::JSEscape($urlEdit), 'price' => CUtil::JSEscape($price), 'priceFormated' => CUtil::JSEscape($price), 'priceBase' => CUtil::JSEscape($arPrice["PRICE"]["PRICE"]), 'priceBaseFormat' => CUtil::JSEscape($arPrice["PRICE"]["PRICE"]), 'valutaFormat' => CUtil::JSEscape($priceValutaFormat), 'priceDiscount' => CUtil::JSEscape($priceDiscount), 'summaFormated' => CUtil::JSEscape($summaFormated), 'priceTotalFormated' => CUtil::JSEscape($currentTotalPriceFormat), 'discountPercent' => CUtil::JSEscape($discountPercent), 'balance' => CUtil::JSEscape($balance), 'quantity' => floatval($arGetProduct[$arItems["ID"]]), 'module' => 'catalog', 'currency' => CUtil::JSEscape($arPrice["PRICE"]["CURRENCY"]), 'weight' => $weight, 'vatRate' => DoubleVal('0'), 'priceType' => '', 'catalogXmlID' => '', 'productXmlID' => '', 'skuProps' => CUtil::PhpToJSObject($arSkuProps), 'productProviderClass' => 'CCatalogProductProvider');
 $arParams = CUtil::PhpToJSObject($arParams);
Пример #7
0
	{
		$contractorTitle = '';
		if(0 < intval($arRes['CONTRACTOR_ID']))
		{
			$contractorTitle = '<a href="/bitrix/admin/cat_contractor_edit.php?lang='.LANGUAGE_ID.'&ID='.$arRes['CONTRACTOR_ID'].'">'.htmlspecialcharsbx(getContractorTitle($arRes['CONTRACTOR_ID'])).'</a>';
		}
		$row->AddViewField("CONTRACTOR_ID", $contractorTitle);
	}
	if($arSelectFieldsMap['SITE_ID'])
	{
		$row->AddViewField("SITE_ID", getSiteTitle($arRes['SITE_ID']));
	}

	if($arSelectFieldsMap['TOTAL'])
	{
			$f_TOTAL = ($arRes['CURRENCY']) ? CurrencyFormatNumber(doubleval($arRes['TOTAL']), $arRes['CURRENCY']) : '';

		$row->AddViewField("TOTAL", $f_TOTAL);
	}

	if($arSelectFieldsMap['COMMENTARY'])
	{
		$row->AddViewField("COMMENTARY", htmlspecialcharsbx($arRes["COMMENTARY"]));
	}


	$arActions = array();

	$arActions[] = array("ICON"=>"edit", "TEXT"=>GetMessage("CAT_DOC_".$strForAction), "ACTION"=>$lAdmin->ActionRedirect("cat_store_document_edit.php?ID=".$arRes['ID']."&lang=".LANGUAGE_ID/*."&".GetFilterParams("filter_").""*/), "DEFAULT"=>true);

	if(!$bReadOnly && $bAllowForEdit)
Пример #8
0
function fGetFormatedProduct($USER_ID, $LID, $arData, $currency, $type = '')
{
    global $crmMode;
    $result = "";
    if (!is_array($arData["ITEMS"]) || count($arData["ITEMS"]) <= 0) {
        return $result;
    }
    $result = "<table width=\"100%\">";
    if (CModule::IncludeModule('catalog') && CModule::IncludeModule('iblock')) {
        $arProductId = array();
        $arDataTab = array();
        $arSkuParentChildren = array();
        $arSkuParentId = array();
        $arSkuParent = array();
        foreach ($arData["ITEMS"] as $items) {
            if ($items["MODULE"] == "catalog") {
                $arProductId[$items["PRODUCT_ID"]] = $items["PRODUCT_ID"];
                $arDataTab[$items["PRODUCT_ID"]] = $items;
                $arParent = CCatalogSku::GetProductInfo($items["PRODUCT_ID"]);
                if ($arParent) {
                    $arSkuParentChildren[$items["PRODUCT_ID"]] = $arParent["ID"];
                    $arSkuParentId[$arParent["ID"]] = $arParent["ID"];
                }
            }
        }
        $res = CIBlockElement::GetList(array(), array("ID" => $arSkuParentId), false, false, array("ID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "PREVIEW_PICTURE", "DETAIL_PICTURE", "NAME", "DETAIL_PAGE_URL"));
        while ($arItems = $res->GetNext()) {
            $arSkuParent[$arItems["ID"]] = $arItems;
        }
        $dbProduct = CIBlockElement::GetList(array(), array("ID" => $arProductId), false, false, array('ID', 'IBLOCK_ID', 'IBLOCK_SECTION_ID', 'DETAIL_PICTURE', 'PREVIEW_PICTURE', 'IBLOCK_TYPE_ID'));
        while ($arProduct = $dbProduct->Fetch()) {
            $imgCode = 0;
            $arDataTab[$arProduct['ID']]['IBLOCK_ID'] = $arProduct['IBLOCK_ID'];
            $arDataTab[$arProduct['ID']]['IBLOCK_SECTION_ID'] = $arProduct['IBLOCK_SECTION_ID'];
            $arDataTab[$arProduct['ID']]['DETAIL_PICTURE'] = $arProduct['DETAIL_PICTURE'];
            $arDataTab[$arProduct['ID']]['PREVIEW_PICTURE'] = $arProduct['PREVIEW_PICTURE'];
            $arDataTab[$arProduct['ID']]['IBLOCK_TYPE_ID'] = $arProduct['IBLOCK_TYPE_ID'];
            $items = $arDataTab[$arProduct['ID']];
            if ($items["PREVIEW_PICTURE"] == "" && $items["DETAIL_PICTURE"] == "" && is_set($arSkuParentChildren[$items["PRODUCT_ID"]])) {
                $idTmp = $arSkuParentChildren[$items["PRODUCT_ID"]];
                $items["DETAIL_PICTURE"] = $arSkuParent[$idTmp]["DETAIL_PICTURE"];
                $items["PREVIEW_PICTURE"] = $arSkuParent[$idTmp]["PREVIEW_PICTURE"];
            }
            if ($items["DETAIL_PICTURE"] > 0) {
                $imgCode = $items["DETAIL_PICTURE"];
            } elseif ($items["PREVIEW_PICTURE"] > 0) {
                $imgCode = $items["PREVIEW_PICTURE"];
            }
            $arSkuProperty = CSaleProduct::GetProductSkuProps($items["PRODUCT_ID"]);
            $items["NAME"] = htmlspecialcharsex($items["NAME"]);
            $items["EDIT_PAGE_URL"] = htmlspecialcharsex($items["EDIT_PAGE_URL"]);
            $items["CURRENCY"] = htmlspecialcharsex($items["CURRENCY"]);
            if ($imgCode > 0) {
                $arFile = CFile::GetFileArray($imgCode);
                $arImgProduct = CFile::ResizeImageGet($arFile, array('width' => 80, 'height' => 80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false);
            }
            if (is_array($arImgProduct)) {
                $imgUrl = $arImgProduct["src"];
                $imgProduct = "<a href=\"" . $items["EDIT_PAGE_URL"] . "\" target=\"_blank\"><img src=\"" . $imgUrl . "\" alt=\"\" title=\"" . $items["NAME"] . "\" ></a>";
            } else {
                $imgProduct = "<div class='no_foto'>" . GetMessage('NO_FOTO') . "</div>";
            }
            $arCurFormat = CCurrencyLang::GetCurrencyFormat($items["CURRENCY"]);
            $priceValutaFormat = str_replace("#", '', $arCurFormat["FORMAT_STRING"]);
            $currentTotalPrice = $items["PRICE"] + $items["DISCOUNT_PRICE"];
            $discountPercent = 0;
            if ($items["DISCOUNT_PRICE"] > 0) {
                $discountPercent = IntVal($items["DISCOUNT_PRICE"] * 100 / $currentTotalPrice);
            }
            $ar_res = CCatalogProduct::GetByID($items["PRODUCT_ID"]);
            $balance = FloatVal($ar_res["QUANTITY"]);
            $arParams = array();
            $arParams["id"] = $items["PRODUCT_ID"];
            $arParams["name"] = $items["NAME"];
            $arParams["url"] = $items["DETAIL_PAGE_URL"];
            $arParams["urlEdit"] = $items["EDIT_PAGE_URL"];
            $arParams["urlImg"] = $imgUrl;
            $arParams["price"] = FloatVal($items["PRICE"]);
            $arParams["priceBase"] = FloatVal($currentTotalPrice);
            $arParams["priceBaseFormat"] = CurrencyFormatNumber(FloatVal($currentTotalPrice), $items["CURRENCY"]);
            $arParams["priceFormated"] = CurrencyFormatNumber(FloatVal($items["PRICE"]), $items["CURRENCY"]);
            $arParams["valutaFormat"] = $priceValutaFormat;
            $arParams["priceDiscount"] = FloatVal($items["DISCOUNT_PRICE"]);
            $arParams["priceTotalFormated"] = SaleFormatCurrency($currentTotalPrice, $items["CURRENCY"]);
            $arParams["discountPercent"] = $discountPercent;
            $arParams["summaFormated"] = CurrencyFormatNumber($items["PRICE"], $items["CURRENCY"]);
            $arParams["quantity"] = 1;
            $arParams["module"] = $items["MODULE"];
            $arParams["currency"] = $items["CURRENCY"];
            $arParams["weight"] = 0;
            $arParams["vatRate"] = 0;
            $arParams["priceType"] = "";
            $arParams["balance"] = $balance;
            $arParams['skuProps'] = CUtil::PhpToJSObject($arSkuProperty);
            $arParams["catalogXmlID"] = "";
            $arParams["productXmlID"] = "";
            $arParams["callback"] = "CatalogBasketCallback";
            $arParams["orderCallback"] = "CatalogBasketOrderCallback";
            $arParams["cancelCallback"] = "CatalogBasketCancelCallback";
            $arParams["payCallback"] = "CatalogPayOrderCallback";
            $result .= "<tr id='more_" . $type . "_" . $items["ID"] . "'>\n\t\t\t\t\t\t\t<td class=\"tab_img\" >" . $imgProduct . "</td>\n\t\t\t\t\t\t\t<td class=\"tab_text\">\n\t\t\t\t\t\t\t\t<div class=\"order_name\"><a href=\"" . $items["EDIT_PAGE_URL"] . "\" target=\"_blank\" title=\"" . $items["NAME"] . "\">" . $items["NAME"] . "</a></div>\n\t\t\t\t\t\t\t\t<div class=\"order_price\">\n\t\t\t\t\t\t\t\t\t" . GetMessage('NEWO_SUBTAB_PRICE') . ": <b>" . SaleFormatCurrency($items["PRICE"], $currency) . "</b>\n\t\t\t\t\t\t\t\t</div>";
            $arResult = CSaleProduct::GetProductSku($USER_ID, $LID, $items["PRODUCT_ID"], $items["NAME"]);
            if (count($arResult["SKU_ELEMENTS"]) > 0) {
                foreach ($arResult["SKU_ELEMENTS"] as $key => $val) {
                    $arTmp = array();
                    foreach ($val as $k => $v) {
                        if (is_numeric($k)) {
                            $arTmp[$arResult["SKU_PROPERTIES"][$k]["NAME"]] = $v;
                        }
                    }
                    $arResult["SKU_ELEMENTS"][$key]["SKU_PROPS"] = CUtil::PhpToJSObject($arTmp);
                }
            }
            $arResult["POPUP_MESSAGE"] = array("PRODUCT_ADD" => GetMEssage('NEWO_POPUP_TO_BUSKET'), "PRODUCT_ORDER" => GetMEssage('NEWO_POPUP_TO_ORDER'), "PRODUCT_NOT_ADD" => GetMEssage('NEWO_POPUP_DONT_CAN_BUY'), "PRODUCT_PRICE_FROM" => GetMessage('NEWO_POPUP_FROM'));
            if (count($arResult["SKU_ELEMENTS"]) <= 0) {
                $result .= "<a href=\"javascript:void(0);\" class=\"get_new_order\" onClick=\"fAddToBusketMoreProduct('" . $type . "', " . CUtil::PhpToJSObject($arParams) . ");return false;\"><span></span>" . GetMessage('NEWO_SUBTAB_ADD_BUSKET') . "</a><br>";
            } else {
                $result .= "<a href=\"javascript:void(0);\" class=\"get_new_order\" onClick=\"fAddToBusketMoreProductSku(" . CUtil::PhpToJsObject($arResult['SKU_ELEMENTS']) . ", " . CUtil::PhpToJsObject($arResult['SKU_PROPERTIES']) . ", 'busket', " . CUtil::PhpToJsObject($arResult["POPUP_MESSAGE"]) . ");\"><span></span>" . GetMessage('NEWO_SUBTAB_ADD_BUSKET') . "</a><br>";
            }
            if (!$crmMode) {
                if (count($arResult["SKU_ELEMENTS"]) > 0) {
                    $result .= "<a href=\"javascript:void(0);\" class=\"get_new_order\" onClick=\"fAddToBusketMoreProductSku(" . CUtil::PhpToJsObject($arResult['SKU_ELEMENTS']) . ", " . CUtil::PhpToJsObject($arResult['SKU_PROPERTIES']) . ", 'neworder', " . CUtil::PhpToJsObject($arResult["POPUP_MESSAGE"]) . ");\"><span></span>" . GetMessage('NEWO_SUBTAB_ADD_ORDER') . "</a>";
                } else {
                    $cntProd = floatval($items["QUANTITY"]) > 0 ? floatval($items["QUANTITY"]) : 1;
                    $url = "/bitrix/admin/sale_order_new.php?lang=" . LANG . "&user_id=" . $USER_ID . "&LID=" . $LID . "&product[" . $items["PRODUCT_ID"] . "]=" . $cntProd;
                    $result .= "<a href=\"" . $url . "\" target=\"_blank\" class=\"get_new_order\"><span></span>" . GetMessage('NEWO_SUBTAB_ADD_ORDER') . "</a>";
                }
            }
            $result .= "</td></tr>";
        }
        //end foreach
    }
    //end if
    if ($arData["CNT"] > 2 && $arData["CNT"] != count($arData["ITEMS"])) {
        $result .= "<tr><td colspan='2' align='right' class=\"more_product\">";
        if ($type == "busket") {
            $result .= "<a href='javascript:void(0);' onClick='fGetMoreBusket(\"Y\");' class=\"get_more\">" . GetMessage('NEWO_SUBTAB_MORE') . "<span></span></a>";
        } elseif ($type == "viewed") {
            $result .= "<a href='javascript:void(0);' onClick='fGetMoreViewed(\"Y\");' class=\"get_more\">" . GetMessage('NEWO_SUBTAB_MORE') . "<span></span></a>";
        } else {
            $result .= "<a href='javascript:void(0);' onClick='fGetMoreRecom();' class=\"get_more\">" . GetMessage('NEWO_SUBTAB_MORE') . "<span></span></a>";
        }
        $result .= "</td></tr>";
    }
    $result .= "</table>";
    return $result;
}
Пример #9
0
    $arBasket["PROPS"] = array();
    $dbBasketProps = CSaleBasket::GetPropsList(array("BASKET_ID" => "ASC", "SORT" => "ASC", "NAME" => "ASC"), array("BASKET_ID" => $arBasket["ID"]), false, false, array("ID", "BASKET_ID", "NAME", "VALUE", "CODE", "SORT"));
    while ($arBasketProps = $dbBasketProps->GetNext()) {
        $arBasket["PROPS"][$arBasketProps["ID"]] = $arBasketProps;
    }
    $arResult["BASKET"][$arBasket["ID"]] = $arBasket;
    $arResult["BASKET"][$arBasket["ID"]]["BALANCE"] = "0";
    $arCurFormat = CCurrencyLang::GetCurrencyFormat($arBasket["CURRENCY"]);
    $CURRENCY_FORMAT = trim(str_replace("#", '', $arCurFormat["FORMAT_STRING"]));
    $priceDiscount = $priceBase = $arBasket["DISCOUNT_PRICE"] + $arBasket["PRICE"];
    if (DoubleVal($priceBase) > 0) {
        $priceDiscount = roundEx($arBasket["DISCOUNT_PRICE"] * 100 / $priceBase, SALE_VALUE_PRECISION);
    }
    $arResult["BASKET"][$arBasket["ID"]]["PRICE_STRING"] = CurrencyFormatNumber($arBasket["PRICE"], $arBasket["CURRENCY"]) . " " . $CURRENCY_FORMAT;
    if ($arBasket["DISCOUNT_PRICE"] > 0) {
        $arResult["BASKET"][$arBasket["ID"]]["OLD_PRICE_STRING"] = CurrencyFormatNumber($priceBase, $arBasket["CURRENCY"]) . " " . $CURRENCY_FORMAT;
        $arResult["BASKET"][$arBasket["ID"]]["DISCOUNT_STRING"] = $priceDiscount . "%";
    }
    $weight += $arBasket["WEIGHT"] * $arBasket["QUANTITY"];
    $price += $arBasket["PRICE"] * $arBasket["QUANTITY"];
    $price_total += ($arBasket["PRICE"] + $arBasket["DISCOUNT_PRICE"]) * $arBasket["QUANTITY"];
}
$arResult["WEIGHT"] = $weight;
$arResult["PRICE"] = $price;
$arResult["PRICE_TOTAL"] = $price_total;
$rsProductsInfo = CIBlockElement::GetList(array(), array("ID" => $arProdIds), false, false, array("ID", "PREVIEW_PICTURE", "DETAIL_PICTURE", "NAME"));
while ($arProductInfo = $rsProductsInfo->GetNext()) {
    $arResult["BASKET"][$arProdIdsPrIds[$arProductInfo["ID"]]]["INFO"] = $arProductInfo;
}
if (CModule::IncludeModule('catalog')) {
    $rsCatProd = CCatalogProduct::GetList(array(), array("ID" => $arProdIds), false, false, array("ID", "QUANTITY"));
 $strModifiedBy = '';
 $f_CREATED_BY = intval($f_CREATED_BY);
 if ($f_CREATED_BY > 0) {
     if (!array_key_exists($f_CREATED_BY, $arUserList)) {
         $rsUsers = CUser::GetList($_REQUEST["by2"] = 'ID', $_REQUEST["order2"] = 'ASC', array('ID_EQUAL_EXACT' => $f_CREATED_BY), array('FIELDS' => array('ID', 'LOGIN', 'NAME', 'LAST_NAME')));
         if ($arOneUser = $rsUsers->Fetch()) {
             $arOneUser['ID'] = intval($arOneUser['ID']);
             $arUserList[$arOneUser['ID']] = CUser::FormatName($strNameFormat, $arOneUser);
         }
     }
     if (isset($arUserList[$f_CREATED_BY])) {
         $strCreatedBy = '<a href="/bitrix/admin/user_edit.php?lang=' . LANGUAGE_ID . '&ID=' . $f_CREATED_BY . '">' . $arUserList[$f_CREATED_BY] . '</a>';
     }
 }
 if (is_callable("CurrencyFormatNumber")) {
     $f_TOTAL = $f_CURRENCY ? CurrencyFormatNumber(doubleval($f_TOTAL), $f_CURRENCY) : '';
 }
 $row->AddViewField("DOC_TYPE", $f_DOC_TYPE);
 $row->AddViewField("STATUS", $f_STATUS);
 $row->AddViewField("DATE_CREATE", $f_DATE_CREATE);
 $row->AddViewField("CREATED_BY", $strCreatedBy);
 $row->AddViewField("CONTRACTOR_ID", $contractorTitle);
 $row->AddViewField("SITE_ID", $f_SITE_ID);
 $row->AddViewField("TOTAL", $f_TOTAL);
 $arActions = array();
 $arActions[] = array("ICON" => "edit", "TEXT" => GetMessage("CAT_DOC_" . $strForAction), "ACTION" => $lAdmin->ActionRedirect("cat_store_document_edit.php?ID=" . $f_ID . "&lang=" . LANG), "DEFAULT" => true);
 if (!$bReadOnly && $bAllowForEdit) {
     $arActions[] = array("ICON" => "pack", "TEXT" => GetMessage("CAT_DOC_CONDUCT"), "ACTION" => $lAdmin->ActionDoGroup($f_ID, "conduct"));
     $arActions[] = array("SEPARATOR" => true);
     $arActions[] = array("ICON" => "delete", "TEXT" => GetMessage("CAT_DOC_DELETE"), "ACTION" => "if(confirm('" . GetMessage('CAT_DOC_DELETE_CONFIRM') . "')) " . $lAdmin->ActionDoGroup($f_ID, "delete"));
 } elseif (!$bAllowForEdit) {
 if ($currentDiscount > 0) {
     $discountPercent = roundEx($currentDiscount * 100 / $currentTotalPrice, SALE_VALUE_PRECISION);
 }
 if (CModule::IncludeModule('sale')) {
     if (strlen($BASE_LANG_CURR) > 0 && $BASE_LANG_CURR != $arPrice["PRICE"]["CURRENCY"]) {
         $currentTotalPrice = roundEx(CCurrencyRates::ConvertCurrency($currentTotalPrice, $arPrice["PRICE"]["CURRENCY"], $BASE_LANG_CURR), SALE_VALUE_PRECISION);
         $currentPrice = roundEx(CCurrencyRates::ConvertCurrency($currentPrice, $arPrice["PRICE"]["CURRENCY"], $BASE_LANG_CURR), SALE_VALUE_PRECISION);
         $currentBasePrice = roundEx(CCurrencyRates::ConvertCurrency($currentBasePrice, $arPrice["PRICE"]["CURRENCY"], $BASE_LANG_CURR), SALE_VALUE_PRECISION);
         $currentDiscount = roundEx(CCurrencyRates::ConvertCurrency($currentDiscount, $arPrice["PRICE"]["CURRENCY"], $BASE_LANG_CURR), SALE_VALUE_PRECISION);
         $arPrice["PRICE"]["CURRENCY"] = $BASE_LANG_CURR;
     }
     $currentTotalPriceFormat = CurrencyFormatNumber($currentTotalPrice, $arPrice["PRICE"]["CURRENCY"]);
     $summaFormated = CurrencyFormatNumber($currentPrice * $QUANTITY, $arPrice["PRICE"]["CURRENCY"]);
 } else {
     $currentTotalPriceFormat = CurrencyFormatNumber($currentTotalPrice, $arPrice["PRICE"]["CURRENCY"]);
     $summaFormated = CurrencyFormatNumber($currentPrice * $QUANTITY, $arPrice["PRICE"]["CURRENCY"]);
 }
 $urlEdit = CIBlock::GetAdminElementEditLink($arItems["IBLOCK_ID"], $arItems["ID"], array("find_section_section" => $arItems["IBLOCK_SECTION_ID"]));
 $bCanBuy = true;
 if ($arCatalogProduct["CAN_BUY_ZERO"] != "Y" && ($arCatalogProduct["QUANTITY_TRACE"] == "Y" && doubleval($arCatalogProduct["QUANTITY"]) <= 0)) {
     $bCanBuy = false;
 }
 if ($addDefault == "Y" || $bCanBuy && $addDefault == "N") {
     $arParams = "{'id' : '" . $arItems["ID"] . "',\n\t\t\t\t'name' : '" . CUtil::JSEscape($arItems["NAME"]) . "',\n\t\t\t\t'url' : '" . CUtil::JSEscape($URL) . "',\n\t\t\t\t'urlEdit' : '" . CUtil::JSEscape($urlEdit) . "',\n\t\t\t\t'urlImg' : '" . CUtil::JSEscape($ImgUrl) . "',\n\t\t\t\t'price' : '" . CUtil::JSEscape($currentPrice) . "',\n\t\t\t\t'summaFormated' : '" . CUtil::JSEscape(0) . "',\n\t\t\t\t'quantity' : '" . CUtil::JSEscape($QUANTITY) . "',\n\t\t\t\t'reserved' : '" . CUtil::JSEscape($arCatalogProduct["QUANTITY_RESERVED"]) . "',\n\t\t\t\t'module' : 'catalog',\n\t\t\t\t'currency' : '" . CUtil::JSEscape('') . "',\n\t\t\t\t'weight' : '" . DoubleVal($arCatalogProduct["WEIGHT"]) . "',\n\t\t\t\t'vatRate' : '" . DoubleVal($vatRate) . "',\n\t\t\t\t'priceType' : '" . CUtil::JSEscape($PriceType) . "',\n\t\t\t\t'balance' : '" . CUtil::JSEscape('-') . "',\n\t\t\t\t'catalogXmlID' : '" . CUtil::JSEscape($arIBlock["XML_ID"]) . "',\n\t\t\t\t'productXmlID' : '" . CUtil::JSEscape($arItems["XML_ID"]) . "',\n\t\t\t\t'callback' : 'CatalogBasketCallback',\n\t\t\t\t'orderCallback' : 'CatalogBasketOrderCallback',\n\t\t\t\t'cancelCallback' : 'CatalogBasketCancelCallback',\n\t\t\t\t'isMultiBarcode' : '" . CUtil::JSEscape($arCatalogProduct["BARCODE_MULTI"]) . "',\n\t\t\t\t'barcode' : '" . CUtil::JSEscape($arCatalogProduct["BARCODE"]) . "',\n\t\t\t\t'payCallback' : 'CatalogPayOrderCallback'}";
     foreach (GetModuleEvents("sale", "OnProductSearchForm", true) as $arEvent) {
         $arParams = ExecuteModuleEventEx($arEvent, array($arItems["ID"], $arParams));
     }
     $arParams = "var el" . $arItems["ID"] . " = " . $arParams;
     $act = "<script type=\"text/javascript\">" . $arParams . "</script><input type='button' onClick=\"SelEl(el" . $arItems["ID"] . ", " . $arItems["ID"] . ")\" name='btn_select_" . $arItems["ID"] . "' id='btn_select_" . $arItems["ID"] . "' value='" . GetMessage("SPS_SELECT") . "' >";
     $countField = "<input type=\"text\" name=\"quantity_" . $arItems["ID"] . "\" id=\"quantity_" . $arItems["ID"] . "\" value=\"1\" size=\"3\" >";
     $active = GetMEssage('SPS_PRODUCT_ACTIVE');