本文整理汇总了PHP中CCatalogProduct::clearUsedCurrency方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogProduct::clearUsedCurrency方法的具体用法?PHP CCatalogProduct::clearUsedCurrency怎么用?PHP CCatalogProduct::clearUsedCurrency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogProduct
的用法示例。
在下文中一共展示了CCatalogProduct::clearUsedCurrency方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OrderProduct
//.........这里部分代码省略.........
if ($arCatalogProduct = $rsProducts->Fetch()) {
static::setHitCache('CATALOG_PRODUCT', $productID, $arCatalogProduct);
}
unset($rsProducts);
}
if (!empty($arCatalogProduct) && is_array($arCatalogProduct)) {
$arCatalogProduct["QUANTITY"] = (double) $arCatalogProduct["QUANTITY"];
if ($arParams["CHECK_QUANTITY"] == "Y") {
if ('Y' != $arCatalogProduct["CAN_BUY_ZERO"] && 'Y' == $arCatalogProduct["QUANTITY_TRACE"] && ($arCatalogProduct["QUANTITY"] <= 0 || $quantity > $arCatalogProduct["QUANTITY"])) {
return $arResult;
}
}
} else {
return $arResult;
}
if ($adminSection) {
CCatalogDiscountSave::SetDiscountUserID($intUserID);
}
$productHash = array('MODULE' => 'catalog', 'PRODUCT_ID' => $productID, 'BASKET_ID' => $arParams['BASKET_ID']);
$arCoupons = DiscountCouponsManager::getForApply(array(), $productHash, true);
if (!empty($arCoupons)) {
$arCoupons = array_keys($arCoupons);
}
$currentVatMode = CCatalogProduct::getPriceVatIncludeMode();
$currentUseDiscount = CCatalogProduct::getUseDiscount();
CCatalogProduct::setUseDiscount($arParams['CHECK_DISCOUNT'] == 'Y');
CCatalogProduct::setPriceVatIncludeMode(true);
CCatalogProduct::setUsedCurrency($arParams['CURRENCY']);
$arPrice = CCatalogProduct::GetOptimalPrice($productID, $quantity, $userGroups, $arParams['RENEWAL'], array(), $adminSection ? $strSiteID : false, $arCoupons);
if (empty($arPrice)) {
if ($nearestQuantity = CCatalogProduct::GetNearestQuantityPrice($productID, $quantity, $userGroups)) {
$quantity = $nearestQuantity;
$arPrice = CCatalogProduct::GetOptimalPrice($productID, $quantity, $userGroups, $arParams['RENEWAL'], array(), $adminSection ? $strSiteID : false, $arCoupons);
}
}
CCatalogProduct::clearUsedCurrency();
CCatalogProduct::setPriceVatIncludeMode($currentVatMode);
CCatalogProduct::setUseDiscount($currentUseDiscount);
unset($userGroups, $currentUseDiscount, $currentVatMode);
if ($adminSection) {
CCatalogDiscountSave::ClearDiscountUserID();
}
if (empty($arPrice)) {
return $arResult;
}
$arDiscountList = array();
if (empty($arPrice['DISCOUNT_LIST']) && !empty($arPrice['DISCOUNT']) && is_array($arPrice['DISCOUNT'])) {
$arPrice['DISCOUNT_LIST'] = array($arPrice['DISCOUNT']);
}
if (!empty($arPrice['DISCOUNT_LIST'])) {
$appliedCoupons = array();
foreach ($arPrice['DISCOUNT_LIST'] as &$arOneDiscount) {
$arOneList = array('ID' => $arOneDiscount['ID'], 'NAME' => $arOneDiscount['NAME'], 'COUPON' => '', 'COUPON_TYPE' => '', 'USE_COUPONS' => isset($arOneDiscount['USE_COUPONS']) ? $arOneDiscount['USE_COUPONS'] : 'N', 'MODULE_ID' => isset($oneDiscount['MODULE_ID']) ? $oneDiscount['MODULE_ID'] : 'catalog', 'TYPE' => $arOneDiscount['TYPE'], 'VALUE' => $arOneDiscount['VALUE'], 'VALUE_TYPE' => $arOneDiscount['VALUE_TYPE'], 'MAX_VALUE' => $arOneDiscount['VALUE_TYPE'] == Catalog\DiscountTable::VALUE_TYPE_PERCENT ? $arOneDiscount['MAX_DISCOUNT'] : 0, 'CURRENCY' => $arOneDiscount['CURRENCY'], 'HANDLERS' => isset($arOneDiscount['HANDLERS']) ? $arOneDiscount['HANDLERS'] : array());
if (!empty($arOneDiscount['COUPON'])) {
$arOneList['USE_COUPONS'] = 'Y';
$arOneList['COUPON'] = $arOneDiscount['COUPON'];
$arOneList['COUPON_TYPE'] = $arOneDiscount['COUPON_ONE_TIME'];
$appliedCoupons[] = $arOneDiscount['COUPON'];
}
$arDiscountList[] = $arOneList;
}
unset($arOneList, $arOneDiscount);
if (!empty($appliedCoupons)) {
$resultApply = DiscountCouponsManager::setApplyByProduct($productHash, $appliedCoupons);
}
unset($resultApply, $appliedCoupons);
}
if (empty($arPrice['PRICE']['CATALOG_GROUP_NAME'])) {
if (!empty($arPrice['PRICE']['CATALOG_GROUP_ID'])) {
$priceName = self::getPriceTitle($arPrice['PRICE']['CATALOG_GROUP_ID']);
if ($priceName != '') {
$arPrice['PRICE']['CATALOG_GROUP_NAME'] = $priceName;
}
unset($priceName);
}
}
if (empty($arPrice['RESULT_PRICE']) || !is_array($arPrice['RESULT_PRICE'])) {
$arPrice['RESULT_PRICE'] = CCatalogDiscount::calculateDiscountList($arPrice['PRICE'], $arParams['CURRENCY'], $arDiscountList, true);
}
$arResult = array('PRODUCT_PRICE_ID' => $arPrice['PRICE']['ID'], 'BASE_PRICE' => $arPrice['RESULT_PRICE']['BASE_PRICE'], 'PRICE' => $arPrice['RESULT_PRICE']['DISCOUNT_PRICE'], 'VAT_RATE' => $arPrice['PRICE']['VAT_RATE'], "CURRENCY" => $arPrice['RESULT_PRICE']['CURRENCY'], "WEIGHT" => (double) $arCatalogProduct["WEIGHT"], "DIMENSIONS" => serialize(array("WIDTH" => $arCatalogProduct["WIDTH"], "HEIGHT" => $arCatalogProduct["HEIGHT"], "LENGTH" => $arCatalogProduct["LENGTH"])), "NAME" => $arProduct["~NAME"], "CAN_BUY" => "Y", "DETAIL_PAGE_URL" => $arProduct['~DETAIL_PAGE_URL'], "NOTES" => $arPrice["PRICE"]["CATALOG_GROUP_NAME"], "DISCOUNT_PRICE" => $arPrice['RESULT_PRICE']['DISCOUNT'], "TYPE" => $arCatalogProduct["TYPE"] == CCatalogProduct::TYPE_SET ? CCatalogProductSet::TYPE_SET : null, "DISCOUNT_VALUE" => $arPrice['RESULT_PRICE']['PERCENT'] > 0 ? $arPrice['RESULT_PRICE']['PERCENT'] . '%' : 0, "DISCOUNT_NAME" => '', "DISCOUNT_COUPON" => '', "DISCOUNT_LIST" => array());
if ($arParams["CHECK_QUANTITY"] == "Y") {
$arResult["QUANTITY"] = $quantity;
} else {
$arResult["QUANTITY"] = $arParams["QUANTITY"];
}
if (!empty($arDiscountList)) {
$arResult['DISCOUNT_LIST'] = $arDiscountList;
}
if (!empty($arPrice['DISCOUNT'])) {
$arResult['DISCOUNT_NAME'] = '[' . $arPrice['DISCOUNT']['ID'] . '] ' . $arPrice['DISCOUNT']['NAME'];
if (!empty($arPrice['DISCOUNT']['COUPON'])) {
$arResult['DISCOUNT_COUPON'] = $arPrice['DISCOUNT']['COUPON'];
}
if (empty($arResult['DISCOUNT_LIST'])) {
$arResult['DISCOUNT_LIST'] = array($arPrice['DISCOUNT']);
}
}
$arResult["VAT_INCLUDED"] = "Y";
return $arResult;
}
示例2: getProductDataToFillBasket
//.........这里部分代码省略.........
unset($arElement);
if (isset($arProductData[$productId])) {
$arElementInfo = $arProductData[$productId];
}
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'));
}
$arBuyerGroups = CUser::GetUserGroup($userId);
// price
$currentVatMode = CCatalogProduct::getPriceVatIncludeMode();
$currentUseDiscount = CCatalogProduct::getUseDiscount();
CCatalogProduct::setUseDiscount(true);
CCatalogProduct::setPriceVatIncludeMode(true);
CCatalogProduct::setUsedCurrency(CSaleLang::GetLangCurrency($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'];
$arElementInfo['DISCOUNT_PRICE'] = $arPrice['RESULT_PRICE']['DISCOUNT'];
$currentTotalPrice = $arPrice['RESULT_PRICE']['BASE_PRICE'];
$discountPercent = (int) $arPrice['RESULT_PRICE']['PERCENT'];
$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;
}
示例3: GetRecommendetProduct
//.........这里部分代码省略.........
if (CModule::IncludeModule('catalog') && !empty($arFilterRecomendet)) {
$arRecomendet = array();
if (!is_array($arFilterRecomendet)) {
$arFilterRecomendet = array($arFilterRecomendet);
}
Main\Type\Collection::normalizeArrayValuesByInt($arFilterRecomendet);
if (empty($arFilterRecomendet)) {
return $arRecomendetResult;
}
$iblockRecommended = array();
$productIterator = Iblock\ElementTable::getList(array('select' => array('ID', 'IBLOCK_ID'), 'filter' => array('@ID' => $arFilterRecomendet, '=ACTIVE' => 'Y')));
while ($product = $productIterator->fetch()) {
$product['ID'] = (int) $product['ID'];
$product['IBLOCK_ID'] = (int) $product['IBLOCK_ID'];
if (!isset($iblockRecommended[$product['IBLOCK_ID']])) {
$iblockRecommended[$product['IBLOCK_ID']] = array();
}
$iblockRecommended[$product['IBLOCK_ID']][] = $product['ID'];
}
unset($product, $productIterator);
if (empty($iblockRecommended)) {
return $arRecomendetResult;
}
$propertyList = array();
$propertyIterator = Iblock\PropertyTable::getList(array('select' => array('ID', 'IBLOCK_ID'), 'filter' => array('@IBLOCK_ID' => array_keys($iblockRecommended), '=CODE' => 'RECOMMEND', '=PROPERTY_TYPE' => Iblock\PropertyTable::TYPE_ELEMENT)));
while ($property = $propertyIterator->fetch()) {
$property['ID'] = (int) $property['ID'];
$property['IBLOCK_ID'] = (int) $property['IBLOCK_ID'];
$propertyList[$property['IBLOCK_ID']] = $property['ID'];
}
unset($property, $propertyIterator);
if (empty($propertyList)) {
return $arRecomendetResult;
}
foreach ($propertyList as $iblockID => $propertyID) {
$propertyValue = 'PROPERTY_' . $propertyID;
$filter = array('ID' => $iblockRecommended[$iblockID], 'IBLOCK_ID' => $iblockID);
$select = array('ID', 'IBLOCK_ID', $propertyValue);
$propertyValue .= '_VALUE';
$elementIterator = CIBlockElement::GetList(array(), $filter, false, false, $select);
while ($element = $elementIterator->Fetch()) {
if (empty($element[$propertyValue])) {
continue;
}
if (is_array($element[$propertyValue])) {
foreach ($element[$propertyValue] as &$recId) {
$recId = (int) $recId;
if ($recId > 0) {
$arRecomendet[$recId] = true;
}
}
unset($recId);
} else {
$recId = (int) $element[$propertyValue];
if ($recId > 0) {
$arRecomendet[$recId] = true;
}
}
}
}
unset($element, $elementIterator, $select, $filter, $propertyValue, $propertyID, $iblockID, $propertyList);
if (!empty($arRecomendet)) {
$arRecomendet = array_keys($arRecomendet);
$arBuyerGroups = CUser::GetUserGroup($USER_ID);
$arFilter = array("ID" => $arRecomendet, "ACTIVE" => "Y");
$rsElement = CIBlockElement::GetList(array(), $arFilter, false, false, array("NAME", "ID", "LID", 'IBLOCK_ID', 'IBLOCK_SECTION_ID', "DETAIL_PICTURE", "PREVIEW_PICTURE", "DETAIL_PAGE_URL"));
$currentVatMode = CCatalogProduct::getPriceVatIncludeMode();
$currentUseDiscount = CCatalogProduct::getUseDiscount();
CCatalogProduct::setUseDiscount(true);
CCatalogProduct::setPriceVatIncludeMode(true);
CCatalogProduct::setUsedCurrency(CSaleLang::GetLangCurrency($LID));
$i = 0;
while ($arElement = $rsElement->GetNext()) {
if (in_array($arElement["ID"], $arFilterRecomendet)) {
continue;
}
if ($recomMore == "N" && $i < $cntProductDefault || $recomMore == "Y") {
$arElement["MODULE"] = "catalog";
$arElement["PRODUCT_PROVIDER_CLASS"] = "CCatalogProductProvider";
$arElement["PRODUCT_ID"] = $arElement["ID"];
$arPrice = CCatalogProduct::GetOptimalPrice($arElement["ID"], 1, $arBuyerGroups, "N", array(), $LID, array());
$currentPrice = $arPrice['RESULT_PRICE']['DISCOUNT_PRICE'];
$arElement["PRICE"] = $currentPrice;
$arElement["CURRENCY"] = $arPrice["RESULT_PRICE"]["CURRENCY"];
$arElement["DISCOUNT_PRICE"] = $arPrice['RESULT_PRICE']['DISCOUNT'];
if ($arElement["IBLOCK_ID"] > 0 && $arElement["IBLOCK_SECTION_ID"] > 0) {
$arElement["EDIT_PAGE_URL"] = CIBlock::GetAdminElementEditLink($arElement["IBLOCK_ID"], $arElement["PRODUCT_ID"], array("find_section_section" => $arElement["IBLOCK_SECTION_ID"], 'WF' => 'Y'));
}
$arRecomendetResult[] = $arElement;
$i++;
}
}
CCatalogProduct::clearUsedCurrency();
CCatalogProduct::setPriceVatIncludeMode($currentVatMode);
CCatalogProduct::setUseDiscount($currentUseDiscount);
unset($currentUseDiscount, $currentVatMode);
}
}
return $arRecomendetResult;
}
示例4: OrderProduct
//.........这里部分代码省略.........
}
}
else
{
return $arResult;
}
if (0 < $intUserID)
{
$arCoupons = CCatalogDiscountCoupon::GetCouponsByManage($intUserID);
CCatalogDiscountSave::SetDiscountUserID($intUserID);
}
else
{
$arCoupons = CCatalogDiscountCoupon::GetCoupons();
}
$userGroups = ($intUserID > 0 ? $arUserCache[$intUserID] : $USER->GetUserGroupArray());
$currentVatMode = CCatalogProduct::getPriceVatIncludeMode();
$currentUseDiscount = CCatalogProduct::getUseDiscount();
CCatalogProduct::setUseDiscount($arParams['CHECK_DISCOUNT'] == 'Y');
CCatalogProduct::setPriceVatIncludeMode(true);
CCatalogProduct::setUsedCurrency($arParams['CURRENCY']);
$arPrice = CCatalogProduct::GetOptimalPrice($productID, $quantity, $userGroups, $renewal, array(), (0 < $intUserID ? $strSiteID : false), $arCoupons);
if (empty($arPrice))
{
if ($nearestQuantity = CCatalogProduct::GetNearestQuantityPrice($productID, $quantity, $userGroups))
{
$quantity = $nearestQuantity;
$arPrice = CCatalogProduct::GetOptimalPrice($productID, $quantity, $userGroups, $renewal, array(), (0 < $intUserID ? $strSiteID : false), $arCoupons);
}
}
CCatalogProduct::clearUsedCurrency();
CCatalogProduct::setPriceVatIncludeMode($currentVatMode);
CCatalogProduct::setUseDiscount($currentUseDiscount);
unset($userGroups, $currentUseDiscount, $currentVatMode);
if (0 < $intUserID)
{
CCatalogDiscountSave::ClearDiscountUserID();
}
if (empty($arPrice))
{
return $arResult;
}
$arDiscountList = array();
$arCouponList = array();
if (!empty($arPrice["DISCOUNT_LIST"]))
{
foreach ($arPrice["DISCOUNT_LIST"] as &$arOneDiscount)
{
$arOneList = array(
'ID' => $arOneDiscount['ID'],
'NAME' => $arOneDiscount['NAME'],
'COUPON' => '',
'COUPON_TYPE' => '',
'MODULE_ID' => (isset($oneDiscount['MODULE_ID']) ? $oneDiscount['MODULE_ID'] : 'catalog'),
'TYPE' => $arOneDiscount['TYPE'],
'VALUE' => $arOneDiscount['VALUE'],
'VALUE_TYPE' => $arOneDiscount['VALUE_TYPE'],
'CURRENCY' => $arOneDiscount['CURRENCY'],
'HANDLERS' => (isset($arOneDiscount['HANDLERS']) ? $arOneDiscount['HANDLERS'] : array())
);