本文整理匯總了PHP中CCatalogProduct::getOptimalPrice方法的典型用法代碼示例。如果您正苦於以下問題:PHP CCatalogProduct::getOptimalPrice方法的具體用法?PHP CCatalogProduct::getOptimalPrice怎麽用?PHP CCatalogProduct::getOptimalPrice使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CCatalogProduct
的用法示例。
在下文中一共展示了CCatalogProduct::getOptimalPrice方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getProductDataToFillBasket
//.........這裏部分代碼省略.........
}
if (isset($arSku2Parent[$productId])) {
$arParent = $arProductData[$arSku2Parent[$productId]];
}
if (!empty($arSku2Parent)) {
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]))) {
$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'));
}
static $buyersGroups = array();
if (empty($buyersGroups[$userId])) {
$buyersGroups[$userId] = \CUser::getUserGroup($userId);
}
$arBuyerGroups = $buyersGroups[$userId];
// price
$currentVatMode = \CCatalogProduct::getPriceVatIncludeMode();
$currentUseDiscount = \CCatalogProduct::getUseDiscount();
\CCatalogProduct::setUseDiscount(!$isSetItem);
\CCatalogProduct::setPriceVatIncludeMode(true);
\CCatalogProduct::setUsedCurrency(Sale\Internals\SiteCurrencyTable::getSiteCurrency($LID));
$arPrice = \CCatalogProduct::getOptimalPrice($arElementInfo["ID"], 1, $arBuyerGroups, "N", array(), $LID);
\CCatalogProduct::clearUsedCurrency();
\CCatalogProduct::setPriceVatIncludeMode($currentVatMode);
\CCatalogProduct::setUseDiscount($currentUseDiscount);
unset($currentUseDiscount, $currentVatMode);
$currentPrice = $arPrice['RESULT_PRICE']['DISCOUNT_PRICE'];
$arElementInfo['PRICE'] = $currentPrice;
$arElementInfo['CURRENCY'] = $arPrice['RESULT_PRICE']['CURRENCY'];
$currentTotalPrice = $arPrice['RESULT_PRICE']['BASE_PRICE'];
$arProduct = array();
if (!empty($proxyCatalogProduct[$productId]) && is_array($proxyCatalogProduct[$productId])) {
$arProduct = $proxyCatalogProduct[$productId];
} else {
$rsProducts = \CCatalogProduct::getList(array(), array('ID' => $productId), false, false, array('ID', 'QUANTITY', 'WEIGHT', 'MEASURE', 'TYPE', 'BARCODE_MULTI'));
if ($arProduct = $rsProducts->Fetch()) {
$proxyCatalogProduct[$productId] = $arProduct;
}
}
if (empty($arProduct) || !is_array($arProduct)) {
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']);
static $proxySkuProperty = array();
if (!empty($proxySkuProperty[$productId]) && is_array($proxySkuProperty[$productId])) {
$arSkuProperty = $proxySkuProperty[$productId];
} else {
$arSkuProperty = \CSaleProduct::GetProductSkuProps($productId, '', true);
$proxySkuProperty[$productId] = $arSkuProperty;
}
if (!empty($arSkuProperty)) {