本文整理汇总了PHP中CCatalogProduct::GetTimePeriodTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogProduct::GetTimePeriodTypes方法的具体用法?PHP CCatalogProduct::GetTimePeriodTypes怎么用?PHP CCatalogProduct::GetTimePeriodTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogProduct
的用法示例。
在下文中一共展示了CCatalogProduct::GetTimePeriodTypes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckFields
/**
* <p>Метод служит для проверки параметров, переданных в методы <a href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogproductgroups/ccatalogproductgroups.add.php">CCatalogProductGroups::Add</a> и <a href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogproductgroups/ccatalogproductgroups.update.php">CCatalogProductGroups::Update</a>.</p>
*
*
*
*
* @param string $ACTION Указывает, для какого метода идет проверка. Возможные значения:
* <br><ul> <li> <b>ADD</b> - для метода <a
* href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogproductgroups/ccatalogproductgroups.add.php">CCatalogProductGroups::Add</a>;</li>
* <li> <b>UPDATE</b> - для метода <a
* href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogproductgroups/ccatalogproductgroups.update.php">CCatalogProductGroups::Update</a>.</li>
* </ul>
*
*
*
* @param array &$arFields Ассоциативный массив параметров информации о связи товаров и
* групп пользователей. Допустимые ключи: <ul> <li> <b>PRODUCT_ID</b> - код
* товара;</li> <li> <b>GROUP_ID</b> - код группы пользователей;</li> <li> <b>ACCESS_LENGTH</b>
* - длина периода, на который пользователь привязывается к группе
* пользователей при покупке товара (0 - навсегда);</li> <li>
* <b>ACCESS_LENGTH_TYPE</b> - тип периода, на который пользователь
* привязывается к группе пользователей при покупке товара ("H" - час,
* "D" - сутки, "W" - неделя, "M" - месяц, "Q" - квартал, "S" - полугодие, "Y" -
* год).</li> </ul>
*
*
*
* @param int $ID = 0 Код записи с информацией о связи товаров и групп пользователей, к
* которым пользователь привязывается при покупке товаров.
* Параметр является необязательным и имеет смысл только для $ACTION =
* 'UPDATE'.
*
*
*
* @return bool <p> В случае корректности переданных параметров возвращает true,
* иначе - false. Если функция вернула false, с помощью $APPLICATION->GetException()
* можно получить текст ошибок.</p>
*
*
* <h4>See Also</h4>
* <ul> <li><a href="http://dev.1c-bitrix.ru/api_help/catalog/fields.php">Структура таблицы</a></li> <li><a
* href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogproductgroups/ccatalogproductgroups.add.php">CCatalogProductGroups::Add</a></li>
* <li><a
* href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogproductgroups/ccatalogproductgroups.update.php">CCatalogProductGroups::Update</a></li>
* </ul> </ht<br><br>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogproductgroups/checkfields.php
* @author Bitrix
*/
public static function CheckFields($ACTION, &$arFields, $ID = 0)
{
if ((is_set($arFields, "PRODUCT_ID") || $ACTION == "ADD") && intval($arFields["PRODUCT_ID"]) <= 0) {
return false;
}
if ((is_set($arFields, "GROUP_ID") || $ACTION == "ADD") && intval($arFields["GROUP_ID"]) <= 0) {
return false;
}
if (is_set($arFields, "ACCESS_LENGTH") || $ACTION == "ADD") {
$arFields["ACCESS_LENGTH"] = intval($arFields["ACCESS_LENGTH"]);
if ($arFields["ACCESS_LENGTH"] < 0) {
$arFields["ACCESS_LENGTH"] = 0;
}
}
if ((is_set($arFields, "ACCESS_LENGTH_TYPE") || $ACTION == "ADD") && !array_key_exists($arFields["ACCESS_LENGTH_TYPE"], CCatalogProduct::GetTimePeriodTypes(true))) {
$arFields["ACCESS_LENGTH_TYPE"] = CCatalogProduct::TIME_PERIOD_DAY;
}
return true;
}
示例2: array
$currencyList = array();
foreach (Currency\CurrencyManager::getCurrencyList() as $currency => $currencyName) {
$currencyList[$currency] = array('CURRENCY' => $currency, 'FULL_NAME' => htmlspecialcharsex($currencyName), 'FULL_NAME_JS' => CUtil::JSEscape(htmlspecialcharsbx($currencyName)));
}
unset($currency, $currencyName);
$IBLOCK_ID = (int) $IBLOCK_ID;
if ($IBLOCK_ID <= 0) {
return;
}
$MENU_SECTION_ID = (int) $MENU_SECTION_ID;
$PRODUCT_ID = $ID > 0 ? CIBlockElement::GetRealElement($ID) : 0;
$arBaseProduct = false;
$periodTimeTypes = array();
if ($arMainCatalog['SUBSCRIPTION'] == 'Y') {
$arDefProduct = array('QUANTITY' => '', 'QUANTITY_RESERVED' => '', 'VAT_ID' => 0, 'VAT_INCLUDED' => 'N', 'QUANTITY_TRACE_ORIG' => 'D', 'CAN_BUY_ZERO_ORIG' => 'D', 'PRICE_TYPE' => '', 'RECUR_SCHEME_TYPE' => '', 'RECUR_SCHEME_LENGTH' => '', 'TRIAL_PRICE_ID' => '', 'WITHOUT_ORDER' => '', 'PURCHASING_PRICE' => '', 'PURCHASING_CURRENCY' => '', 'BARCODE_MULTI' => '', 'SUBSCRIBE_ORIG' => 'D');
$periodTimeTypes = CCatalogProduct::GetTimePeriodTypes(true);
} else {
$arDefProduct = array('QUANTITY' => '', 'QUANTITY_RESERVED' => '', 'WEIGHT' => '', 'WIDTH' => '', 'LENGTH' => '', 'HEIGHT' => '', 'MEASURE' => '', 'VAT_ID' => 0, 'VAT_INCLUDED' => 'N', 'QUANTITY_TRACE_ORIG' => 'D', 'CAN_BUY_ZERO_ORIG' => 'D', 'PURCHASING_PRICE' => '', 'PURCHASING_CURRENCY' => '', 'BARCODE_MULTI' => '', 'SUBSCRIBE_ORIG' => 'D');
}
if ($PRODUCT_ID > 0) {
$bReadOnly = !($USER->CanDoOperation('catalog_price') && CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $PRODUCT_ID, "element_edit_price"));
if ($arMainCatalog['SUBSCRIPTION'] == 'Y') {
$arProductSelect = array('ID', 'QUANTITY', 'QUANTITY_RESERVED', 'QUANTITY_TRACE_ORIG', 'VAT_ID', 'VAT_INCLUDED', 'CAN_BUY_ZERO_ORIG', 'PRICE_TYPE', 'RECUR_SCHEME_TYPE', 'RECUR_SCHEME_LENGTH', 'TRIAL_PRICE_ID', 'WITHOUT_ORDER', 'PURCHASING_PRICE', 'PURCHASING_CURRENCY', 'BARCODE_MULTI', 'SUBSCRIBE_ORIG', 'TYPE');
} else {
$arProductSelect = array('ID', 'QUANTITY', 'QUANTITY_RESERVED', 'QUANTITY_TRACE_ORIG', 'WEIGHT', 'WIDTH', 'LENGTH', 'HEIGHT', 'MEASURE', 'VAT_ID', 'VAT_INCLUDED', 'CAN_BUY_ZERO_ORIG', 'PURCHASING_PRICE', 'PURCHASING_CURRENCY', 'BARCODE_MULTI', 'SUBSCRIBE_ORIG', 'TYPE');
}
$rsProducts = CCatalogProduct::GetList(array(), array('ID' => $PRODUCT_ID), false, false, $arProductSelect);
$arBaseProduct = $rsProducts->Fetch();
if ($bCopy) {
$arBaseProduct['QUANTITY'] = '';
$arBaseProduct['QUANTITY_RESERVED'] = '';
示例3: define
define('CATALOG_VALUE_PRECISION', 2);
define('CATALOG_CACHE_DEFAULT_TIME', 10800);
Loader::registerAutoLoadClasses('catalog', array('catalog' => 'install/index.php', 'CCatalog' => $strDBType . '/catalog.php', 'CCatalogGroup' => $strDBType . '/cataloggroup.php', 'CExtra' => $strDBType . '/extra.php', 'CPrice' => $strDBType . '/price.php', 'CCatalogProduct' => $strDBType . '/product.php', 'CCatalogProductGroups' => $strDBType . '/product_group.php', 'CCatalogLoad' => $strDBType . '/catalog_load.php', 'CCatalogExport' => $strDBType . '/catalog_export.php', 'CCatalogImport' => $strDBType . '/catalog_import.php', 'CCatalogDiscount' => $strDBType . '/discount.php', 'CCatalogDiscountCoupon' => $strDBType . '/discount_coupon.php', 'CCatalogVat' => $strDBType . '/vat.php', 'CCatalogEvent' => 'general/catalog_event.php', 'CCatalogSKU' => $strDBType . '/catalog_sku.php', 'CCatalogDiscountSave' => $strDBType . '/discount_save.php', 'CCatalogStore' => $strDBType . '/store.php', 'CCatalogStoreProduct' => $strDBType . '/store_product.php', 'CCatalogAdmin' => 'general/admin.php', 'CGlobalCondCtrl' => 'general/catalog_cond.php', 'CGlobalCondCtrlComplex' => 'general/catalog_cond.php', 'CGlobalCondCtrlGroup' => 'general/catalog_cond.php', 'CGlobalCondTree' => 'general/catalog_cond.php', 'CCatalogCondCtrl' => 'general/catalog_cond.php', 'CCatalogCondCtrlComplex' => 'general/catalog_cond.php', 'CCatalogCondCtrlGroup' => 'general/catalog_cond.php', 'CCatalogCondCtrlIBlockFields' => 'general/catalog_cond.php', 'CCatalogCondCtrlIBlockProps' => 'general/catalog_cond.php', 'CCatalogCondTree' => 'general/catalog_cond.php', 'CCatalogCondCtrlBasketProductFields' => 'general/sale_cond.php', 'CCatalogCondCtrlBasketProductProps' => 'general/sale_cond.php', 'CCatalogActionCtrlBasketProductFields' => 'general/sale_act.php', 'CCatalogActionCtrlBasketProductProps' => 'general/sale_act.php', 'CCatalogDiscountConvert' => 'general/discount_convert.php', 'CCatalogDiscountConvertTmp' => $strDBType . '/discount_convert.php', 'CCatalogProductProvider' => 'general/product_provider.php', 'CCatalogStoreBarCode' => $strDBType . '/store_barcode.php', 'CCatalogContractor' => $strDBType . '/contractor.php', 'CCatalogArrivalDocs' => $strDBType . '/store_docs_type.php', 'CCatalogMovingDocs' => $strDBType . '/store_docs_type.php', 'CCatalogDeductDocs' => $strDBType . '/store_docs_type.php', 'CCatalogReturnsDocs' => $strDBType . '/store_docs_type.php', 'CCatalogUnReservedDocs' => $strDBType . '/store_docs_type.php', 'CCatalogDocs' => $strDBType . '/store_docs.php', 'CCatalogStoreControlUtil' => 'general/store_utility.php', 'CCatalogStoreDocsElement' => $strDBType . '/store_docs_element.php', 'CCatalogStoreDocsBarcode' => $strDBType . '/store_docs_barcode.php', 'CCatalogIBlockParameters' => 'general/comp_parameters.php', 'CCatalogMeasure' => $strDBType . '/measure.php', 'CCatalogMeasureResult' => $strDBType . '/measure.php', 'CCatalogMeasureClassifier' => 'general/unit_classifier.php', 'CCatalogMeasureAdminResult' => 'general/measure_result.php', 'CCatalogMeasureRatio' => $strDBType . '/measure_ratio.php', 'CCatalogProductSet' => $strDBType . '/product_set.php', 'CCatalogAdminTools' => $strDBType . '/admin_tools.php', 'CCatalogAdminProductSetEdit' => $strDBType . '/admin_tools.php', 'CCatalogMenu' => 'general/catalog_menu.php', 'CCatalogCSVSettings' => 'general/csv_settings.php', 'CCatalogStepOperations' => 'general/step_operations.php', 'CCatalogProductSetAvailable' => 'general/step_operations.php', 'CCatalogTools' => 'general/tools.php', '\\Bitrix\\Catalog\\CatalogIblockTable' => 'lib/catalogiblock.php', '\\Bitrix\\Catalog\\DiscountTable' => 'lib/discount.php', '\\Bitrix\\Catalog\\DiscountCouponTable' => 'lib/discountcoupon.php', '\\Bitrix\\Catalog\\GroupTable' => 'lib/group.php', '\\Bitrix\\Catalog\\GroupLangTable' => 'lib/grouplang.php', '\\Bitrix\\Catalog\\ProductTable' => 'lib/product.php', '\\Bitrix\\Catalog\\StoreTable' => 'lib/store.php', '\\Bitrix\\Catalog\\CatalogViewedProductTable' => 'lib/catalogviewedproduct.php', '\\Bitrix\\Catalog\\VatTable' => 'lib/vat.php'));
if (defined('CATALOG_GLOBAL_VARS') && CATALOG_GLOBAL_VARS == 'Y') {
global $CATALOG_CATALOG_CACHE;
$CATALOG_CATALOG_CACHE = null;
global $CATALOG_ONETIME_COUPONS_ORDER;
$CATALOG_ONETIME_COUPONS_ORDER = null;
global $CATALOG_PRODUCT_CACHE;
$CATALOG_PRODUCT_CACHE = null;
global $MAIN_EXTRA_LIST_CACHE;
$MAIN_EXTRA_LIST_CACHE = null;
global $CATALOG_BASE_GROUP;
$CATALOG_BASE_GROUP = array();
global $CATALOG_TIME_PERIOD_TYPES;
$CATALOG_TIME_PERIOD_TYPES = CCatalogProduct::GetTimePeriodTypes(true);
global $arCatalogAvailProdFields;
$arCatalogAvailProdFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_ELEMENT);
global $arCatalogAvailPriceFields;
$arCatalogAvailPriceFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_CATALOG);
global $arCatalogAvailValueFields;
$arCatalogAvailValueFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_PRICE);
global $arCatalogAvailQuantityFields;
$arCatalogAvailQuantityFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_PRICE_EXT);
global $arCatalogAvailGroupFields;
$arCatalogAvailGroupFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_SECTION);
global $defCatalogAvailProdFields;
$defCatalogAvailProdFields = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_ELEMENT);
global $defCatalogAvailPriceFields;
$defCatalogAvailPriceFields = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_CATALOG);
global $defCatalogAvailValueFields;
示例4: CheckFields
public static function CheckFields($ACTION, &$arFields, $ID = 0)
{
global $APPLICATION;
$arMsg = array();
$boolResult = true;
$ACTION = strtoupper($ACTION);
$ID = (int) $ID;
if ($ACTION == "ADD" && (!is_set($arFields, "ID") || (int) $arFields["ID"] <= 0)) {
$arMsg[] = array('id' => 'ID', 'text' => Loc::getMessage('KGP_EMPTY_ID'));
$boolResult = false;
}
if ($ACTION != "ADD" && $ID <= 0) {
$arMsg[] = array('id' => 'ID', 'text' => Loc::getMessage('KGP_EMPTY_ID'));
$boolResult = false;
}
if ($ACTION != "ADD" && array_key_exists('ID', $arFields)) {
unset($arFields["ID"]);
}
if (array_key_exists('TYPE', $arFields)) {
unset($arFields['TYPE']);
}
if ('ADD' == $ACTION) {
if (!array_key_exists('SUBSCRIBE', $arFields)) {
$arFields['SUBSCRIBE'] = '';
}
$arFields['TYPE'] = self::TYPE_PRODUCT;
}
if (is_set($arFields, "ID") || $ACTION == "ADD") {
$arFields["ID"] = (int) $arFields["ID"];
}
if (is_set($arFields, "QUANTITY") || $ACTION == "ADD") {
$arFields["QUANTITY"] = doubleval($arFields["QUANTITY"]);
}
if (is_set($arFields, "QUANTITY_RESERVED") || $ACTION == "ADD") {
$arFields["QUANTITY_RESERVED"] = doubleval($arFields["QUANTITY_RESERVED"]);
}
if (is_set($arFields, "OLD_QUANTITY")) {
$arFields["OLD_QUANTITY"] = doubleval($arFields["OLD_QUANTITY"]);
}
if (is_set($arFields, "WEIGHT") || $ACTION == "ADD") {
$arFields["WEIGHT"] = doubleval($arFields["WEIGHT"]);
}
if (is_set($arFields, "WIDTH") || $ACTION == "ADD") {
$arFields["WIDTH"] = doubleval($arFields["WIDTH"]);
}
if (is_set($arFields, "LENGTH") || $ACTION == "ADD") {
$arFields["LENGTH"] = doubleval($arFields["LENGTH"]);
}
if (is_set($arFields, "HEIGHT") || $ACTION == "ADD") {
$arFields["HEIGHT"] = doubleval($arFields["HEIGHT"]);
}
if (is_set($arFields, "VAT_ID") || $ACTION == "ADD") {
$arFields["VAT_ID"] = intval($arFields["VAT_ID"]);
}
if ((is_set($arFields, "VAT_INCLUDED") || $ACTION == "ADD") && $arFields["VAT_INCLUDED"] != "Y") {
$arFields["VAT_INCLUDED"] = "N";
}
if ((is_set($arFields, "QUANTITY_TRACE") || $ACTION == "ADD") && ($arFields["QUANTITY_TRACE"] != "Y" && $arFields["QUANTITY_TRACE"] != "N")) {
$arFields["QUANTITY_TRACE"] = "D";
}
if ((is_set($arFields, "CAN_BUY_ZERO") || $ACTION == "ADD") && ($arFields["CAN_BUY_ZERO"] != "Y" && $arFields["CAN_BUY_ZERO"] != "N")) {
$arFields["CAN_BUY_ZERO"] = "D";
}
if ((is_set($arFields, "NEGATIVE_AMOUNT_TRACE") || $ACTION == "ADD") && ($arFields["NEGATIVE_AMOUNT_TRACE"] != "Y" && $arFields["NEGATIVE_AMOUNT_TRACE"] != "N")) {
$arFields["NEGATIVE_AMOUNT_TRACE"] = "D";
}
if ((is_set($arFields, "PRICE_TYPE") || $ACTION == "ADD") && $arFields["PRICE_TYPE"] != "R" && $arFields["PRICE_TYPE"] != "T") {
$arFields["PRICE_TYPE"] = "S";
}
if ((is_set($arFields, "RECUR_SCHEME_TYPE") || $ACTION == "ADD") && (StrLen($arFields["RECUR_SCHEME_TYPE"]) <= 0 || !in_array($arFields["RECUR_SCHEME_TYPE"], CCatalogProduct::GetTimePeriodTypes(false)))) {
$arFields["RECUR_SCHEME_TYPE"] = self::TIME_PERIOD_DAY;
}
if ((is_set($arFields, "RECUR_SCHEME_LENGTH") || $ACTION == "ADD") && intval($arFields["RECUR_SCHEME_LENGTH"]) <= 0) {
$arFields["RECUR_SCHEME_LENGTH"] = 0;
}
if ((is_set($arFields, "TRIAL_PRICE_ID") || $ACTION == "ADD") && intval($arFields["TRIAL_PRICE_ID"]) <= 0) {
$arFields["TRIAL_PRICE_ID"] = false;
}
if ((is_set($arFields, "WITHOUT_ORDER") || $ACTION == "ADD") && $arFields["WITHOUT_ORDER"] != "Y") {
$arFields["WITHOUT_ORDER"] = "N";
}
if ((is_set($arFields, "SELECT_BEST_PRICE") || $ACTION == "ADD") && $arFields["SELECT_BEST_PRICE"] != "N") {
$arFields["SELECT_BEST_PRICE"] = "Y";
}
if (is_set($arFields, 'PURCHASING_PRICE')) {
if ($ACTION != 'ADD') {
if ($arFields['PURCHASING_PRICE'] === null || trim($arFields['PURCHASING_PRICE']) == '') {
unset($arFields['PURCHASING_PRICE']);
}
}
}
if (is_set($arFields, 'PURCHASING_PRICE')) {
$arFields['PURCHASING_PRICE'] = str_replace(',', '.', $arFields['PURCHASING_PRICE']);
$arFields['PURCHASING_PRICE'] = (double) $arFields['PURCHASING_PRICE'];
}
if (is_set($arFields, 'PURCHASING_CURRENCY') || $ACTION == "ADD" && is_set($arFields, 'PURCHASING_PRICE')) {
if (empty($arFields['PURCHASING_CURRENCY'])) {
$arMsg[] = array('id' => 'PURCHASING_CURRENCY', 'text' => Loc::getMessage('BT_MOD_CATALOG_PROD_ERR_COST_CURRENCY'));
$boolResult = false;
} else {
//.........这里部分代码省略.........