本文整理汇总了PHP中CCatalogDiscountSave类的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogDiscountSave类的具体用法?PHP CCatalogDiscountSave怎么用?PHP CCatalogDiscountSave使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCatalogDiscountSave类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: Add
public function Add($arFields, $boolCalc = false)
{
global $DB;
if (!CCatalogDiscountSave::CheckFields("ADD", $arFields)) {
return false;
}
$arInsert = $DB->PrepareInsert("b_catalog_discount", $arFields);
$strSql = "INSERT INTO b_catalog_discount(" . $arInsert[0] . ") VALUES(" . $arInsert[1] . ")";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$ID = intval($DB->LastID());
if ($ID > 0) {
foreach ($arFields['RANGES'] as &$arRange) {
$arRange['DISCOUNT_ID'] = $ID;
$arInsert = $DB->PrepareInsert("b_catalog_disc_save_range", $arRange);
$strSql = "INSERT INTO b_catalog_disc_save_range(" . $arInsert[0] . ") VALUES(" . $arInsert[1] . ")";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
foreach ($arFields['GROUP_IDS'] as &$intGroupID) {
$strSql = "INSERT INTO b_catalog_disc_save_group(DISCOUNT_ID,GROUP_ID) VALUES(" . $ID . "," . $intGroupID . ")";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
$boolCalc = $boolCalc === true ? true : false;
if ($boolCalc) {
CCatalogDiscountSave::UserDiscountCalc($ID, $arFields, false);
}
}
return $ID;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:28,代码来源:discount_save.php
示例2: __AddRangeCellDiscount
function __AddRangeCellDiscount($intRangeID, $strPrefix, $arRange)
{
static $discsaveTypes = null;
if ($discsaveTypes === null) {
$discsaveTypes = CCatalogDiscountSave::GetDiscountSaveTypes(true);
}
$result = '<td><input type="text" name="' . $strPrefix . $intRangeID . '_VALUE" size="13" value="' . htmlspecialcharsbx($arRange['VALUE']) . '"> <select name="' . $strPrefix . $intRangeID . '_TYPE" style="width:150px;">';
foreach ($discsaveTypes as $key => $value) {
$result .= '<option value="' . $key . '" ' . ($key == $arRange['TYPE'] ? 'selected' : '') . '>' . $value . '</option>';
}
$result .= '</select></td>';
return $result;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:13,代码来源:cat_discsave_edit.php
示例3: Update
public function Update($intID, $arFields, $boolCalc = false)
{
global $DB;
$intID = (int) $intID;
if ($intID <= 0) {
return false;
}
if (!CCatalogDiscountSave::CheckFields('UPDATE', $arFields, $intID)) {
return false;
}
$strUpdate = $DB->PrepareUpdate("b_catalog_discount", $arFields);
if (!empty($strUpdate)) {
$strSql = "update b_catalog_discount SET " . $strUpdate . " where ID = " . $intID . " and TYPE = " . self::ENTITY_ID;
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
if (!empty($arFields['RANGES'])) {
$DB->Query("delete from b_catalog_disc_save_range where DISCOUNT_ID = " . $intID, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
foreach ($arFields['RANGES'] as &$arRange) {
$arRange['DISCOUNT_ID'] = $intID;
$arInsert = $DB->PrepareInsert("b_catalog_disc_save_range", $arRange);
$strSql = "insert into b_catalog_disc_save_range(" . $arInsert[0] . ") values(" . $arInsert[1] . ")";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
unset($arRange);
}
if (!empty($arFields['GROUP_IDS'])) {
$DB->Query("delete from b_catalog_disc_save_group where DISCOUNT_ID = " . $intID, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
foreach ($arFields['GROUP_IDS'] as &$intGroupID) {
$strSql = "insert into b_catalog_disc_save_group(DISCOUNT_ID,GROUP_ID) values(" . $intID . "," . $intGroupID . ")";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
unset($intGroupID);
}
$boolCalc = $boolCalc === true;
if ($boolCalc) {
CCatalogDiscountSave::UserDiscountCalc($intID, $arFields, false);
}
return $intID;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:39,代码来源:discount_save.php
示例4: GetDiscount
//.........这里部分代码省略.........
}
if (isset($arCatalogGroups)) {
if (is_array($arCatalogGroups)) {
array_walk($arCatalogGroups, create_function("&\$item", "\$item=intval(\$item);"));
$arCatalogGroups = array_unique($arCatalogGroups);
} else {
if (intval($arCatalogGroups) . "|" == $arCatalogGroups . "|") {
$arCatalogGroups = array(intval($arCatalogGroups));
} else {
$arCatalogGroups = array();
}
}
} else {
$arCatalogGroups = array();
}
if (!is_array($arUserGroups) && intval($arUserGroups) . "|" == $arUserGroups . "|") {
$arUserGroups = array(intval($arUserGroups));
}
if (!is_array($arUserGroups)) {
$arUserGroups = array();
}
if (!in_array(2, $arUserGroups)) {
$arUserGroups[] = 2;
}
$strRenewal = $strRenewal == "Y" ? "Y" : "N";
if ($siteID === false) {
$siteID = SITE_ID;
}
if ($arDiscountCoupons === false) {
$arDiscountCoupons = CCatalogDiscountCoupon::GetCoupons();
}
$arSKU = false;
if ($boolSKU) {
$arSKU = CCatalogSKU::GetProductInfo($intProductID, $intIBlockID);
if (!is_array($arSKU)) {
$boolSKU = false;
}
}
$arResult = array();
$arResultID = array();
$arFilter = array('PRICE_TYPE_ID' => $arCatalogGroups, 'USER_GROUP_ID' => $arUserGroups);
$arDiscountIDs = CCatalogDiscount::__GetDiscountID($arFilter);
if (!empty($arDiscountIDs)) {
$boolGenerate = false;
$arSelect = array("ID", "TYPE", "SITE_ID", "ACTIVE", "ACTIVE_FROM", "ACTIVE_TO", "RENEWAL", "NAME", "SORT", "MAX_DISCOUNT", "VALUE_TYPE", "VALUE", "CURRENCY", "PRIORITY", "LAST_DISCOUNT", "COUPON", "COUPON_ONE_TIME", "COUPON_ACTIVE", 'UNPACK');
$strDate = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")));
$arFilter = array("ID" => $arDiscountIDs, "SITE_ID" => $siteID, "TYPE" => DISCOUNT_TYPE_STANDART, "ACTIVE" => "Y", "RENEWAL" => $strRenewal, "+<=ACTIVE_FROM" => $strDate, "+>=ACTIVE_TO" => $strDate);
if (is_array($arDiscountCoupons)) {
$arFilter["+COUPON"] = $arDiscountCoupons;
}
$rsPriceDiscounts = CCatalogDiscount::GetList(array(), $arFilter, false, false, $arSelect);
while ($arPriceDiscount = $rsPriceDiscounts->Fetch()) {
if ($arPriceDiscount['COUPON_ACTIVE'] != 'N') {
if (!$boolGenerate) {
$arProduct = array('ID' => $intProductID, 'IBLOCK_ID' => $intIBlockID);
if (!self::__GenerateFields($arProduct)) {
return false;
}
$boolGenerate = true;
}
if (CCatalogDiscount::__Unpack($arProduct, $arPriceDiscount['UNPACK'])) {
unset($arPriceDiscount['UNPACK']);
$arResult[] = $arPriceDiscount;
$arResultID[] = $arPriceDiscount['ID'];
}
}
}
}
if ($boolSKU) {
$arDiscountParent = CCatalogDiscount::GetDiscount($arSKU['ID'], $arSKU['IBLOCK_ID'], $arCatalogGroups, $arUserGroups, $strRenewal, $siteID, $arDiscountCoupons, false, false);
if (!empty($arDiscountParent)) {
if (empty($arResult)) {
$arResult = $arDiscountParent;
} else {
foreach ($arDiscountParent as &$arOneParentDiscount) {
if (in_array($arOneParentDiscount['ID'], $arResultID)) {
continue;
}
$arResult[] = $arOneParentDiscount;
$arResultID[] = $arOneParentDiscount['ID'];
}
if (isset($arOneParentDiscount)) {
unset($arOneParentDiscount);
}
}
}
}
if (!$boolGetIDS) {
$arDiscSave = CCatalogDiscountSave::GetDiscount(array('USER_ID' => 0, 'USER_GROUPS' => $arUserGroups, 'SITE_ID' => $siteID));
if (!empty($arDiscSave)) {
$arResult = !empty($arResult) ? array_merge($arResult, $arDiscSave) : $arDiscSave;
}
} else {
$arResult = $arResultID;
}
foreach (GetModuleEvents("catalog", "OnGetDiscountResult", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$arResult));
}
return $arResult;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:discount.php
示例5: OrderProduct
public static function OrderProduct($arParams)
{
if (!is_set($arParams, "RENEWAL") || $arParams["RENEWAL"] != "Y") {
$arParams["RENEWAL"] = "N";
}
if (!is_set($arParams, "USER_ID") || IntVal($arParams["USER_ID"]) <= 0) {
$arParams["USER_ID"] = 0;
}
if (!is_set($arParams["SITE_ID"])) {
$arParams["SITE_ID"] = false;
}
global $USER;
global $DB;
$productID = intval($arParams["PRODUCT_ID"]);
$quantity = doubleval($arParams["QUANTITY"]);
$renewal = $arParams["RENEWAL"] == "Y" ? "Y" : "N";
$strSiteID = $arParams["SITE_ID"];
$intUserID = intval($arParams["USER_ID"]);
if (0 > $intUserID) {
$intUserID = 0;
}
$arResult = array();
static $arUserCache = array();
if (0 < $intUserID) {
if (!array_key_exists($intUserID, $arUserCache)) {
$rsUsers = CUser::GetList($by = 'ID', $order = 'DESC', array("ID_EQUAL_EXACT" => $intUserID), array('FIELDS' => array('ID')));
if ($arUser = $rsUsers->Fetch()) {
$arUserCache[$arUser['ID']] = CUser::GetUserGroup($arUser['ID']);
} else {
$intUserID = 0;
return $arResult;
}
}
$dbIBlockElement = CIBlockElement::GetList(array(), array("ID" => $productID, "ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "CHECK_PERMISSION" => "N"), false, false, array('ID', 'IBLOCK_ID', 'NAME', 'DETAIL_PAGE_URL'));
if (!($arProduct = $dbIBlockElement->GetNext())) {
return $arResult;
}
if ('E' == CIBlock::GetArrayByID($arProduct['IBLOCK_ID'], "RIGHTS_MODE")) {
$arUserRights = CIBlockElementRights::GetUserOperations($productID, $intUserID);
if (empty($arUserRights)) {
return $arResult;
} elseif (!is_array($arUserRights) || !array_key_exists('element_read', $arUserRights)) {
return $arResult;
}
} else {
if ('R' > CIBlock::GetPermission($arProduct['IBLOCK_ID'], $intUserID)) {
return $arResult;
}
}
} else {
$dbIBlockElement = CIBlockElement::GetList(array(), array("ID" => $productID, "ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "CHECK_PERMISSIONS" => "Y", "MIN_PERMISSION" => "R"), false, false, array('ID', 'IBLOCK_ID', 'NAME', 'DETAIL_PAGE_URL'));
if (!($arProduct = $dbIBlockElement->GetNext())) {
return $arResult;
}
}
if ($arCatalogProduct = CCatalogProduct::GetByID($productID)) {
if ($arCatalogProduct["CAN_BUY_ZERO"] != "Y" && ($arCatalogProduct["QUANTITY_TRACE"] == "Y" && doubleval($arCatalogProduct["QUANTITY"]) < doubleVal($quantity))) {
return $arResult;
}
} else {
return $arResult;
}
if (0 < $intUserID) {
$arCoupons = CCatalogDiscountCoupon::GetCouponsByManage($intUserID);
CCatalogDiscountSave::SetDiscountUserID($intUserID);
} else {
$arCoupons = CCatalogDiscountCoupon::GetCoupons();
}
$arPrice = CCatalogProduct::GetOptimalPrice($productID, $quantity, 0 < $intUserID ? $arUserCache[$intUserID] : $USER->GetUserGroupArray(), $renewal, array(), 0 < $intUserID ? $strSiteID : false, $arCoupons);
if (empty($arPrice)) {
if ($nearestQuantity = CCatalogProduct::GetNearestQuantityPrice($productID, $quantity, 0 < $intUserID ? $arUserCache[$intUserID] : $USER->GetUserGroupArray())) {
$quantity = $nearestQuantity;
$arPrice = CCatalogProduct::GetOptimalPrice($productID, $quantity, 0 < $intUserID ? $arUserCache[$intUserID] : $USER->GetUserGroupArray(), $renewal, array(), 0 < $intUserID ? $strSiteID : false, $arCoupons);
}
}
if (empty($arPrice)) {
if (0 < $intUserID) {
CCatalogDiscountSave::ClearDiscountUserID();
}
return $arResult;
}
$boolDiscountVat = 'N' != COption::GetOptionString('catalog', 'discount_vat', 'Y');
$currentPrice = $arPrice["PRICE"]["PRICE"];
$currentDiscount = 0.0;
if ($boolDiscountVat) {
if ('N' == $arPrice['PRICE']['VAT_INCLUDED']) {
$currentPrice *= 1 + $arPrice['PRICE']['VAT_RATE'];
$arPrice['PRICE']['VAT_INCLUDED'] = 'Y';
}
} else {
if ('Y' == $arPrice['PRICE']['VAT_INCLUDED']) {
$currentPrice /= 1 + $arPrice['PRICE']['VAT_RATE'];
$arPrice['PRICE']['VAT_INCLUDED'] = 'N';
}
}
$arDiscountList = array();
$arCouponList = array();
if (!empty($arPrice["DISCOUNT_LIST"])) {
$dblStartPrice = $currentPrice;
foreach ($arPrice["DISCOUNT_LIST"] as &$arOneDiscount) {
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:product_provider.php
示例6: PreGenerateImport
function PreGenerateImport($profile_id)
{
global $DB;
$profile_id = IntVal($profile_id);
if ($profile_id <= 0) {
return false;
}
$ar_profile = CCatalogImport::GetByID($profile_id);
if (!$ar_profile || 'Y' == $ar_profile['NEED_EDIT']) {
return false;
}
if ($ar_profile["DEFAULT_PROFILE"] != "Y") {
parse_str($ar_profile["SETUP_VARS"]);
}
$bFirstLoadStep = True;
if (!defined("CATALOG_LOAD_NO_STEP")) {
define("CATALOG_LOAD_NO_STEP", true);
}
CCatalogDiscountSave::Disable();
$strFile = CATALOG_PATH2IMPORTS . $ar_profile["FILE_NAME"] . "_run.php";
if (!file_exists($_SERVER["DOCUMENT_ROOT"] . $strFile)) {
$strFile = CATALOG_PATH2IMPORTS_DEF . $ar_profile["FILE_NAME"] . "_run.php";
if (!file_exists($_SERVER["DOCUMENT_ROOT"] . $strFile)) {
CCatalogDiscountSave::Enable();
return false;
}
}
$strImportErrorMessage = "";
$strImportOKMessage = "";
$bAllDataLoaded = True;
@(include $_SERVER["DOCUMENT_ROOT"] . $strFile);
CCatalogDiscountSave::Enable();
CCatalogImport::Update($profile_id, array("=LAST_USE" => $DB->GetNowFunction()));
return "CCatalogImport::PreGenerateImport(" . $profile_id . ");";
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:35,代码来源:catalog_import.php
示例7: GetDiscount
//.........这里部分代码省略.........
$strCacheKey .= '-C' . implode('|', $arDiscountCoupons);
}
$strCacheKey = md5($strCacheKey);
if (!isset(self::$arCacheDiscountResult[$strCacheKey])) {
$arDiscountList = array();
$arSelect = array('ID', 'TYPE', 'SITE_ID', 'ACTIVE', 'ACTIVE_FROM', 'ACTIVE_TO', 'RENEWAL', 'NAME', 'SORT', 'MAX_DISCOUNT', 'VALUE_TYPE', 'VALUE', 'CURRENCY', 'PRIORITY', 'LAST_DISCOUNT', 'COUPON', 'COUPON_ONE_TIME', 'COUPON_ACTIVE', 'UNPACK', 'CONDITIONS');
$strDate = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")));
$discountRows = array_chunk($arDiscountIDs, 500);
foreach ($discountRows as &$row) {
$arFilter = array('@ID' => $row, 'SITE_ID' => $siteID, 'TYPE' => self::ENTITY_ID, 'RENEWAL' => $strRenewal, '+<=ACTIVE_FROM' => $strDate, '+>=ACTIVE_TO' => $strDate);
if (is_array($arDiscountCoupons)) {
$arFilter['+COUPON'] = $arDiscountCoupons;
}
CTimeZone::Disable();
$rsPriceDiscounts = CCatalogDiscount::GetList(array(), $arFilter, false, false, $arSelect);
CTimeZone::Enable();
while ($arPriceDiscount = $rsPriceDiscounts->Fetch()) {
$arPriceDiscount['HANDLERS'] = array();
$arPriceDiscount['MODULE_ID'] = 'catalog';
$arDiscountList[] = $arPriceDiscount;
}
}
unset($row, $discountRows);
self::$arCacheDiscountResult[$strCacheKey] = $arDiscountList;
} else {
$arDiscountList = self::$arCacheDiscountResult[$strCacheKey];
}
if (!empty($arDiscountList)) {
$discountApply = array();
foreach ($arDiscountList as &$arPriceDiscount) {
if (!isset($discountApply[$arPriceDiscount['ID']]) && $arPriceDiscount['COUPON_ACTIVE'] != 'N') {
if (!$boolGenerate) {
if (!isset(self::$arCacheProduct[$intProductID])) {
$arProduct = array('ID' => $intProductID, 'IBLOCK_ID' => $intIBlockID);
if (!self::__GenerateFields($arProduct)) {
return false;
}
if ($boolSKU) {
if (!self::__GenerateParent($arProduct, $arSKUExt)) {
$boolSKU = false;
}
}
$boolGenerate = true;
self::$arCacheProduct[$intProductID] = $arProduct;
} else {
$boolGenerate = true;
$arProduct = self::$arCacheProduct[$intProductID];
}
}
$discountApply[$arPriceDiscount['ID']] = true;
$applyFlag = true;
if (isset(self::$cacheDiscountHandlers[$arPriceDiscount['ID']])) {
$arPriceDiscount['HANDLERS'] = self::$cacheDiscountHandlers[$arPriceDiscount['ID']];
$moduleList = self::$cacheDiscountHandlers[$arPriceDiscount['ID']]['MODULES'];
if (!empty($moduleList)) {
foreach ($moduleList as &$moduleID) {
if (!isset(self::$usedModules[$moduleID])) {
self::$usedModules[$moduleID] = Loader::includeModule($moduleID);
}
if (!self::$usedModules[$moduleID]) {
$applyFlag = false;
break;
}
}
unset($moduleID);
}
unset($moduleList);
}
if ($applyFlag && CCatalogDiscount::__Unpack($arProduct, $arPriceDiscount['UNPACK'])) {
$arResult[] = $arPriceDiscount;
$arResultID[] = $arPriceDiscount['ID'];
}
}
}
if (isset($arPriceDiscount)) {
unset($arPriceDiscount);
}
unset($discountApply);
}
}
if (!$boolGetIDS) {
$arDiscSave = CCatalogDiscountSave::GetDiscount(array('USER_ID' => 0, 'USER_GROUPS' => $arUserGroups, 'SITE_ID' => $siteID));
if (!empty($arDiscSave)) {
$arResult = !empty($arResult) ? array_merge($arResult, $arDiscSave) : $arDiscSave;
}
} else {
$arResult = $arResultID;
}
}
if ($eventOnResultExists === true || $eventOnResultExists === null) {
foreach (GetModuleEvents("catalog", "OnGetDiscountResult", true) as $arEvent) {
$eventOnResultExists = true;
ExecuteModuleEventEx($arEvent, array(&$arResult));
}
if ($eventOnResultExists === null) {
$eventOnResultExists = false;
}
}
return $arResult;
}
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:discount.php
示例8: unset
}
if ($res != "") {
$v .= ($v != '' ? ' / ' : '') . $res;
}
}
if ($v != "") {
$row->AddViewField("PROPERTY_" . $aProp['ID'], $v);
}
unset($arSelectedProps[$aProp['ID']]["CACHE"]);
}
foreach ($arPrices as $price) {
$row->AddViewField("PRICE" . $price['ID'], $arPricesResult[$price['ID']][$arItems["ID"]]);
}
}
}
CCatalogDiscountSave::Enable();
$lAdmin->BeginEpilogContent();
?>
<script type="text/javascript">
<?php
if (!empty($arSku)) {
foreach ($arSku as $k => $v) {
?>
if(BX('sku-<?php
echo $v;
?>
'))
BX.hide(BX('sku-<?php
echo $v;
?>
').parentNode.parentNode);
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:cat_store_product_search.php
示例9: define
define('CATALOG_NEW_OFFERS_IBLOCK_NEED','-1');
$bReadOnly = !$USER->CanDoOperation('catalog_settings');
if ($USER->CanDoOperation('catalog_read') || !$bReadOnly)
{
Loader::includeModule('catalog');
Loc::loadMessages(__FILE__);
$useSaleDiscountOnly = false;
$saleIsInstalled = ModuleManager::isModuleInstalled('sale');
if ($saleIsInstalled)
{
$useSaleDiscountOnly = (string)Option::get('sale', 'use_sale_discount_only') == 'Y';
}
$applyDiscSaveModeList = CCatalogDiscountSave::GetApplyModeList(true);
if ($_SERVER['REQUEST_METHOD'] == 'GET' && !empty($_REQUEST['RestoreDefaults']) && !$bReadOnly && check_bitrix_sessid())
{
if (!$USER->IsAdmin())
$strValTmp = Option::get('catalog', 'avail_content_groups');
Option::delete('catalog', array());
$z = CGroup::GetList(($v1="id"),($v2="asc"), array("ACTIVE" => "Y", "ADMIN" => "N"));
while($zr = $z->Fetch())
$APPLICATION->DelGroupRight($module_id, array($zr["ID"]));
if (!$USER->IsAdmin())
Option::set('catalog', 'avail_content_groups', $strValTmp, '');
}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:30,代码来源:options.php
示例10: array
$arCurrencyList[$arCurrency['CURRENCY']] = $arCurrency['CURRENCY'];
}
}
$arPeriodTypeList = CCatalogDiscountSave::GetPeriodTypeList(true);
$arUserList = array();
$arUserID = array();
$strNameFormat = CSite::GetNameFormat(true);
$arNavParams = (isset($_REQUEST["mode"]) && "excel" == $_REQUEST["mode"]
? false
: array("nPageSize" => CAdminResult::GetNavSize($sTableID))
);
$obDiscSave = new CCatalogDiscountSave();
$rsDiscSaves = $obDiscSave->GetList(
array($by=>$order),
$arFilter,
false,
$arNavParams,
$arSelectFields
);
$rsDiscSaves = new CAdminResult($rsDiscSaves, $sTableID);
$rsDiscSaves->NavStart();
$lAdmin->NavText($rsDiscSaves->GetNavPrint(GetMessage("BT_CAT_DISC_SAVE_ADM_DISCOUNTS")));
$arRows = array();
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:cat_discsave_admin.php
示例11: PreGenerateImport
/**
* <p>Метод выполняет профиль <i>profile_id</i> на агенте.</p>
*
*
*
*
* @param int $profile_id Код выполняемого профиля.
*
*
*
* @return mixed <p>В случае успешного выполнения профиля импорта метод возвращает
* строку для следующего вызова агента. В противном случае метод
* вернет <i>false</i>.</p><br><br>
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogimport/pregenerateimport.php
* @author Bitrix
*/
public static function PreGenerateImport($profile_id)
{
global $DB;
$profile_id = intval($profile_id);
if ($profile_id <= 0)
return false;
$ar_profile = CCatalogImport::GetByID($profile_id);
if ((!$ar_profile) || ('Y' == $ar_profile['NEED_EDIT']))
return false;
$strFile = CATALOG_PATH2IMPORTS.$ar_profile["FILE_NAME"]."_run.php";
if (!file_exists($_SERVER["DOCUMENT_ROOT"].$strFile))
{
$strFile = CATALOG_PATH2IMPORTS_DEF.$ar_profile["FILE_NAME"]."_run.php";
if (!file_exists($_SERVER["DOCUMENT_ROOT"].$strFile))
{
CCatalogDiscountSave::Enable();
return false;
}
}
$bFirstLoadStep = true;
if (!defined("CATALOG_LOAD_NO_STEP"))
// define("CATALOG_LOAD_NO_STEP", true);
$strImportErrorMessage = "";
$strImportOKMessage = "";
$bAllDataLoaded = true;
$arSetupVars = array();
$intSetupVarsCount = 0;
if ('Y' != $ar_profile["DEFAULT_PROFILE"])
{
parse_str($ar_profile["SETUP_VARS"], $arSetupVars);
if (!empty($arSetupVars) && is_array($arSetupVars))
{
$intSetupVarsCount = extract($arSetupVars, EXTR_SKIP);
}
}
CCatalogDiscountSave::Disable();
include($_SERVER["DOCUMENT_ROOT"].$strFile);
CCatalogDiscountSave::Enable();
CCatalogImport::Update($profile_id, array(
"=LAST_USE" => $DB->GetNowFunction()
)
);
return "CCatalogImport::PreGenerateImport(".$profile_id.");";
}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:73,代码来源:catalog_import.php
示例12: GetItemPrices
public static function GetItemPrices($IBLOCK_ID, $arCatalogPrices, $arItem, $bVATInclude = true, $arCurrencyParams = array(), $USER_ID = 0, $LID = SITE_ID)
{
$arPrices = array();
if (empty($arCatalogPrices) || !is_array($arCatalogPrices))
{
return $arPrices;
}
global $USER;
static $arCurUserGroups = array();
static $strBaseCurrency = '';
if (self::$catalogIncluded === null)
self::$catalogIncluded = \Freetrix\Main\Loader::includeModule('catalog');
if (self::$catalogIncluded)
{
$USER_ID = intval($USER_ID);
$intUserID = $USER_ID;
if (0 >= $intUserID)
$intUserID = $USER->GetID();
if (!isset($arCurUserGroups[$intUserID]))
{
$arUserGroups = (0 < $USER_ID ? CUser::GetUserGroup($USER_ID) : $USER->GetUserGroupArray());
CatalogClearArray($arUserGroups);
$arCurUserGroups[$intUserID] = $arUserGroups;
}
else
{
$arUserGroups = $arCurUserGroups[$intUserID];
}
$boolConvert = false;
$strCurrencyID = '';
if (isset($arCurrencyParams['CURRENCY_ID']) && !empty($arCurrencyParams['CURRENCY_ID']))
{
$boolConvert = true;
$strCurrencyID = $arCurrencyParams['CURRENCY_ID'];
}
if (!$boolConvert && '' == $strBaseCurrency)
$strBaseCurrency = CCurrency::GetBaseCurrency();
$strMinCode = '';
$boolStartMin = true;
$dblMinPrice = 0;
$strMinCurrency = ($boolConvert ? $strCurrencyID : $strBaseCurrency);
CCatalogDiscountSave::Disable();
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);
}
// so discounts will include VAT
$arDiscounts = CCatalogDiscount::GetDiscount(
$arItem["ID"],
$arItem["IBLOCK_ID"],
array($value["ID"]),
$arUserGroups,
"N",
$LID,
array()
);
$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" => CCurrencyLang::CurrencyFormat($dblNoVat, $strCurrencyID, true),
'ORIG_VALUE_VAT' => $vat_price,
"VALUE_VAT" => $dblVatPrice,
"PRINT_VALUE_VAT" => CCurrencyLang::CurrencyFormat($dblVatPrice, $strCurrencyID, true),
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:open_bx,代码行数:101,代码来源:comp_pricetools.php
示例13: array
$arCellTemplates = array();
$arCellTemplates[] = CUtil::JSEscape(__AddRangeCellSum('tmp_xxx', 'PREFIX', $arRange));
$arCellTemplates[] = CUtil::JSEscape(__AddRangeCellDiscount('tmp_xxx', 'PREFIX', $arRange));
$message = false;
$aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("BT_CAT_DISC_SAVE_EDIT_TAB_NAME_MAIN"), "ICON" => "catalog", "TITLE" => GetMessage("BT_CAT_DISC_SAVE_EDIT_TAB_TITLE_MAIN")), array("DIV" => "edit2", "TAB" => GetMessage("BT_CAT_DISC_SAVE_EDIT_TAB_NAME_RANGES"), "ICON" => "catalog", "TITLE" => GetMessage("BT_CAT_DISC_SAVE_EDIT_TAB_TITLE_RANGES")), array("DIV" => "edit3", "TAB" => GetMessage("BT_CAT_DISC_SAVE_EDIT_TAB_NAME_GROUPS"), "ICON" => "catalog", "TITLE" => GetMessage("BT_CAT_DISC_SAVE_EDIT_TAB_TITLE_GROUPS")), array("DIV" => "edit4", "TAB" => GetMessage("BT_CAT_DISC_SAVE_EDIT_TAB_NAME_MISC"), "ICON" => "catalog", "TITLE" => GetMessage("BT_CAT_DISC_SAVE_EDIT_TAB_TITLE_MISC")));
$tabControl = new CAdminForm("cat_disc_save", $aTabs);
$ID = intval($ID);
$bVarsFromForm = false;
$arErrors = array();
$boolCopy = false;
if (0 < $ID) {
$boolCopy = isset($_REQUEST['action']) && 'copy' == $_REQUEST['action'];
}
if ($_SERVER['REQUEST_METHOD'] == "POST" && (!empty($save) || !empty($apply)) && !$bReadOnly && check_bitrix_sessid()) {
$APPLICATION->ResetException();
$obDiscSave = new CCatalogDiscountSave();
if (isset($_POST['ACTION_PERIOD'])) {
$ACTION_PERIOD = substr(trim($_POST['ACTION_PERIOD']), 0, 1);
if ('D' == $ACTION_PERIOD) {
if (empty($_POST['ACTIVE_FROM']) && empty($_POST['ACTIVE_TO'])) {
$arErrors[] = array('id' => 'ACTIVE_FROM', "text" => GetMessage('BT_CAT_DISC_SAVE_EDIT_ERR_ACTION_DATE_EMPTY'));
$bVarsFromForm = true;
} else {
$_POST['ACTION_SIZE'] = 0;
$_POST['ACTION_TYPE'] = 'Y';
$ACTION_SIZE = 0;
$ACTION_TYPE = 'Y';
}
} elseif ('P' == $ACTION_PERIOD) {
if (0 >= intval($_POST['ACTION_SIZE']) || empty($_POST['ACTION_TYPE'])) {
$arErrors[] = array('id' => 'ACTION_SIZE', "text" => GetMessage('BT_CAT_DISC_SAVE_EDIT_ERR_ACTION_SIZE_EMPTY'));
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:cat_discsave_edit.php
示例14: OrderProduct
//.........这里部分代码省略.........
'QUANTITY',
'WEIGHT',
'WIDTH',
'HEIGHT',
'LENGTH',
'BARCODE_MULTI',
'TYPE'
)
);
if ($arCatalogProduct = $rsProducts->Fetch())
{
$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 (0 < $intUserID)
{
$arCoupons = CCatalogDiscountCoupon::GetCouponsByManage($intUserID);
CCatalogDiscountSave::SetDiscountUserID($intUserID);
}
else
{
$arCoupons = CCatalogDiscountCoupon::GetCoupons();
}
$arPrice = CCatalogProduct::GetOptimalPrice($productID, $quantity, (0 < $intUserID ? $arUserCache[$intUserID] : $USER->GetUserGroupArray()), $renewal, array(), (0 < $intUserID ? $strSiteID : false), $arCoupons);
if (empty($arPrice))
{
if ($nearestQuantity = CCatalogProduct::GetNearestQuantityPrice($productID, $quantity, (0 < $intUserID ? $arUserCache[$intUserID] : $USER->GetUserGroupArray())))
{
$quantity = $nearestQuantity;
$arPrice = CCatalogProduct::GetOptimalPrice($productID, $quantity, (0 < $intUserID ? $arUserCache[$intUserID] : $USER->GetUserGroupArray()), $renewal, array(), (0 < $intUserID ? $strSiteID : false), $arCoupons);
}
}
if (empty($arPrice))
{
if (0 < $intUserID)
{
CCatalogDiscountSave::ClearDiscountUserID();
}
return $arResult;
}
$boolDiscountVat = ('N' != COption::GetOptionString('catalog', 'discount_vat', 'Y'));
$currentPrice = $arPrice["PRICE"]["PRICE"];
$currentDiscount = 0.0;
if ($boolDiscountVat)
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:67,代码来源:product_provider.php
示例15: intval
$arParams['USER_ID'] = intval($USER->GetID());
}
if (0 >= $arParams['USER_ID']) {
return;
}
$arParams['SHOW_NEXT_LEVEL'] = isset($arParams['SHOW_NEXT_LEVEL']) && 'Y' == $arParams['SHOW_NEXT_LEVEL'] ? 'Y' : 'N';
if (!CModule::IncludeModule('catalog')) {
return;
}
if (!CBXFeatures::IsFeatureEnabled('CatDiscountSave')) {
CCatalogDiscountSave::Disable();
ShowError(GetMessage("CAT_FEATURE_NOT_ALLOW"));
return;
}
$arFields = array('USER_ID' => $arParams['USER_ID'], 'SITE_ID' => $arParams['SITE_ID']);
$arResult = CCatalogDiscountSave::GetDiscount($arFields);
if (!empty($arResult)) {
foreach ($arResult as $key => $arDiscountSave) {
if ('Y' == $arParams['SHOW_NEXT_LEVEL']) {
$rsRanges = CCatalogDiscountSave::GetRangeByDiscount(array('RANGE_FROM' => 'ASC'), array('DISCOUNT_ID' => $arDiscountSave['ID'], '>RANGE_FROM' => $arDiscountSave['RANGE_FROM'], false, array('nTopCount' => 1)));
if ($arRange = $rsRanges->Fetch()) {
$arTempo = array('RANGE_FROM' => $arRange['RANGE_FROM'], 'VALUE' => $arRange['VALUE'], 'VALUE_TYPE' => $arRange['TYPE']);
$arDiscountSave['NEXT_LEVEL'] = $arTempo;
}
}
$arDiscountSave['~NAME'] = $arDiscountSave['NAME'];
$arDiscountSave['NAME'] = htmlspecialcharsex($arDiscountSave['NAME']);
$arResult[$key] = $arDiscountSave;
}
}
$this->IncludeComponentTemplate();
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php
示例16: GetDiscount
//.........这里部分代码省略.........
{
foreach ($arDiscountList as &$arPriceDiscount)
{
if ($arPriceDiscount['COUPON_ACTIVE'] != 'N')
{
if (!$boolGenerate)
{
if (!array_key_exists($intProductID, self::$arCacheProduct))
{
$arProduct = array('ID' => $intProductID, 'IBLOCK_ID' => $intIBlockID);
if (!self::__GenerateFields($arProduct))
return false;
$boolGenerate = true;
self::$arCacheProduct[$intProductID] = $arProduct;
}
else
{
$arProduct = self::$arCacheProduct[$intProductID];
}
}
if (CCatalogDiscount::__Unpack($arProduct, $arPriceDiscount['UNPACK']))
{
unset($arPriceDiscount['UNPACK']);
$arResult[] = $arPriceDiscount;
$arResultID[] = $arPriceDiscount['ID'];
}
}
}
if (isset($arPriceDiscount))
unset($arPriceDiscount);
}
}
if ($boolSKU)
{
$boolSKU = false;
$arSKU = false;
$arSKUExt = false;
$arSKUExt = CCatalogSKU::GetInfoByOfferIBlock($intIBlockID);
if (!empty($arSKUExt) && is_array($arSKUExt) && 0 < intval($arSKUExt['SKU_PROPERTY_ID']) && 0 < intval($arSKUExt['PRODUCT_IBLOCK_ID']))
{
if (array_key_exists('PROPERTY_'.$arSKUExt['SKU_PROPERTY_ID'].'_VALUE', $arProduct))
{
$arVal = $arProduct['PROPERTY_'.$arSKUExt['SKU_PROPERTY_ID'].'_VALUE'];
$arSKU = array(
'ID' => $arVal[0],
'IBLOCK_ID' => $arSKUExt['PRODUCT_IBLOCK_ID'],
);
$boolSKU = true;
}
}
}
if ($boolSKU)
{
$arDiscountParent = CCatalogDiscount::GetDiscount($arSKU['ID'], $arSKU['IBLOCK_ID'], $arCatalogGroups, $arUserGroups, $strRenewal, $siteID, $arDiscountCoupons, false, false);
if (!empty($arDiscountParent))
{
if (empty($arResult))
{
$arResult = $arDiscountParent;
}
else
{
foreach ($arDiscountParent as &$arOneParentDiscount)
{
if (in_array($arOneParentDiscount['ID'], $arResultID))
continue;
$arResult[] = $arOneParentDiscount;
$arResultID[] = $arOneParentDiscount['ID'];
}
if (isset($arOneParentDiscount))
unset($arOneParentDiscount);
}
}
}
if (!$boolGetIDS)
{
$arDiscSave = CCatalogDiscountSave::GetDiscount(array(
'USER_ID' => 0,
'USER_GROUPS' => $arUserGroups,
'SITE_ID' => $siteID
));
if (!empty($arDiscSave))
{
$arResult = (!empty($arResult) ? array_merge($arResult, $arDiscSave) : $arDiscSave);
}
}
else
{
$arResult = $arResultID;
}
foreach (GetModuleEvents("catalog", "OnGetDiscountResult", true) as $arEvent)
{
ExecuteModuleEventEx($arEvent, array(&$arResult));
}
return $arResult;
}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:discount.php
示例17: CatalogGetPriceTable
function CatalogGetPriceTable($ID)
{
global $USER;
$ID = (int) $ID;
if ($ID <= 0) {
return false;
}
$arResult = array();
$a
|
请发表评论