protected function loadFromDatabase() { if (!isset($this->fields)) { $pricesList = \CPrice::getListEx(array(), array("=PRODUCT_ID" => $this->id, "+<=QUANTITY_FROM" => 1, "+>=QUANTITY_TO" => 1), false, false, array("PRICE", "CURRENCY", "CATALOG_GROUP_ID", "CATALOG_GROUP_CODE")); $this->fields = array(); while ($priceInfo = $pricesList->fetch()) { $price_id = $priceInfo["CATALOG_GROUP_ID"]; $price = \FormatCurrency($priceInfo["PRICE"], $priceInfo["CURRENCY"]); $this->addField($price_id, $price_id, $price); $this->addField($priceInfo["CATALOG_GROUP_CODE"], $price_id, $price); } } return is_array($this->fields); }
$bCanBuy = True; } if ($bCanBuy) { $PRICE_ID = $arPrice[$ii]["ID"]; } ?> <tr> <td colspan="2"><img src="/images/1.gif" alt="" width="1" height="1"></td> </tr> <tr> <td><font class="text"><b><?php echo $arPrice[$ii]["CATALOG_GROUP_NAME"]; ?> :</b></font></td> <td align="left"><font class="text"> <?php echo FormatCurrency($arPrice[$ii]["PRICE"], $arPrice[$ii]["CURRENCY"]); ?> </font></td> </tr> <tr> <td colspan="2"><img src="/images/1.gif" alt="" width="1" height="1"></td> </tr> <?php } } ?> </table> <table border="0" class="tablebody" cellSpacing="1" width="100%" cellPadding="0"> <?php // If current user can buy this product if ($bCanBuy && CModule::IncludeModule("sale")) {
$arFilter = array("name" => "sharpen", "precision" => $arParams["SHARPEN"]); } $arFileTmp = CFile::ResizeImageGet($arResult['DETAIL_PICTURE'], array("width" => $arParams["DISPLAY_DETAIL_IMG_WIDTH"], "height" => $arParams["DISPLAY_DETAIL_IMG_HEIGHT"]), BX_RESIZE_IMAGE_PROPORTIONAL, true, $arFilter); $arResult['DETAIL_PICTURE_280'] = array('SRC' => $arFileTmp["src"], 'WIDTH' => $arFileTmp["width"], 'HEIGHT' => $arFileTmp["height"]); } if (is_array($arResult['MORE_PHOTO']) && count($arResult['MORE_PHOTO']) > 0) { unset($arResult['DISPLAY_PROPERTIES']['MORE_PHOTO']); foreach ($arResult['MORE_PHOTO'] as $key => $arFile) { $arFilter = ''; if ($arParams["SHARPEN"] != 0) { $arFilter = array("name" => "sharpen", "precision" => $arParams["SHARPEN"]); } $arFileTmp = CFile::ResizeImageGet($arFile, array("width" => $arParams["DISPLAY_MORE_PHOTO_WIDTH"], "height" => $arParams["DISPLAY_MORE_PHOTO_HEIGHT"]), BX_RESIZE_IMAGE_PROPORTIONAL, true, $arFilter); $arFile['PREVIEW_WIDTH'] = $arFileTmp["width"]; $arFile['PREVIEW_HEIGHT'] = $arFileTmp["height"]; $arFile['SRC'] = $arFileTmp['src']; $arResult['MORE_PHOTO'][$key] = $arFile; } } if (CModule::IncludeModule('currency')) { if (isset($arResult['DISPLAY_PROPERTIES']['MINIMUM_PRICE'])) { $arResult['DISPLAY_PROPERTIES']['MINIMUM_PRICE']['DISPLAY_VALUE'] = FormatCurrency($arResult['DISPLAY_PROPERTIES']['MINIMUM_PRICE']['VALUE'], CCurrency::GetBaseCurrency()); } if (isset($arResult['DISPLAY_PROPERTIES']['MAXIMUM_PRICE'])) { $arResult['DISPLAY_PROPERTIES']['MAXIMUM_PRICE']['DISPLAY_VALUE'] = FormatCurrency($arResult['DISPLAY_PROPERTIES']['MAXIMUM_PRICE']['VALUE'], CCurrency::GetBaseCurrency()); } } $this->__component->SetResultCacheKeys(array("DISPLAY_PROPERTIES")); $this->__component->SetResultCacheKeys(array("DETAIL_TEXT")); $this->__component->SetResultCacheKeys(array("CAN_BUY")); //$this->__component->SetResultCacheKeys(array("OFFERS_IDS"));
?> </td> <td align="left"><?php echo htmlspecialcharsbx($arProductDiscounts["NAME"]); ?> </td> <td align="right"> <?php if ($arProductDiscounts["VALUE_TYPE"] == "P") { echo $arProductDiscounts["VALUE"] . "%"; } elseif ($arProductDiscounts["VALUE_TYPE"] == "S") { ?> = <?php echo FormatCurrency($arProductDiscounts["VALUE"], $arProductDiscounts["CURRENCY"]); } else { echo FormatCurrency($arProductDiscounts["VALUE"], $arProductDiscounts["CURRENCY"]); } ?> </td> <?php if ($bDiscount) { ?> <td align="left"> <a href="/bitrix/admin/cat_discount_edit.php?ID=<?php echo $arProductDiscounts["ID"]; ?> &lang=<?php echo urlencode(LANGUAGE_ID); ?> #tb" target="_blank"><?php echo GetMessage("C2IT_MODIFY");
$ratio = 1; if ($_POST["itemsRatio"][$itemID]) { $ratio = $_POST["itemsRatio"][$itemID]; } if (intval($itemID)) { Add2BasketByProductID(intval($itemID), $ratio, array("LID" => $_POST["lid"]), $product_properties); } } } break; case "ajax_recount_prices": if (strlen($_POST["currency"]) > 0) { $arPices = array("formatSum" => "", "formatOldSum" => "", "formatDiscDiffSum" => ""); if ($_POST["sumPrice"]) { $arPices["formatSum"] = FormatCurrency($_POST["sumPrice"], $_POST["currency"]); } if ($_POST["sumOldPrice"] && $_POST["sumOldPrice"] != $_POST["sumPrice"]) { $arPices["formatOldSum"] = FormatCurrency($_POST["sumOldPrice"], $_POST["currency"]); } if ($_POST["sumDiffDiscountPrice"]) { $arPices["formatDiscDiffSum"] = FormatCurrency($_POST["sumDiffDiscountPrice"], $_POST["currency"]); } if (SITE_CHARSET != "utf-8") { $arPices = $APPLICATION->ConvertCharsetArray($arPices, SITE_CHARSET, "utf-8"); } echo json_encode($arPices); } break; } die; }
} $maxDiscount = roundEx($maxDiscount, CATALOG_VALUE_PRECISION); if ($currentDiscount > $maxDiscount) { $currentDiscount = $maxDiscount; } } } $currentDiscount = roundEx($currentDiscount, CATALOG_VALUE_PRECISION); if ($arPrice["DISCOUNT"]["VALUE_TYPE"] == "S") { $currentPrice = $currentDiscount; } else { $currentPrice = $currentPrice - $currentDiscount; } } $vatRate = $arPrice["PRICE"]["VAT_RATE"]; $fieldValue = FormatCurrency($currentPrice, $arPrice["PRICE"]["CURRENCY"]); if (DoubleVal($nearestQuantity) != DoubleVal($QUANTITY)) { $fieldValue .= str_replace("#CNT#", $nearestQuantity, GetMessage("SOPS_PRICE1")); } } if (strlen($BASE_LANG_CURR) <= 0) { $arCurFormat = CCurrencyLang::GetCurrencyFormat($arPrice["PRICE"]["CURRENCY"]); $priceValutaFormat = str_replace("#", '', $arCurFormat["FORMAT_STRING"]); } $row->AddField("PRICE", $fieldValue); $arCatalogProduct = CCatalogProduct::GetByID($arItems["ID"]); $balance = FloatVal($arCatalogProduct["QUANTITY"]); $row->AddField("BALANCE", $balance); $URL = CIBlock::ReplaceDetailUrl($arItems["DETAIL_PAGE_URL"], $arItems, true); $arPriceType = GetCatalogGroup($arPrice["PRICE"]["CATALOG_GROUP_ID"]); $PriceType = $arPriceType["NAME_LANG"];
function DisplayTotals($sql, $table_name) { $result = mysqli_query($_SESSION['con'], $sql) or die(mysqli_error() . "Error in " . $sql); $row = mysqli_fetch_assoc($result); //Create variables from keys of row foreach ($row as $key => $value) { ${$key} = $value; } //Calculate profits $est_profit = FormatCurrency($TotalPrice - $TotalChargeEst); if ($table_name == 'parcel_jobs') { $act_profit = FormatCurrency($TotalPrice - $TotalCost); } //Format totals foreach ($row as $key => $value) { ${$key} = FormatCurrency($value); } if ($table_name == 'jobs') { return "<td>Price = {$TotalPrice}</td><td>Max.P = {$TotalChargeEst}</td><td>Profit = {$est_profit}</td>"; } elseif ($table_name == 'parcel_jobs') { return "<td>Price = {$TotalPrice}</td><td>Cost = {$TotalCost}</td></tr><tr><td>Max.P = {$TotalChargeEst}</td><td>Est. Profit = {$est_profit}</td><td>Act. Profit = {$act_profit}</td>"; } }
?> <td><?php if ($arElement["PRICE_MATRIX"]["MATRIX"][$typeID][$ind]["DISCOUNT_PRICE"] < $arElement["PRICE_MATRIX"]["MATRIX"][$typeID][$ind]["PRICE"]) { ?> <s><?php echo FormatCurrency($arElement["PRICE_MATRIX"]["MATRIX"][$typeID][$ind]["PRICE"], $arElement["PRICE_MATRIX"]["MATRIX"][$typeID][$ind]["CURRENCY"]); ?> </s><span class="catalog-price"><?php echo FormatCurrency($arElement["PRICE_MATRIX"]["MATRIX"][$typeID][$ind]["DISCOUNT_PRICE"], $arElement["PRICE_MATRIX"]["MATRIX"][$typeID][$ind]["CURRENCY"]); ?> </span> <?php } else { ?> <span class="catalog-price"><?php echo FormatCurrency($arElement["PRICE_MATRIX"]["MATRIX"][$typeID][$ind]["PRICE"], $arElement["PRICE_MATRIX"]["MATRIX"][$typeID][$ind]["CURRENCY"]); ?> </span> <?php } ?> </td> <?php } ?> </tr> <?php } ?> </table><br /> <?php
$strDiscountValue = roundEx($arDiscount["VALUE"], CATALOG_VALUE_PRECISION)."%"; } elseif ($arDiscount["VALUE_TYPE"] == CCatalogDiscount::TYPE_SALE) { $strDiscountValue = '= '.FormatCurrency($arDiscount["VALUE"], $arDiscount["CURRENCY"]); } else { $strDiscountValue = FormatCurrency($arDiscount["VALUE"], $arDiscount["CURRENCY"]); } $row->AddViewField("VALUE", $strDiscountValue); } if ($arSelectFieldsMap['MAX_DISCOUNT']) { $row->AddViewField("MAX_DISCOUNT", (0 < $arDiscount['MAX_DISCOUNT'] ? FormatCurrency($arDiscount['MAX_DISCOUNT'], $arDiscount["CURRENCY"]) : GetMessage('DSC_MAX_DISCOUNT_UNLIM'))); } if ($arSelectFieldsMap['RENEWAL']) $row->AddCheckField("RENEWAL", false); $arActions = array(); $arActions[] = array( "ICON" => "edit", "TEXT" => GetMessage("DSC_UPDATE_ALT"), "ACTION" => $lAdmin->ActionRedirect("/bitrix/admin/cat_discount_edit.php?ID=".$arDiscount['ID']."&lang=".LANGUAGE_ID.GetFilterParams("filter_", false).""), "DEFAULT" => true ); if (!$bReadOnly) {
reset($arrPRICE_CODE); foreach ($arrPRICE_CODE as $code) { $value = $arElement["CATALOG_PRICE_" . $arrPrice[$code]["ID"]]; $currency = $arElement["CATALOG_CURRENCY_" . $arrPrice[$code]["ID"]]; $price_id = $arElement["CATALOG_PRICE_ID_" . $arrPrice[$code]["ID"]]; $can_access = $arElement["CATALOG_CAN_ACCESS_" . $arrPrice[$code]["ID"]]; $can_buy = $arElement["CATALOG_CAN_BUY_" . $arrPrice[$code]["ID"]]; ?> <td class="tablenullbody" valign="top" nowrap><nobr><?php if ($can_access == "Y") { ?> <input type="hidden" name="PRICE_ID[]" value="<?php echo $price_id; ?> "><font class="tablebodytext"><font color="red"><b><?php echo FormatCurrency($value, $currency); ?> </b></font></font><?php } ?> </nobr></td><?php } // properties reset($arrPROPERTY_CODE); foreach ($arrPROPERTY_CODE as $code) { ?> <td class="tablenullbody" valign="top"><font class="tablebodytext"><?php echo is_array($arProperty[$code]["VALUE"]) ? implode("<br>", $arProperty[$code]["VALUE"]) : $arProperty[$code]["VALUE"]; ?> </font></td><?php }
public function getBasePrice($currencyId = 'RUB') { \CModule::IncludeModule('catalog'); return \FormatCurrency($this->getBasePriceRawValue(), $currencyId); }
} elseif (IntVal($arQuantity["QUANTITY_FROM"]) > 0) { echo str_replace("#FROM#", $arQuantity["QUANTITY_FROM"], GetMessage("CATALOG_QUANTITY_FROM")); } elseif (IntVal($arQuantity["QUANTITY_TO"]) > 0) { echo str_replace("#TO#", $arQuantity["QUANTITY_TO"], GetMessage("CATALOG_QUANTITY_TO")); } ?> </font></td> <?php } foreach ($arPriceMatrix["COLS"] as $typeID => $arType) { ?> <td valign="top" nowrap class="tablebody"><font class="smalltext"><?php if ($arPriceMatrix["MATRIX"][$typeID][$ind]["DISCOUNT_PRICE"] < $arPriceMatrix["MATRIX"][$typeID][$ind]["PRICE"]) { echo '<s>' . FormatCurrency($arPriceMatrix["MATRIX"][$typeID][$ind]["PRICE"], $arPriceMatrix["MATRIX"][$typeID][$ind]["CURRENCY"]) . '</s> <font color="red">' . FormatCurrency($arPriceMatrix["MATRIX"][$typeID][$ind]["DISCOUNT_PRICE"], $arPriceMatrix["MATRIX"][$typeID][$ind]["CURRENCY"]); } else { echo '<font color="red">' . FormatCurrency($arPriceMatrix["MATRIX"][$typeID][$ind]["PRICE"], $arPriceMatrix["MATRIX"][$typeID][$ind]["CURRENCY"]); } ?> </font></font></td><?php } ?> </tr> <?php } ?> </table> </td></tr></table> </td> </tr> <?php }
public static function PrepereData($params) { if ($params["INCOMING"] == "N") { $params["INCOMING"] = CVoxImplantMain::CALL_OUTGOING; } else { if ($params["INCOMING"] == "N") { $params["INCOMING"] = CVoxImplantMain::CALL_INCOMING; } } if ($params["PHONE_NUMBER"] == "hidden") { $params["PHONE_NUMBER"] = GetMessage("IM_PHONE_NUMBER_HIDDEN"); } $params["CALL_FAILED_REASON"] = in_array($params["CALL_FAILED_CODE"], array("200", "304", "603-S", "603", "404", "486", "484", "503", "480", "402", "423")) ? GetMessage("VI_STATUS_" . $params["CALL_FAILED_CODE"]) : GetMessage("VI_STATUS_OTHER"); if ($params["INCOMING"] == CVoxImplantMain::CALL_OUTGOING) { $params["INCOMING_TEXT"] = GetMessage("VI_OUTGOING"); if ($params["CALL_FAILED_CODE"] == 200) { $params["CALL_ICON"] = 'outgoing'; } } else { if ($params["INCOMING"] == CVoxImplantMain::CALL_INCOMING) { $params["INCOMING_TEXT"] = GetMessage("VI_INCOMING"); if ($params["CALL_FAILED_CODE"] == 200) { $params["CALL_ICON"] = 'incoming'; } } else { if ($params["INCOMING"] == CVoxImplantMain::CALL_INCOMING_REDIRECT) { $params["INCOMING_TEXT"] = GetMessage("VI_INCOMING_REDIRECT"); if ($params["CALL_FAILED_CODE"] == 200) { $params["CALL_ICON"] = 'incoming-redirect'; } } } } if ($params["CALL_FAILED_CODE"] == 304) { $params["CALL_ICON"] = 'skipped'; } else { if ($params["CALL_FAILED_CODE"] != 200) { $params["CALL_ICON"] = 'decline'; } } if ($params["CALL_DURATION"] > 60) { $formatTimeMin = floor($params["CALL_DURATION"] / 60); $formatTimeSec = $params["CALL_DURATION"] - $formatTimeMin * 60; $params["CALL_DURATION_TEXT"] = $formatTimeMin . " " . GetMessage("VI_MIN"); if ($formatTimeSec > 0) { $params["CALL_DURATION_TEXT"] = $params["CALL_DURATION_TEXT"] . " " . $formatTimeSec . " " . GetMessage("VI_SEC"); } } else { $params["CALL_DURATION_TEXT"] = $params["CALL_DURATION"] . " " . GetMessage("VI_SEC"); } if (CModule::IncludeModule("catalog")) { $params["COST_TEXT"] = FormatCurrency($params["COST"], $params["COST_CURRENCY"] == "RUR" ? "RUB" : $params["COST_CURRENCY"]); } else { $params["COST_TEXT"] = $params["COST"] . " " . GetMessage("VI_CURRENCY_" . $params["COST_CURRENCY"]); } if (!$params["COST_TEXT"]) { $params["COST_TEXT"] = '-'; } if (intval($params["CALL_RECORD_ID"]) > 0) { $recordFile = CFile::GetFileArray($params["CALL_RECORD_ID"]); if ($recordFile !== false) { $params["CALL_RECORD_HREF"] = $recordFile['SRC']; } } return $params; }
<?php } ?> <?php } } } else { $price_from = ''; if ($arItem['PROPERTIES']['MAXIMUM_PRICE']['VALUE'] > $arItem['PROPERTIES']['MINIMUM_PRICE']['VALUE']) { $price_from = GetMessage("CR_PRICE_OT") . " "; } CModule::IncludeModule("sale"); ?> <?php echo $price_from; echo FormatCurrency($arItem['PROPERTIES']['MINIMUM_PRICE']['VALUE'], CSaleLang::GetLangCurrency(SITE_ID)); ?> <?php } } ?> </div> <a href="<?php echo $arItem["DETAIL_PAGE_URL"]; ?> " class="bt3"><?php echo GetMessage("CATALOG_MORE"); ?> </a> </div> <div class="tlistitem_shadow"></div>
$price_value = $arElement["CATALOG_PRICE_" . $arrPrice[$LINK_PRICE_CODE]["ID"]]; // price $price_currency = $arElement["CATALOG_CURRENCY_" . $arrPrice[$LINK_PRICE_CODE]["ID"]]; // currency $can_access = $arElement["CATALOG_CAN_ACCESS_" . $arrPrice[$LINK_PRICE_CODE]["ID"]]; // can be viewed? $can_buy = $arElement["CATALOG_CAN_BUY_" . $arrPrice[$LINK_PRICE_CODE]["ID"]]; // can be ordered? $price_id = $arElement["CATALOG_PRICE_ID_" . $arrPrice[$LINK_PRICE_CODE]["ID"]]; // goods price ID ?> <td class="tablenullbody" align="right" nowrap><nobr><font class="tablebodytext"><?php if ($can_access == "Y") { ?> <font color="red"><b><?php echo FormatCurrency($price_value, $price_currency); ?> </b></font><?php } ?> </font></nobr></td> <td class="tablenullbody" nowrap><font class="tablebodytext"><?php if ($can_buy == "Y") { if ($trace_quantity != "Y" || $trace_quantity == "Y" && $quantity > 0) { ?> <b><a href="javascript: alert('<?php echo GetMessage("CATALOG_ADD_TO_BASKET_NOTIFY"); ?> '); window.location='<?php echo $APPLICATION->GetCurPageParam("price_id=" . $price_id . "&action=ADD_TO_BASKET&link=" . $link, array("price_id", "action", "link")); ?>
echo str_replace("#TO#", $arQuantity["QUANTITY_TO"], GetMessage("CATALOG_QUANTITY_TO")); } ?> </th> <?php } ?> <?php foreach ($arElement["PRICE_MATRIX"]["COLS"] as $typeID => $arType) { ?> <td> <?php if ($arElement["PRICE_MATRIX"]["MATRIX"][$typeID][$ind]["DISCOUNT_PRICE"] < $arElement["PRICE_MATRIX"]["MATRIX"][$typeID][$ind]["PRICE"]) { echo '<s>' . FormatCurrency($arElement["PRICE_MATRIX"]["MATRIX"][$typeID][$ind]["PRICE"], $arElement["PRICE_MATRIX"]["MATRIX"][$typeID][$ind]["CURRENCY"]) . '</s> <span class="catalog-price">' . FormatCurrency($arElement["PRICE_MATRIX"]["MATRIX"][$typeID][$ind]["DISCOUNT_PRICE"], $arElement["PRICE_MATRIX"]["MATRIX"][$typeID][$ind]["CURRENCY"]) . "</span>"; } else { echo '<span class="catalog-price">' . FormatCurrency($arElement["PRICE_MATRIX"]["MATRIX"][$typeID][$ind]["PRICE"], $arElement["PRICE_MATRIX"]["MATRIX"][$typeID][$ind]["CURRENCY"]) . "</span>"; } ?> </td> <?php } ?> </tr> <?php } ?> </table> <?php } ?>
<h4><?php echo $arDiscountSave['NAME']; ?> </h4><?php ?> <p><?php echo GetMessage('BX_CMP_CDI_TPL_MESS_SIZE'); ?> <?php if ('P' == $arDiscountSave['VALUE_TYPE']) { echo $arDiscountSave['VALUE']; ?> %<?php } else { echo FormatCurrency($arDiscountSave['VALUE'], $arDiscountSave['CURRENCY']); } if (isset($arDiscountSave['NEXT_LEVEL']) && is_array($arDiscountSave['NEXT_LEVEL'])) { $strNextLevel = ''; if ('P' == $arDiscountSave['NEXT_LEVEL']['VALUE_TYPE']) { $strNextLevel = $arDiscountSave['NEXT_LEVEL']['VALUE'] . ' %'; } else { $strNextLevel = FormatCurrency($arDiscountSave['NEXT_LEVEL']['VALUE'], $arDiscountSave['CURRENCY']); } ?> <br /><?php echo str_replace(array('#SIZE#', '#SUMM#'), array($strNextLevel, FormatCurrency($arDiscountSave['NEXT_LEVEL']['RANGE_FROM'] - $arDiscountSave['RANGE_SUMM'], $arDiscountSave['CURRENCY'])), GetMessage('BX_CMP_CDI_TPL_MESS_NEXT_LEVEL')); } ?> </p><br /><?php } }
public static function GetItemPrices($IBLOCK_ID, $arCatalogPrices, $arItem, $bVATInclude = true, $arCurrencyParams = array(), $USER_ID = 0, $LID = SITE_ID) { static $arCurUserGroups = array(); global $USER; $arPrices = array(); if(CModule::IncludeModule("catalog")) { $USER_ID = intval($USER_ID); $intUserID = $USER_ID; if (0 >= $intUserID) $intUserID = $USER->GetID(); if (!array_key_exists($intUserID, $arCurUserGroups)) { $arCurUserGroups[$intUserID] = (0 < $USER_ID ? CUser::GetUserGroup($USER_ID) : $USER->GetUserGroupArray()); } $arUserGroups = $arCurUserGroups[$intUserID]; $boolConvert = false; $strCurrencyID = ''; if (is_array($arCurrencyParams) && !empty($arCurrencyParams) && !empty($arCurrencyParams['CURRENCY_ID'])) { $boolConvert = true; $strCurrencyID = $arCurrencyParams['CURRENCY_ID']; } foreach($arCatalogPrices as $key => $value) { if($value["CAN_VIEW"] && strlen($arItem["CATALOG_PRICE_".$value["ID"]]) > 0) { // get final price with VAT included. if ($arItem['CATALOG_VAT_INCLUDED'] != 'Y') { $arItem['CATALOG_PRICE_'.$value['ID']] *= (1 + $arItem['CATALOG_VAT'] * 0.01); } CCatalogDiscountSave::Disable(); // so discounts will include VAT $arDiscounts = CCatalogDiscount::GetDiscount( $arItem["ID"], $arItem["IBLOCK_ID"], array($value["ID"]), $arUserGroups, "N", $LID, array() ); CCatalogDiscountSave::Enable(); $discountPrice = CCatalogProduct::CountPriceWithDiscount( $arItem["CATALOG_PRICE_".$value["ID"]], $arItem["CATALOG_CURRENCY_".$value["ID"]], $arDiscounts ); // get clear prices WO VAT $arItem['CATALOG_PRICE_'.$value['ID']] /= (1 + $arItem['CATALOG_VAT'] * 0.01); $discountPrice /= (1 + $arItem['CATALOG_VAT'] * 0.01); $vat_value_discount = $discountPrice * $arItem['CATALOG_VAT'] * 0.01; $vat_discountPrice = $discountPrice + $vat_value_discount; $vat_value = $arItem['CATALOG_PRICE_'.$value['ID']] * $arItem['CATALOG_VAT'] * 0.01; $vat_price = $arItem["CATALOG_PRICE_".$value["ID"]] + $vat_value; if ($boolConvert && $strCurrencyID != $arItem["CATALOG_CURRENCY_".$value["ID"]]) { $strOrigCurrencyID = $arItem["CATALOG_CURRENCY_".$value["ID"]]; $dblOrigNoVat = $arItem["CATALOG_PRICE_".$value["ID"]]; $dblNoVat = CCurrencyRates::ConvertCurrency($dblOrigNoVat, $strOrigCurrencyID, $strCurrencyID); $dblVatPrice = CCurrencyRates::ConvertCurrency($vat_price, $strOrigCurrencyID, $strCurrencyID); $dblVatValue = CCurrencyRates::ConvertCurrency($vat_value, $strOrigCurrencyID, $strCurrencyID); $dblDiscountValueNoVat = CCurrencyRates::ConvertCurrency($discountPrice, $strOrigCurrencyID, $strCurrencyID); $dblVatDiscountPrice = CCurrencyRates::ConvertCurrency($vat_discountPrice, $strOrigCurrencyID, $strCurrencyID); $dblDiscountValueVat = CCurrencyRates::ConvertCurrency($vat_value_discount, $strOrigCurrencyID, $strCurrencyID); $arPrices[$key] = array( 'ORIG_VALUE_NOVAT' => $dblOrigNoVat, "VALUE_NOVAT" => $dblNoVat, "PRINT_VALUE_NOVAT" => FormatCurrency($dblNoVat, $strCurrencyID), 'ORIG_VALUE_VAT' => $vat_price, "VALUE_VAT" => $dblVatPrice, "PRINT_VALUE_VAT" => FormatCurrency($dblVatPrice, $strCurrencyID), 'ORIG_VATRATE_VALUE' => $vat_value, "VATRATE_VALUE" => $dblVatValue, "PRINT_VATRATE_VALUE" => FormatCurrency($dblVatValue, $strCurrencyID), 'ORIG_DISCOUNT_VALUE_NOVAT' => $discountPrice, "DISCOUNT_VALUE_NOVAT" => $dblDiscountValueNoVat, "PRINT_DISCOUNT_VALUE_NOVAT" => FormatCurrency($dblDiscountValueNoVat, $strCurrencyID), "ORIG_DISCOUNT_VALUE_VAT" => $vat_discountPrice, "DISCOUNT_VALUE_VAT" => $dblVatDiscountPrice, "PRINT_DISCOUNT_VALUE_VAT" => FormatCurrency($dblVatDiscountPrice, $strCurrencyID), 'ORIG_DISCOUNT_VATRATE_VALUE' => $vat_value_discount, 'DISCOUNT_VATRATE_VALUE' => $dblDiscountValueVat, 'PRINT_DISCOUNT_VATRATE_VALUE' => FormatCurrency($dblDiscountValueVat, $strCurrencyID), 'ORIG_CURRENCY' => $strOrigCurrencyID, "CURRENCY" => $strCurrencyID, ); } else { $arPrices[$key] = array( "VALUE_NOVAT" => $arItem["CATALOG_PRICE_".$value["ID"]], "PRINT_VALUE_NOVAT" => FormatCurrency($arItem["CATALOG_PRICE_".$value["ID"]],$arItem["CATALOG_CURRENCY_".$value["ID"]]), "VALUE_VAT" => $vat_price, "PRINT_VALUE_VAT" => FormatCurrency($vat_price, $arItem["CATALOG_CURRENCY_".$value["ID"]]), "VATRATE_VALUE" => $vat_value, "PRINT_VATRATE_VALUE" => FormatCurrency($vat_value, $arItem["CATALOG_CURRENCY_".$value["ID"]]), "DISCOUNT_VALUE_NOVAT" => $discountPrice, "PRINT_DISCOUNT_VALUE_NOVAT" => FormatCurrency($discountPrice, $arItem["CATALOG_CURRENCY_".$value["ID"]]), "DISCOUNT_VALUE_VAT" => $vat_discountPrice, "PRINT_DISCOUNT_VALUE_VAT" => FormatCurrency($vat_discountPrice, $arItem["CATALOG_CURRENCY_".$value["ID"]]), 'DISCOUNT_VATRATE_VALUE' => $vat_value_discount, 'PRINT_DISCOUNT_VATRATE_VALUE' => FormatCurrency($vat_value_discount, $arItem["CATALOG_CURRENCY_".$value["ID"]]), "CURRENCY" => $arItem["CATALOG_CURRENCY_".$value["ID"]], ); } $arPrices[$key]["ID"] = $arItem["CATALOG_PRICE_ID_".$value["ID"]]; $arPrices[$key]["CAN_ACCESS"] = $arItem["CATALOG_CAN_ACCESS_".$value["ID"]]; $arPrices[$key]["CAN_BUY"] = $arItem["CATALOG_CAN_BUY_".$value["ID"]]; if ($bVATInclude) { $arPrices[$key]['VALUE'] = $arPrices[$key]['VALUE_VAT']; $arPrices[$key]['PRINT_VALUE'] = $arPrices[$key]['PRINT_VALUE_VAT']; $arPrices[$key]['DISCOUNT_VALUE'] = $arPrices[$key]['DISCOUNT_VALUE_VAT']; $arPrices[$key]['PRINT_DISCOUNT_VALUE'] = $arPrices[$key]['PRINT_DISCOUNT_VALUE_VAT']; } else { $arPrices[$key]['VALUE'] = $arPrices[$key]['VALUE_NOVAT']; $arPrices[$key]['PRINT_VALUE'] = $arPrices[$key]['PRINT_VALUE_NOVAT']; $arPrices[$key]['DISCOUNT_VALUE'] = $arPrices[$key]['DISCOUNT_VALUE_NOVAT']; $arPrices[$key]['PRINT_DISCOUNT_VALUE'] = $arPrices[$key]['PRINT_DISCOUNT_VALUE_NOVAT']; } } } } else { foreach($arCatalogPrices as $key => $value) { if($value["CAN_VIEW"]) { $arPrices[$key] = array( "ID" => $arItem["PROPERTY_".$value["ID"]."_VALUE_ID"], "VALUE" => round(doubleval($arItem["PROPERTY_".$value["ID"]."_VALUE"]),2), "PRINT_VALUE" => round(doubleval($arItem["PROPERTY_".$value["ID"]."_VALUE"]),2)." ".$arItem["PROPERTY_".$value["ID"]."_DESCRIPTION"], "DISCOUNT_VALUE" => round(doubleval($arItem["PROPERTY_".$value["ID"]."_VALUE"]),2), "PRINT_DISCOUNT_VALUE" => round(doubleval($arItem["PROPERTY_".$value["ID"]."_VALUE"]),2)." ".$arItem["PROPERTY_".$value["ID"]."_DESCRIPTION"], "CURRENCY" => $arItem["PROPERTY_".$value["ID"]."_DESCRIPTION"], "CAN_ACCESS" => true, "CAN_BUY" => false, ); } } } return $arPrices; }
$arResult["SET_ITEMS"]["DEFAULT"][$key]["PRICE_CONVERT_DISCOUNT_DIFFERENCE_VALUE"] = CCurrencyRates::ConvertCurrency($arItem["PRICE_DISCOUNT_DIFFERENCE_VALUE"], $arItem["PRICE_CURRENCY"] , $arResult["ELEMENT"]["PRICE_CURRENCY"]); $arResult["SET_ITEMS"]["PRICE_DISCOUNT_DIFFERENCE"] += $arResult["SET_ITEMS"]["DEFAULT"][$key]["PRICE_CONVERT_DISCOUNT_DIFFERENCE_VALUE"]; } foreach($arResult["SET_ITEMS"]["OTHER"] as $key=>$arItem) { $arResult["SET_ITEMS"]["OTHER"][$key]["PRICE_CONVERT_DISCOUNT_VALUE"] = CCurrencyRates::ConvertCurrency($arItem['PRICE_DISCOUNT_VALUE'], $arItem["PRICE_CURRENCY"] , $arResult["ELEMENT"]["PRICE_CURRENCY"]); $arResult["SET_ITEMS"]["OTHER"][$key]["PRICE_CONVERT_VALUE"] = CCurrencyRates::ConvertCurrency($arItem["PRICE_VALUE"], $arItem["PRICE_CURRENCY"] , $arResult["ELEMENT"]["PRICE_CURRENCY"]); $arResult["SET_ITEMS"]["OTHER"][$key]["PRICE_CONVERT_DISCOUNT_DIFFERENCE_VALUE"] = CCurrencyRates::ConvertCurrency($arItem["PRICE_DISCOUNT_DIFFERENCE_VALUE"], $arItem["PRICE_CURRENCY"] , $arResult["ELEMENT"]["PRICE_CURRENCY"]); } } if ($arResult["SET_ITEMS"]["OLD_PRICE"] && $arResult["SET_ITEMS"]["OLD_PRICE"] != $arResult["SET_ITEMS"]["PRICE"]) $arResult["SET_ITEMS"]["OLD_PRICE"] = FormatCurrency($arResult["SET_ITEMS"]["OLD_PRICE"], $arResult["ELEMENT"]["PRICE_CURRENCY"]); else $arResult["SET_ITEMS"]["OLD_PRICE"] = 0; if ($arResult["SET_ITEMS"]["PRICE"]) $arResult["SET_ITEMS"]["PRICE"] = FormatCurrency($arResult["SET_ITEMS"]["PRICE"], $arResult["ELEMENT"]["PRICE_CURRENCY"]); if ($arResult["SET_ITEMS"]["PRICE_DISCOUNT_DIFFERENCE"]) $arResult["SET_ITEMS"]["PRICE_DISCOUNT_DIFFERENCE"] = FormatCurrency($arResult["SET_ITEMS"]["PRICE_DISCOUNT_DIFFERENCE"], $arResult["ELEMENT"]["PRICE_CURRENCY"]); $this->SetResultCacheKeys(array( "ELEMENT", "SET_ITEMS", )); $this->IncludeComponentTemplate(); } ?>
$currentDiscount = $maxDiscount; } } } $currentDiscount = roundEx($currentDiscount, CATALOG_VALUE_PRECISION); if ($arPrice["DISCOUNT"]["VALUE_TYPE"] == "S") { $currentPrice = $currentDiscount; } else { $currentPrice = $currentPrice - $currentDiscount; } } $vatRate = $arPrice["PRICE"]["VAT_RATE"]; $arCatalogProduct = CCatalogProduct::GetByID($arItems["ID"]); $currentPrice = $arCatalogProduct["PURCHASING_PRICE"] != null ? $arCatalogProduct["PURCHASING_PRICE"] : 0; $currentPriceCurrency = $arCatalogProduct["PURCHASING_CURRENCY"] != null ? $arCatalogProduct["PURCHASING_CURRENCY"] : ""; $fieldValue = htmlspecialcharsbx(FormatCurrency($currentPrice, $currentPriceCurrency)); if (DoubleVal($nearestQuantity) != DoubleVal($QUANTITY)) { $fieldValue .= str_replace("#CNT#", $nearestQuantity, GetMessage("SOPS_PRICE1")); } } if (strlen($BASE_LANG_CURR) <= 0) { $arCurFormat = CCurrencyLang::GetCurrencyFormat($arPrice["PRICE"]["CURRENCY"]); $priceValutaFormat = htmlspecialcharsbx(str_replace("#", '', $arCurFormat["FORMAT_STRING"])); } $row->AddField("PRICE", $fieldValue); $amountToStore = 0; $arCatalogProduct = CCatalogProduct::GetByID($arItems["ID"]); if ($STORE_FROM_ID > 0) { $dbStoreProduct = CCatalogStoreProduct::GetList(array(), array("PRODUCT_ID" => $arItems["ID"], "STORE_ID" => $STORE_FROM_ID)); if ($arStoreProduct = $dbStoreProduct->Fetch()) { $amountToStore = $arStoreProduct["AMOUNT"];