public static function GetInheritedPropertyTemplateElementMenuItems($iblock_id, $action_function, $menuID, $inputID = "") { $result = array(); $result["this"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_ELEMENT"), "MENU" => array(array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_ELEMENT_NAME"), "ONCLICK" => "{$action_function}('{=this.Name}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_ELEMENT_LOWER_NAME"), "ONCLICK" => "{$action_function}('{=lower this.Name}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_ELEMENT_CODE"), "ONCLICK" => "{$action_function}('{=this.Code}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_ELEMENT_PREVIEW_TEXT"), "ONCLICK" => "{$action_function}('{=this.PreviewText}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_ELEMENT_DETAIL_TEXT"), "ONCLICK" => "{$action_function}('{=this.DetailText}', '{$menuID}', '{$inputID}')"))); if ($iblock_id > 0) { $result["properties"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PROPERTIES"), "MENU" => array()); foreach (self::getIblockElementProperties($iblock_id) as $property) { if ($property["PROPERTY_TYPE"] != "F") { $result["properties"]["MENU"][] = array("TEXT" => $property["NAME"], "ONCLICK" => "{$action_function}('{=this.property." . ($property["CODE"] != "" ? $property["CODE"] : $property["ID"]) . "}', '{$menuID}', '{$inputID}')"); } } } $result["parent"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PARENT"), "MENU" => array(array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PARENT_NAME"), "ONCLICK" => "{$action_function}('{=parent.Name}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PARENT_CODE"), "ONCLICK" => "{$action_function}('{=parent.Code}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PARENT_TEXT"), "ONCLICK" => "{$action_function}('{=parent.PreviewText}', '{$menuID}', '{$inputID}')"))); $result["iblock"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_IBLOCK"), "MENU" => array(array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_IBLOCK_NAME"), "ONCLICK" => "{$action_function}('{=iblock.Name}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_IBLOCK_CODE"), "ONCLICK" => "{$action_function}('{=iblock.Code}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_IBLOCK_TEXT"), "ONCLICK" => "{$action_function}('{=iblock.PreviewText}', '{$menuID}', '{$inputID}')"))); if (self::$catalogIncluded === null) { self::$catalogIncluded = Loader::includeModule('catalog'); } if (self::$catalogIncluded) { $arCatalog = \CCatalogSKU::GetInfoByProductIBlock($iblock_id); if (is_array($arCatalog)) { $result["sku_properties"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_SKU_PROPERTIES"), "MENU" => array()); $rsProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $arCatalog["IBLOCK_ID"])); while ($property = $rsProperty->fetch()) { if ($property["PROPERTY_TYPE"] != "F") { $result["sku_properties"]["MENU"][] = array("TEXT" => $property["NAME"], "ONCLICK" => "{$action_function}('{=concat {=distinct this.catalog.sku.property." . ($property["CODE"] != "" ? $property["CODE"] : $property["ID"]) . " \", \"}}', '{$menuID}', '{$inputID}')"); } } $result["sku_price"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_SKU_PRICE"), "MENU" => array()); foreach (self::getCatalogPrices() as $price) { if (preg_match("/^[a-zA-Z0-9]+\$/", $price["NAME"])) { $result["sku_price"]["MENU"][] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_MIN_PRICE") . " " . $price["NAME"], "ONCLICK" => "{$action_function}('{=min this.catalog.sku.price." . $price["NAME"] . "}', '{$menuID}', '{$inputID}')"); $result["sku_price"]["MENU"][] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_MAX_PRICE") . " " . $price["NAME"], "ONCLICK" => "{$action_function}('{=max this.catalog.sku.price." . $price["NAME"] . "}', '{$menuID}', '{$inputID}')"); } else { $result["sku_price"]["MENU"][] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_MIN_PRICE") . " " . $price["NAME"], "ONCLICK" => "{$action_function}('{=min this.catalog.sku.price." . $price["ID"] . "}', '{$menuID}', '{$inputID}')"); $result["sku_price"]["MENU"][] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_MAX_PRICE") . " " . $price["NAME"], "ONCLICK" => "{$action_function}('{=max this.catalog.sku.price." . $price["ID"] . "}', '{$menuID}', '{$inputID}')"); } } } $result["catalog"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_CATALOG"), "MENU" => array(array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_CATALOG_WEIGHT"), "ONCLICK" => "{$action_function}('{=this.catalog.weight}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_CATALOG_MEASURE"), "ONCLICK" => "{$action_function}('{=this.catalog.measure}', '{$menuID}', '{$inputID}')"))); $result["price"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PRICE"), "MENU" => array()); foreach (self::getCatalogPrices() as $price) { if (preg_match("/^[a-zA-Z0-9]+\$/", $price["NAME"])) { $result["price"]["MENU"][] = array("TEXT" => $price["NAME"], "ONCLICK" => "{$action_function}('{=this.catalog.price." . $price["NAME"] . "}', '{$menuID}', '{$inputID}')"); } else { $result["price"]["MENU"][] = array("TEXT" => $price["NAME"], "ONCLICK" => "{$action_function}('{=this.catalog.price." . $price["ID"] . "}', '{$menuID}', '{$inputID}')"); } } $result["store"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_STORE"), "MENU" => array()); foreach (self::getCatalogStores() as $store) { $result["store"]["MENU"][] = array("TEXT" => $store["TITLE"] != '' ? $store["TITLE"] : $store["ADDRESS"], "ONCLICK" => "{$action_function}('{=catalog.store." . $store["ID"] . ".name}', '{$menuID}', '{$inputID}')"); } } $result["misc"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_MISC"), "MENU" => array()); $result["misc"]["MENU"][] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_SECTIONS_PATH"), "ONCLICK" => "{$action_function}('{=concat this.sections.name \" / \"}', '{$menuID}', '{$inputID}')"); if (self::$catalogIncluded === null) { self::$catalogIncluded = Loader::includeModule('catalog'); } if (self::$catalogIncluded) { $result["misc"]["MENU"][] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_STORE_LIST"), "ONCLICK" => "{$action_function}('{=concat catalog.store \", \"}', '{$menuID}', '{$inputID}')"); } $r = array(); foreach ($result as $category) { if (!empty($category) && !empty($category["MENU"])) { $r[] = $category; } } return $r; }