本文整理汇总了PHP中CCatalog::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalog::GetList方法的具体用法?PHP CCatalog::GetList怎么用?PHP CCatalog::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalog
的用法示例。
在下文中一共展示了CCatalog::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnBuildGlobalMenu
public static function OnBuildGlobalMenu(&$aGlobalMenu, &$aModuleMenu)
{
if (defined("BX_CATALOG_UNINSTALLED")) {
return;
}
if (!Loader::includeModule("iblock")) {
return;
}
$aMenu = array("text" => Loc::getMessage("CAT_MENU_ROOT"), "title" => "", "items_id" => "menu_catalog_list", "items" => array());
$arCatalogs = array();
$arCatalogSku = array();
$rsCatalog = CCatalog::GetList(array(), array(), false, false, array('IBLOCK_ID', 'PRODUCT_IBLOCK_ID'));
while ($ar = $rsCatalog->Fetch()) {
$ar["PRODUCT_IBLOCK_ID"] = (int) $ar["PRODUCT_IBLOCK_ID"];
$ar["IBLOCK_ID"] = (int) $ar["IBLOCK_ID"];
if (0 < $ar["PRODUCT_IBLOCK_ID"]) {
$arCatalogs[$ar["PRODUCT_IBLOCK_ID"]] = 1;
$arCatalogSku[$ar["PRODUCT_IBLOCK_ID"]] = $ar["IBLOCK_ID"];
} else {
$arCatalogs[$ar["IBLOCK_ID"]] = 1;
}
}
if (empty($arCatalogs)) {
return;
}
$rsIBlocks = CIBlock::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array('ID' => array_keys($arCatalogs), "MIN_PERMISSION" => "S"));
while ($arIBlock = $rsIBlocks->Fetch()) {
if (CIBlock::GetAdminListMode($arIBlock["ID"]) == 'C') {
$url = "cat_product_list.php";
} else {
$url = "cat_product_admin.php";
}
$arItems = array(array("text" => Loc::getMessage("CAT_MENU_PRODUCT_LIST"), "url" => $url . "?lang=" . LANGUAGE_ID . "&IBLOCK_ID=" . $arIBlock["ID"] . "&type=" . urlencode($arIBlock["IBLOCK_TYPE_ID"]) . '&find_section_section=-1', "more_url" => array("cat_product_admin.php?IBLOCK_ID=" . $arIBlock["ID"], "cat_product_list.php?IBLOCK_ID=" . $arIBlock["ID"] . '&find_section_section=-1', "cat_product_edit.php?IBLOCK_ID=" . $arIBlock["ID"]), "title" => "", "page_icon" => "iblock_page_icon_elements", "items_id" => "menu_catalog_goods_" . $arIBlock["ID"], "module_id" => "catalog"), array("text" => htmlspecialcharsex(CIBlock::GetArrayByID($arIBlock["ID"], "SECTIONS_NAME")), "url" => "cat_section_admin.php?lang=" . LANGUAGE_ID . "&type=" . $arIBlock["IBLOCK_TYPE_ID"] . "&IBLOCK_ID=" . $arIBlock["ID"] . "&find_section_section=0", "more_url" => array("cat_section_admin.php?IBLOCK_ID=" . $arIBlock["ID"] . "&find_section_section=0", "cat_section_edit.php?IBLOCK_ID=" . $arIBlock["ID"] . "&find_section_section=0"), "title" => "", "page_icon" => "iblock_page_icon_sections", "items_id" => "menu_catalog_category_" . $arIBlock["ID"], "module_id" => "catalog", "items" => CCatalogAdmin::get_sections_menu($arIBlock["IBLOCK_TYPE_ID"], $arIBlock["ID"], 1, 0)));
if (CIBlockRights::UserHasRightTo($arIBlock["ID"], $arIBlock["ID"], "iblock_edit")) {
$arItems[] = array("text" => Loc::getMessage("CAT_MENU_PRODUCT_PROPERTIES"), "url" => "iblock_property_admin.php?lang=" . LANGUAGE_ID . "&IBLOCK_ID=" . $arIBlock["ID"] . "&admin=N", "more_url" => array("iblock_property_admin.php?IBLOCK_ID=" . $arIBlock["ID"] . "&admin=N", "iblock_edit_property.php?IBLOCK_ID=" . $arIBlock["ID"] . "&admin=N"), "title" => "", "page_icon" => "iblock_page_icon_settings", "items_id" => "menu_catalog_attributes_" . $arIBlock["ID"], "module_id" => "catalog");
}
if (isset($arCatalogSku[$arIBlock["ID"]])) {
$intOffersIBlockID = $arCatalogSku[$arIBlock["ID"]];
if (CIBlockRights::UserHasRightTo($intOffersIBlockID, $intOffersIBlockID, "iblock_edit")) {
$arItems[] = array("text" => Loc::getMessage("CAT_MENU_SKU_PROPERTIES"), "url" => "iblock_property_admin.php?lang=" . LANGUAGE_ID . "&IBLOCK_ID=" . $intOffersIBlockID . "&admin=N", "more_url" => array("iblock_property_admin.php?IBLOCK_ID=" . $intOffersIBlockID . "&admin=N", "iblock_edit_property.php?IBLOCK_ID=" . $intOffersIBlockID . "&admin=N"), "title" => "", "page_icon" => "iblock_page_icon_settings", "items_id" => "menu_catalog_attributes_" . $intOffersIBlockID, "module_id" => "catalog");
}
}
if (CIBlockRights::UserHasRightTo($arIBlock["ID"], $arIBlock["ID"], "iblock_edit")) {
$arItems[] = array("text" => Loc::getMessage("CAT_MENU_CATALOG_SETTINGS"), "url" => "cat_catalog_edit.php?lang=" . LANGUAGE_ID . "&IBLOCK_ID=" . $arIBlock["ID"], "more_url" => array("cat_catalog_edit.php?IBLOCK_ID=" . $arIBlock["ID"]), "title" => "", "page_icon" => "iblock_page_icon_settings", "items_id" => "menu_catalog_edit_" . $arIBlock["ID"], "module_id" => "catalog");
}
$aMenu["items"][] = array("text" => htmlspecialcharsEx($arIBlock["NAME"]), "title" => "", "page_icon" => "iblock_page_icon_sections", "items_id" => "menu_catalog_" . $arIBlock["ID"], "module_id" => "catalog", "items" => $arItems);
}
if (!empty($aMenu["items"])) {
if (count($aMenu["items"]) == 1) {
$aMenu = $aMenu["items"][0];
}
$aMenu["parent_menu"] = "global_menu_store";
$aMenu["section"] = "catalog_list";
$aMenu["sort"] = 200;
$aMenu["icon"] = "iblock_menu_icon_sections";
$aMenu["page_icon"] = "iblock_page_icon_types";
$aModuleMenu[] = $aMenu;
}
}
示例2: GetInfoByLinkProperty
public function GetInfoByLinkProperty($intPropertyID)
{
$ID = intval($intPropertyID);
if (0 >= $intPropertyID) {
return false;
}
$rsProducts = CCatalog::GetList(array(), array('SKU_PROPERTY_ID' => $intPropertyID), false, false, array('IBLOCK_ID', 'PRODUCT_IBLOCK_ID', 'SKU_PROPERTY_ID'));
return $rsProducts->Fetch();
}
示例3: getCatalogList
/**
* Метод вернет список инфоблоков которые являются торговыми каталогами
*
* @return array
*/
function getCatalogList()
{
$result = array();
$selectedCatalog = getSelectedCatalog();
$dbCatalog = CCatalog::GetList(array(), array(), false, false, array('ID', 'NAME'));
while ($catalog = $dbCatalog->GetNext()) {
if (in_array($catalog['ID'], $selectedCatalog)) {
$catalog['SELECTED'] = true;
}
$result[] = $catalog;
}
return $result;
}
示例4: GetMessage
>
</td>
</tr>
<tr class="heading">
<td colspan="2"><?php
echo GetMessage("CATI_FIELDS");
?>
</td>
</tr>
<tr>
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="internal">
<?php
$boolCatalog = false;
$boolOffers = false;
$rsCatalogs = CCatalog::GetList(array(), array('IBLOCK_ID' => $IBLOCK_ID), false, false, array('IBLOCK_ID', 'PRODUCT_IBLOCK_ID', 'SKU_PROPERTY_ID'));
if ($arCatalog = $rsCatalogs->Fetch()) {
$boolCatalog = true;
$boolOffers = (int) $arCatalog['PRODUCT_IBLOCK_ID'] > 0;
}
$allowedProductFields = array();
$allowedSectionFields = array();
$allowedPriceQuantityFields = CCatalogCSVSettings::getDefaultSettings(CCatalogCSVSettings::FIELDS_PRICE_EXT, true);
$allowedPriceFields = array();
$fieldsOption = trim(COption::GetOptionString('catalog', 'allowed_product_fields'));
if ($fieldsOption != '') {
$allowedProductFields = explode(',', $fieldsOption);
}
$fieldsOption = trim(COption::GetOptionString('catalog', 'allowed_group_fields'));
if ($fieldsOption != '') {
$allowedSectionFields = explode(',', $fieldsOption);
示例5: init
public static function init()
{
IncludeModuleLangFile(__FILE__);
if (!self::$fInit) {
self::$fInit = true;
self::$siteCookieId = md5('SALE_REPORT_SITE_ID');
// Initializing list of sites.
$result = Bitrix\Main\SiteTable::getList(array('select' => array('LID', 'DEF', 'NAME')));
$i = 0;
while ($row = $result->fetch()) {
self::$sitelist[$row['LID']] = $row['NAME'];
if (++$i === 1) {
self::$defaultSiteId = $row['LID'];
} else {
if ($row['DEF'] === 'Y') {
self::$defaultSiteId = $row['LID'];
}
}
self::$weightOptions[$row['LID']] = array('unit' => COption::GetOptionString('sale', 'weight_unit', null, $row['LID']), 'koef' => COption::GetOptionInt('sale', 'weight_koef', null, $row['LID']));
}
unset($i, $row, $result);
// hack, add virtual ID field into StatusLang entity for filtering
$statusEntity = Entity\Base::getInstance('\\Bitrix\\Sale\\Internals\\StatusLang');
if ($statusEntity instanceof \Bitrix\Main\Entity\Base) {
$statusEntity->addField(array('data_type' => 'string', 'expression' => array('%s', 'STATUS_ID')), 'ID');
}
unset($statusEntity);
// hack, add virtual REPS_ORDER field into Shipment entity for filtering system records
$shipmentEntity = Entity\Base::getInstance('\\Bitrix\\Sale\\Internals\\Shipment');
if ($shipmentEntity instanceof \Bitrix\Main\Entity\Base) {
$shipmentEntity->addField(array('data_type' => 'Order', 'reference' => array('=ref.ID' => 'this.ORDER_ID', '!=this.SYSTEM' => array('?', 'Y'))), 'REPS_ORDER');
}
unset($shipmentEntity);
// Initializing list of statuses of orders.
$result = Bitrix\Sale\Internals\StatusLangTable::getList(array('select' => array('STATUS_ID', 'NAME'), 'filter' => array('=LID' => LANGUAGE_ID)));
while ($row = $result->fetch()) {
self::$statuslist[$row['STATUS_ID']] = $row['NAME'];
}
unset($row, $result);
self::$genders = array('M' => GetMessage('USER_MALE'), 'F' => GetMessage('USER_FEMALE'));
// Initializing list of person types.
$result = Bitrix\Sale\Internals\PersonTypeTable::getList(array('select' => array('ID', 'LID', 'NAME')));
while ($row = $result->fetch()) {
self::$personTypes[$row['ID']] = array('LID' => $row['LID'], 'NAME' => $row['NAME']);
}
unset($row, $result);
// Initializing list of pay systems of orders.
$result = Bitrix\Sale\PaySystemTable::getList(array('select' => array('ID', 'LID', 'NAME')));
while ($row = $result->fetch()) {
self::$paySystemList[$row['ID']] = array('value' => $row['NAME'], 'site_id' => $row['LID']);
}
unset($row, $result);
// Initializing list of services and methods of delivery.
$result = \Bitrix\Sale\Delivery\Services\Table::getList(array('select' => array('ID', 'NAME')));
while ($row = $result->fetch()) {
self::$deliveryList[$row['ID']] = array('value' => $row['NAME'], 'site_id' => '');
}
unset($row, $result);
// Obtaining table of correspondences of iblocks to sites.
$result = Bitrix\Iblock\IblockSiteTable::getList();
while ($row = $result->fetch()) {
self::$iblockSite[$row['SITE_ID']][] = $row['IBLOCK_ID'];
}
unset($row, $result);
// Obtaining the list of iblocks which are directories and filling
// a property $catalogSections with sections of these units.
$ent = new CCatalog();
$result = $ent->GetList();
while ($ibRow = $result->Fetch()) {
// Obtaining list of sections of the catalog.
self::$catalogs[] = $ibRow;
$path = array();
$curLevel = $prevLevel = 0;
$sections = CIBlockSection::GetTreeList(array('=IBLOCK_ID' => $ibRow['IBLOCK_ID']));
$row = null;
while ($row = $sections->GetNext()) {
// Formation of an array of identifiers of current and parent sections.
$curLevel = $row['DEPTH_LEVEL'];
for ($i = 0; $i <= $prevLevel - $curLevel; $i++) {
array_pop($path);
}
array_push($path, $row['ID']);
$prevLevel = $curLevel;
self::$catalogSections[$row['ID']] = array('name' => ltrim(str_repeat(' . ', $curLevel) . $row['NAME']), 'path' => $path, 'catalog' => array('ID' => $ibRow['ID'], 'NAME' => $ibRow['NAME']));
}
}
unset($ent, $ibRow, $row, $sections, $result);
// Initialization of the list of warehouses.
$result = Bitrix\Catalog\StoreTable::getList(array('select' => array('ID', 'TITLE')));
while ($row = $result->fetch()) {
self::$productStores[$row['ID']] = $row['TITLE'];
}
unset($row, $result);
// Getting currencies
$obj = new CCurrency();
$by = '';
$order = '';
$result = $obj->GetList($by, $order, LANGUAGE_ID);
while ($row = $result->Fetch()) {
self::$currencies[$row['CURRENCY']] = array('name' => $row['FULL_NAME']);
//.........这里部分代码省略.........
示例6: array
if ($ex = $APPLICATION->GetException()) {
$strWarning .= $ex->GetString() . "<br>";
$bVarsFromForm = true;
}
}
}
if (!$bVarsFromForm) {
if ($bBizproc && $_REQUEST['BIZ_PROC_ADD_DEFAULT_TEMPLATES'] == 'Y' && CBPDocument::GetNumberOfWorkflowTemplatesForDocumentType(array("iblock", "CIBlockDocument", "iblock_" . $ID)) <= 0 && $arFields["BIZPROC"] == "Y") {
CBPDocument::AddDefaultWorkflowTemplates(array("iblock", "CIBlockDocument", "iblock_" . $ID));
}
$DB->Commit();
//Check if index needed
CIBlock::CheckForIndexes($ID);
if ($bCatalog) {
if (isset($boolNeedAgent) && $boolNeedAgent == true) {
$intYandexExport = CCatalog::GetList(array(), array('YANDEX_EXPORT' => 'Y'), array());
CAgent::RemoveAgent("CCatalog::PreGenerateXML(\"yandex\");", "catalog");
if (0 < $intYandexExport) {
CAgent::AddAgent("CCatalog::PreGenerateXML(\"yandex\");", "catalog", "N", IntVal(COption::GetOptionString("catalog", "yandex_xml_period", "24")) * 60 * 60, "", "Y");
}
}
}
$ob = new CAutoSave();
if (strlen($apply) <= 0) {
if (strlen($_REQUEST["return_url"]) > 0) {
LocalRedirect($_REQUEST["return_url"]);
} else {
LocalRedirect("/bitrix/admin/iblock_admin.php?type=" . $type . "&lang=" . LANG . "&admin=" . ($_REQUEST["admin"] == "Y" ? "Y" : "N"));
}
}
LocalRedirect("/bitrix/admin/iblock_edit.php?type=" . $type . "&tabControl_active_tab=" . urlencode($tabControl_active_tab) . "&lang=" . LANG . "&ID=" . $ID . "&admin=" . ($_REQUEST["admin"] == "Y" ? "Y" : "N") . (strlen($_REQUEST["return_url"]) > 0 ? "&return_url=" . urlencode($_REQUEST["return_url"]) : ""));
示例7: GetMessage
?>
<tr>
<td><?php
echo GetMessage("SPS_CATALOG");
?>
:</td>
<td>
<select name="IBLOCK_ID" onchange="BX('LID').value = BX('LID_'+this.value).value">
<?php
$strShowOffersIBlock = COption::GetOptionString('catalog', 'product_form_show_offers_iblock');
$catalogID = $arLid = array();
$arCatalogFilter = array();
if ($boolSubscribe) {
$arCatalogFilter['SUBSCRIPTION'] = 'Y';
}
$dbItem = CCatalog::GetList(array(), $arCatalogFilter, false, false, array('IBLOCK_ID', 'PRODUCT_IBLOCK_ID', 'SKU_PROPERTY_ID', 'SUBSCRIPTION'));
while ($arItems = $dbItem->Fetch()) {
$arItems['IBLOCK_ID'] = intval($arItems['IBLOCK_ID']);
$arItems['PRODUCT_IBLOCK_ID'] = intval($arItems['PRODUCT_IBLOCK_ID']);
if ('N' == $arItems['SUBSCRIPTION'] && 0 < $arItems['PRODUCT_IBLOCK_ID']) {
$catalogID[$arItems['PRODUCT_IBLOCK_ID']] = true;
if ('Y' == $strShowOffersIBlock) {
$catalogID[$arItems['IBLOCK_ID']] = true;
}
} else {
$catalogID[$arItems['IBLOCK_ID']] = true;
}
}
$db_iblocks = CIBlock::GetList(array("ID" => "ASC"), array("ID" => array_keys($catalogID), 'ACTIVE' => 'Y'), false);
while ($db_iblocks->ExtractFields("str_iblock_")) {
$arLid[$str_iblock_ID] = $str_iblock_LID;
示例8: array
} else {
$DB->Commit();
}
}
}
if ($boolFlag && $boolCatalogUpdate) {
$strOK .= Loc::getMessage('CAT_IBLOCK_CATALOG_SUCCESSFULLY_UPDATE') . '<br />';
}
CAgent::RemoveAgent('CCatalog::PreGenerateXML("yandex");', 'catalog');
if ($bNeedAgent) {
CAgent::AddAgent('CCatalog::PreGenerateXML("yandex");', 'catalog', 'N', (int) Option::get('catalog', 'yandex_xml_period') * 3600);
}
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['agent_start']) && !$bReadOnly && check_bitrix_sessid()) {
CAgent::RemoveAgent('CCatalog::PreGenerateXML("yandex");', 'catalog');
$intCount = (int) CCatalog::GetList(array(), array('YANDEX_EXPORT' => 'Y'), array());
if ($intCount > 0) {
CAgent::AddAgent('CCatalog::PreGenerateXML("yandex");', 'catalog', 'N', (int) Option::get('catalog', 'yandex_xml_period') * 3600);
$strOK .= Loc::getMessage('CAT_AGENT_ADD_SUCCESS') . '. ';
} else {
$strWarning .= Loc::getMessage('CAT_AGENT_ADD_NO_EXPORT') . '. ';
}
}
if (!empty($strWarning)) {
CAdminMessage::ShowMessage($strWarning);
}
if (!empty($strOK)) {
CAdminMessage::ShowNote($strOK);
}
$aTabs = array(array("DIV" => "edit5", "TAB" => Loc::getMessage("CO_TAB_5"), "ICON" => "catalog_settings", "TITLE" => Loc::getMessage("CO_TAB_5_TITLE")), array("DIV" => "edit1", "TAB" => Loc::getMessage("CO_TAB_1"), "ICON" => "catalog_settings", "TITLE" => Loc::getMessage("CO_TAB_1_TITLE")), array("DIV" => "edit2", "TAB" => Loc::getMessage("CO_TAB_2"), "ICON" => "catalog_settings", "TITLE" => Loc::getMessage("CO_TAB_2_TITLE")));
if ($USER->IsAdmin()) {
示例9: _GetProductUrl
public static function _GetProductUrl($OF_ELEMENT_ID, $OF_IBLOCK_ID, $server_name = false, $arrType = false)
{
static $arIBlockCache = array();
static $arElementCache = array();
$product_url = "";
$OF_ELEMENT_ID = intval($OF_ELEMENT_ID);
$OF_IBLOCK_ID = intval($OF_IBLOCK_ID);
if ($arrType === "E" && $OF_IBLOCK_ID > 0 && $OF_ELEMENT_ID > 0 && CModule::IncludeModule("catalog")) {
if (!array_key_exists($OF_IBLOCK_ID, $arIBlockCache)) {
$rsProducts = CCatalog::GetList(array(), array('IBLOCK_ID' => $OF_IBLOCK_ID), false, false, array('IBLOCK_ID', 'PRODUCT_IBLOCK_ID', 'SKU_PROPERTY_ID'));
$arIBlockCache[$OF_IBLOCK_ID] = $rsProducts->Fetch();
if (is_array($arIBlockCache[$OF_IBLOCK_ID])) {
$arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK"] = CIBlock::GetArrayByID($arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK_ID"]);
}
}
if (is_array($arIBlockCache[$OF_IBLOCK_ID])) {
if (!array_key_exists($OF_ELEMENT_ID, $arElementCache)) {
$OF_PROP_ID = $arIBlockCache[$OF_IBLOCK_ID]["SKU_PROPERTY_ID"];
$rsOffer = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $arIBlockCache[$OF_IBLOCK_ID]["IBLOCK_ID"], "=ID" => $OF_ELEMENT_ID), false, false, array("LANG_DIR", "PROPERTY_" . $OF_PROP_ID . ".ID", "PROPERTY_" . $OF_PROP_ID . ".CODE", "PROPERTY_" . $OF_PROP_ID . ".XML_ID", "PROPERTY_" . $OF_PROP_ID . ".IBLOCK_ID", "PROPERTY_" . $OF_PROP_ID . ".IBLOCK_SECTION_ID"));
if ($arOffer = $rsOffer->Fetch()) {
$arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_CODE"] = '';
if (intval($arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_ID"]) > 0) {
$rsSections = CIBlockSection::GetByID($arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_ID"]);
if ($arSection = $rsSections->Fetch()) {
$arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_CODE"] = $arSection['CODE'];
}
}
$arElementCache[$OF_ELEMENT_ID] = array("LANG_DIR" => $arOffer["LANG_DIR"], "ID" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_ID"], "ELEMENT_ID" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_ID"], "CODE" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_CODE"], "ELEMENT_CODE" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_CODE"], "EXTERNAL_ID" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_XML_ID"], "IBLOCK_TYPE_ID" => $arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK"]["IBLOCK_TYPE_ID"], "IBLOCK_ID" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_ID"], "IBLOCK_CODE" => $arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK"]["CODE"], "IBLOCK_EXTERNAL_ID" => $arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK"]["XML_ID"], "IBLOCK_SECTION_ID" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_ID"], "SECTION_CODE" => $arOffer["PROPERTY_" . $OF_PROP_ID . "_IBLOCK_SECTION_CODE"]);
}
}
if (is_array($arElementCache[$OF_ELEMENT_ID])) {
$product_url = CIBlock::ReplaceDetailUrl($arIBlockCache[$OF_IBLOCK_ID]["PRODUCT_IBLOCK"]["DETAIL_PAGE_URL"], $arElementCache[$OF_ELEMENT_ID], $server_name, $arrType);
}
}
}
return $product_url;
}
示例10: UnLinkSKUIBlock
public static function UnLinkSKUIBlock($ID)
{
global $APPLICATION;
$arMsg = array();
$boolResult = true;
$ID = (int) $ID;
if (0 >= $ID) {
$arMsg[] = array('id' => 'PRODUCT_IBLOCK_ID', 'text' => Loc::getMessage('BT_MOD_CATALOG_ERR_PRODUCT_ID_INVALID'));
$boolResult = false;
}
if ($boolResult) {
$rsCatalog = CCatalog::GetList(array(), array('PRODUCT_IBLOCK_ID' => $ID), false, false, array('IBLOCK_ID'));
if ($arCatalog = $rsCatalog->Fetch()) {
$arCatalog['IBLOCK_ID'] = (int) $arCatalog['IBLOCK_ID'];
$arFields = array('PRODUCT_IBLOCK_ID' => 0, 'SKU_PROPERTY_ID' => 0);
if (!CCatalog::Update($arCatalog['IBLOCK_ID'], $arFields)) {
return false;
}
}
}
if (!$boolResult) {
$obError = new CAdminException($arMsg);
$APPLICATION->ResetException();
$APPLICATION->ThrowException($obError);
} else {
CCatalogSKU::ClearCache();
}
return $boolResult;
}
示例11: ShowError
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
$module_id = "catalog";
if ($USER->CanDoOperation('catalog_read')) {
if ($ex = $APPLICATION->GetException()) {
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
$strError = $ex->GetString();
ShowError($strError);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
die;
}
IncludeModuleLangFile(__FILE__);
if (CModule::IncludeModule("catalog")) {
$arIBlock = array();
$rsCatalog = CCatalog::GetList(array("sort" => "asc"), array('PRODUCT_IBLOCK_ID' => 0), false, false, array('IBLOCK_ID', 'PRODUCT_IBLOCK_ID'));
while ($arr = $rsCatalog->Fetch()) {
$arIBlock[$arr["IBLOCK_ID"]] = "[" . $arr["IBLOCK_ID"] . "] " . CIBlock::GetArrayByID($arr["IBLOCK_ID"], "NAME");
}
$arUGroupsEx = array();
$dbUGroups = CGroup::GetList($by = "c_sort", $order = "asc");
while ($arUGroups = $dbUGroups->Fetch()) {
$arUGroupsEx[$arUGroups["ID"]] = $arUGroups["NAME"];
}
$arAllOptions = array(array("1CE_IBLOCK_ID", GetMessage("CAT_1CE_IBLOCK_ID"), "", array("list", $arIBlock)), array("1CE_ELEMENTS_PER_STEP", GetMessage("CAT_1CE_ELEMENTS_PER_STEP"), 1, array("text", 5)), array("1CE_INTERVAL", GetMessage("CAT_1CE_INTERVAL"), "30", array("text", 20)), array("1CE_GROUP_PERMISSIONS", GetMessage("CAT_1CE_GROUP_PERMISSIONS"), "-", array("mlist", 5, $arUGroupsEx)), array("1CE_USE_ZIP", GetMessage("CAT_1CE_USE_ZIP"), "Y", array("checkbox")));
if ($_SERVER['REQUEST_METHOD'] == "POST" && strlen($Update) > 0 && $USER->CanDoOperation('edit_php') && check_bitrix_sessid()) {
for ($i = 0, $intCount = count($arAllOptions); $i < $intCount; $i++) {
$name = $arAllOptions[$i][0];
$val = $_REQUEST[$name];
if ($arAllOptions[$i][3][0] == "checkbox" && $val != "Y") {
$val = "N";
示例12: GetInfoByLinkProperty
/**
*
*
*
*
*
* @param $intPropertyI $D ID свойства инфоблока. </ht
*
*
*
* @return mixed <p>Возвращает информацию о том, является ли свойство инфоблока
* свойством привязки торговых предложений к товарам:</p> <ul> <li>
* <b>false</b> - не является;</li> <li>Если является, то возвращается массив
* следующего вида: <b>IBLOCK_ID</b> (ID инфоблока торговых предложений),
* <b>PRODUCT_IBLOCK_ID</b> (ID инфоблока товаров), <b>SKU_PROPERTY_ID</b> (ID свойства
* привязки торговых предложений к товарам).</li> </ul> <p>Начиная с
* версии модуля <b>12.5.6</b>, возвращаемое значение метода кешируется в
* течение хита.</p> <br><br>
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/catalog/classes/catalogsku/getinfobylinkproperty.php
* @author Bitrix
*/
public static function GetInfoByLinkProperty($intPropertyID)
{
$intPropertyID = (int) $intPropertyID;
if ($intPropertyID <= 0) {
return false;
}
if (!isset(self::$arPropertyCache[$intPropertyID])) {
self::$arPropertyCache[$intPropertyID] = false;
$rsProducts = CCatalog::GetList(array(), array('SKU_PROPERTY_ID' => $intPropertyID), false, false, array('IBLOCK_ID', 'PRODUCT_IBLOCK_ID', 'SKU_PROPERTY_ID'));
$arResult = $rsProducts->Fetch();
if (!empty($arResult)) {
$arResult['IBLOCK_ID'] = (int) $arResult['IBLOCK_ID'];
$arResult['PRODUCT_IBLOCK_ID'] = (int) $arResult['PRODUCT_IBLOCK_ID'];
$arResult['SKU_PROPERTY_ID'] = (int) $arResult['SKU_PROPERTY_ID'];
self::$arPropertyCache[$intPropertyID] = $arResult;
}
} else {
$arResult = self::$arPropertyCache[$intPropertyID];
}
return $arResult;
}
示例13: array
//*****************************************//
$arSelect = array("ID", "LID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "ACTIVE", "NAME", "PREVIEW_PICTURE", "PREVIEW_TEXT", "PREVIEW_TEXT_TYPE", "DETAIL_PICTURE", "LANG_DIR", "DETAIL_PAGE_URL");
$strTmpCat = "";
$strTmpOff = "";
$arSiteServers = array();
$BASE_CURRENCY = CCurrency::GetBaseCurrency();
if ($arCurrency = CCurrency::GetByID('RUR'))
$RUR = 'RUR';
else
$RUR = 'RUB';
$db_catalog_list = CCatalog::GetList(array(), array("YANDEX_EXPORT" => "Y", "PRODUCT_IBLOCK_ID" => 0), false, false, array('IBLOCK_ID'));
while ($arCatalog_list = $db_catalog_list->Fetch())
{
$arCatalog_list['IBLOCK_ID'] = intval($arCatalog_list['IBLOCK_ID']);
$arIBlock = CIBlock::GetArrayByID($arCatalog_list['IBLOCK_ID']);
if (empty($arIBlock) || !is_array($arIBlock))
continue;
if ('Y' != $arIBlock['ACTIVE'])
continue;
$boolRights = false;
if ('E' != $arIBlock['RIGHTS_MODE'])
{
$arRights = CIBlock::GetGroupPermissions($arCatalog_list['IBLOCK_ID']);
if (!empty($arRights) && isset($arRights[2]) && 'R' <= $arRights[2])
$boolRights = true;
}
示例14: GetProductData
/**
* @param array $arParams
* @return array|false
*/
public static function GetProductData($arParams)
{
if (!isset($arParams['QUANTITY']) || (float)$arParams['QUANTITY'] <= 0)
$arParams['QUANTITY'] = 0;
$arParams['RENEWAL'] = (isset($arParams['RENEWAL']) && $arParams['RENEWAL'] == 'Y' ? 'Y' : 'N');
$arParams['CHECK_QUANTITY'] = (isset($arParams['CHECK_QUANTITY']) && $arParams["CHECK_QUANTITY"] == 'N' ? 'N' : 'Y');
$arParams['CHECK_PRICE'] = (isset($arParams['CHECK_PRICE']) && $arParams['CHECK_PRICE'] == 'N' ? 'N' : 'Y');
$arParams['CHECK_COUPONS'] = (isset($arParams['CHECK_COUPONS']) && $arParams['CHECK_COUPONS'] == 'N' ? 'N' : 'Y');
$arParams['CHECK_DISCOUNT'] = (isset($arParams['CHECK_DISCOUNT']) && $arParams['CHECK_DISCOUNT'] == 'N' ? 'N' : 'Y');
$arParams['BASKET_ID'] = (string)(isset($arParams['BASKET_ID']) ? $arParams['BASKET_ID'] : '0');
$arParams['USER_ID'] = (isset($arParams['USER_ID']) ? (int)$arParams['USER_ID'] : 0);
if ($arParams['USER_ID'] < 0)
$arParams['USER_ID'] = 0;
$arParams['SITE_ID'] = (isset($arParams['SITE_ID']) ? $arParams['SITE_ID'] : false);
$strSiteID = $arParams['SITE_ID'];
if (isset($arParams['CURRENCY']))
$arParams['CURRENCY'] = CCurrency::checkCurrencyID($arParams['CURRENCY']);
if ($arParams['CURRENCY'] === false)
$arParams['CURRENCY'] = CSaleLang::GetLangCurrency($strSiteID ? $strSiteID : SITE_ID);
$productID = (int)$arParams['PRODUCT_ID'];
$quantity = (float)$arParams['QUANTITY'];
$renewal = $arParams['RENEWAL'];
$intUserID = (int)$arParams['USER_ID'];
global $USER, $APPLICATION;
$arResult = array();
static $arUserCache = array();
if (0 < $intUserID)
{
if (!isset($arUserCache[$intUserID]))
{
$by = 'ID';
$order = 'DESC';
$rsUsers = CUser::GetList($by, $order, array("ID_EQUAL_EXACT"=>$intUserID),array('FIELDS' => array('ID')));
if ($arUser = $rsUsers->Fetch())
{
$arUser['ID'] = intval($arUser['ID']);
$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_PERMISSIONS" => "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",
),
//.........这里部分代码省略.........
示例15: OnAdminListDisplayHandler
public static function OnAdminListDisplayHandler(&$list)
{
$strCurPage = $GLOBALS['APPLICATION']->GetCurPage();
$bElemPage = $strCurPage == '/bitrix/admin/iblock_element_admin.php' || $strCurPage == '/bitrix/admin/cat_product_admin.php';
$bSectPage = $strCurPage == '/bitrix/admin/iblock_section_admin.php' || $strCurPage == '/bitrix/admin/cat_section_admin.php';
$bMixPage = $strCurPage == '/bitrix/admin/iblock_list_admin.php';
$bRightPage = $bElemPage || $bSectPage || $bMixPage;
if ($bRightPage && !empty($list->arActions)) {
CJSCore::Init(array('asd_iblock'));
$strSomeScripts = '<script type="text/javascript">sListTable = \'' . $list->table_id . '\';</script>';
$list->arActions['asd_checkbox_manager'] = array('type' => 'html', 'value' => $strSomeScripts);
}
if ($bMixPage || $strCurPage == '/bitrix/admin/iblock_element_admin.php' || $strCurPage == '/bitrix/admin/iblock_section_admin.php') {
$list->context->additional_items[] = array('TEXT' => GetMessage('ASD_IBLOCK_SETT_SECT_MODE'), 'TITLE' => GetMessage('ASD_IBLOCK_SETT_SECT_MODE_TITLE'), 'GLOBAL_ICON' => 'adm-menu-setting', 'ONCLICK' => "location.href='" . htmlspecialcharsbx($GLOBALS['APPLICATION']->GetCurPageParam('action=asd_reverse&' . bitrix_sessid_get(), array('action'))) . "'");
}
if ($bRightPage && CModule::IncludeModule('iblock')) {
if (strlen(CASDiblock::$error)) {
$message = new CAdminMessage(array('TYPE' => 'ERROR', 'MESSAGE' => CASDiblock::$error));
echo $message->Show();
}
$lAdmin = new CAdminList($list->table_id, $list->sort);
$IBLOCK_ID = intval($_REQUEST['IBLOCK_ID']);
$find_section = intval($_REQUEST['find_section_section']);
if ($find_section < 0) {
$find_section = 0;
}
$boolSectionCopy = CASDIblockRights::IsSectionSectionCreate($IBLOCK_ID, $find_section);
$boolElementCopy = CASDIblockRights::IsSectionElementCreate($IBLOCK_ID, $find_section);
$copyMessageId = 'ASD_ACTION_POPUP_COPY';
$copyContextMessageId = 'ASD_ACTION_COPY';
$moveContextMessageId = 'ASD_ACTION_MOVE';
if (CModule::IncludeModule('catalog')) {
$productIBlock = CCatalog::GetList(array(), array('PRODUCT_IBLOCK_ID' => $IBLOCK_ID), false, false, array('IBLOCK_ID'))->Fetch();
if (!empty($productIBlock)) {
$copyMessageId = 'ASD_ACTION_POPUP_COPY_WITHOUT_SKU';
$copyContextMessageId = 'ASD_ACTION_COPY_WITHOUT_SKU';
$moveContextMessageId = 'ASD_ACTION_MOVE_WITHOUT_SKU';
}
unset($productIBlock);
}
if ($bElemPage) {
if ($boolElementCopy) {
foreach ($list->aRows as $id => $v) {
$arnewActions = array();
foreach ($v->aActions as $i => $act) {
$arnewActions[] = $act;
if ($act['ICON'] == 'copy') {
$arnewActions[] = array('ICON' => 'copy', 'TEXT' => GetMessage($copyMessageId), 'ACTION' => $lAdmin->ActionDoGroup($v->id, 'asd_copy_in_list', '&type=' . urlencode($_REQUEST['type']) . '&lang=' . LANGUAGE_ID . '&IBLOCK_ID=' . $IBLOCK_ID . '&find_section_section=' . $find_section));
}
}
$v->aActions = $arnewActions;
}
}
} elseif ($bSectPage) {
if ($boolSectionCopy) {
foreach ($list->aRows as $id => $v) {
$arnewActions = array();
foreach ($v->aActions as $i => $act) {
$arnewActions[] = $act;
if ($act['ICON'] == 'edit') {
$arnewActions[] = array('ICON' => 'copy', 'TEXT' => GetMessage('ASD_ACTION_POPUP_COPY'), 'ACTION' => $lAdmin->ActionDoGroup($v->id, 'asd_copy_in_list', '&type=' . urlencode($_REQUEST['type']) . '&lang=' . LANGUAGE_ID . '&IBLOCK_ID=' . $IBLOCK_ID . '&find_section_section=' . $find_section));
}
}
$v->aActions = $arnewActions;
}
}
} else {
foreach ($list->aRows as $id => $v) {
$strPrefix = substr($v->id, 0, 1);
if ($strPrefix == 'E') {
if ($boolElementCopy) {
$arnewActions = array();
foreach ($v->aActions as $i => $act) {
$arnewActions[] = $act;
if ($act['ICON'] == 'copy') {
$arnewActions[] = array('ICON' => 'copy', 'TEXT' => GetMessage($copyMessageId), 'ACTION' => $lAdmin->ActionDoGroup($v->id, 'asd_copy_in_list', '&type=' . urlencode($_REQUEST['type']) . '&IBLOCK_ID=' . $IBLOCK_ID . '&find_section_section=' . $find_section));
}
}
$v->aActions = $arnewActions;
}
} elseif ($strPrefix == 'S') {
if ($boolSectionCopy) {
$arnewActions = array();
foreach ($v->aActions as $i => $act) {
$arnewActions[] = $act;
if ($act['ICON'] == 'edit') {
$arnewActions[] = array('ICON' => 'copy', 'TEXT' => GetMessage('ASD_ACTION_POPUP_COPY'), 'ACTION' => $lAdmin->ActionDoGroup($v->id, 'asd_copy_in_list', '&type=' . urlencode($_REQUEST['type']) . '&lang=' . LANGUAGE_ID . '&IBLOCK_ID=' . $IBLOCK_ID . '&find_section_section=' . $find_section));
}
}
$v->aActions = $arnewActions;
}
}
}
}
$arIBtypes = array();
$rsIBtype = CIBlockType::GetList();
while ($arIBtype = $rsIBtype->Fetch()) {
if ($arIBTypeLang = CIBlockType::GetByIDLang($arIBtype['ID'], LANGUAGE_ID)) {
$arIBtypes[$arIBTypeLang['IBLOCK_TYPE_ID']] = $arIBTypeLang['NAME'];
}
//.........这里部分代码省略.........