本文整理汇总了PHP中CIBlock::GetAdminElementEditLink方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlock::GetAdminElementEditLink方法的具体用法?PHP CIBlock::GetAdminElementEditLink怎么用?PHP CIBlock::GetAdminElementEditLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlock
的用法示例。
在下文中一共展示了CIBlock::GetAdminElementEditLink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProductInfo
/** Returns an array, containing information about the product block on its ID.
* @param $elementId
* @return array|string
*/
public static function getProductInfo($elementId)
{
$elementId = intval($elementId);
$result = "";
if ($elementId <= 0) {
return $result;
}
$dbProduct = CIBlockElement::GetList(array(), array("ID" => $elementId), false, false, array('ID', 'IBLOCK_ID', 'IBLOCK_SECTION_ID', 'DETAIL_PICTURE', 'PREVIEW_PICTURE', 'NAME', 'XML_ID'));
while ($arProduct = $dbProduct->GetNext()) {
$imgCode = "";
if ($arProduct["IBLOCK_ID"] > 0) {
$arProduct["EDIT_PAGE_URL"] = CIBlock::GetAdminElementEditLink($arProduct["IBLOCK_ID"], $elementId, array("find_section_section" => $arProduct["IBLOCK_SECTION_ID"]));
}
if ($arProduct["DETAIL_PICTURE"] > 0) {
$imgCode = $arProduct["DETAIL_PICTURE"];
} elseif ($arProduct["PREVIEW_PICTURE"] > 0) {
$imgCode = $arProduct["PREVIEW_PICTURE"];
}
$arProduct["NAME"] = $arProduct["NAME"];
$arProduct["DETAIL_PAGE_URL"] = htmlspecialcharsex($arProduct["DETAIL_PAGE_URL"]);
if ($imgCode > 0) {
$arFile = CFile::GetFileArray($imgCode);
$arImgProduct = CFile::ResizeImageGet($arFile, array('width' => 80, 'height' => 80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false);
$arProduct["IMG_URL"] = $arImgProduct['src'];
}
return $arProduct;
}
return $result;
}
示例2: array
$save_and_add,
));
endif;
$tabControl->Show();
if (
(!defined('BX_PUBLIC_MODE') || BX_PUBLIC_MODE != 1)
&& CIBlockRights::UserHasRightTo($IBLOCK_ID, $IBLOCK_ID, "iblock_edit")
&& !$bAutocomplete
)
{
echo
BeginNote(),
GetMessage("IBEL_E_IBLOCK_MANAGE_HINT"),
' <a href="/bitrix/admin/iblock_edit.php?type='.htmlspecialcharsbx($type).'&lang='.LANGUAGE_ID.'&ID='.$IBLOCK_ID.'&admin=Y&return_url='.urlencode("/bitrix/admin/".CIBlock::GetAdminElementEditLink($IBLOCK_ID, $ID, array("WF" => ($WF=="Y"? "Y": null), "find_section_section" => intval($find_section_section), "return_url" => (strlen($return_url)>0? $return_url: null)))).'">',
GetMessage("IBEL_E_IBLOCK_MANAGE_HINT_HREF"),
'</a>',
EndNote()
;
}
//////////////////////////
//END of the custom form
//////////////////////////
endif;
}
if ($bAutocomplete)
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_popup_admin.php");
elseif ($bPropertyAjax)
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin_js.php");
示例3: GetProductCatalogInfo
private static function GetProductCatalogInfo($productID)
{
$productID = (int) $productID;
if ($productID <= 0) {
return array();
}
if (!($arProduct = static::getHitCache('IBLOCK_ELEMENT', $productID))) {
$dbProduct = CIBlockElement::GetList(array(), array("ID" => $productID), false, false, array('ID', 'IBLOCK_ID', 'NAME', 'IBLOCK_SECTION_ID'));
if ($arProduct = $dbProduct->Fetch()) {
static::setHitCache('IBLOCK_ELEMENT', $productID, $arProduct);
}
}
if (!empty($arProduct) && is_array($arProduct)) {
if ($arProduct["IBLOCK_ID"] > 0) {
$arProduct["EDIT_PAGE_URL"] = CIBlock::GetAdminElementEditLink($arProduct["IBLOCK_ID"], $productID);
}
}
return array("#PRODUCT_ID#" => $arProduct["ID"], "#PRODUCT_NAME#" => $arProduct["NAME"]);
}
示例4: GetRecommendetProduct
/**
* Returns list of recommended products for specific product.
*
* @param int $USER_ID User id.
* @param string $LID Site id.
* @param array $arFilterRecomendet Recomendation filter.
* @param string $recomMore Get more.
* @param int $cntProductDefault Max count.
* @return array
*/
function GetRecommendetProduct($USER_ID, $LID, $arFilterRecomendet = array(), $recomMore = 'N', $cntProductDefault = 2)
{
$arRecomendetResult = array();
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'));
//.........这里部分代码省略.........
示例5: setCatalogPanelButtons
public static function setCatalogPanelButtons(&$buttons, $iblock, $catalogButtons, $params, $windowParams)
{
global $APPLICATION;
$iblock = (int) $iblock;
if ($iblock <= 0) {
return;
}
if (empty($params) || !is_array($params)) {
return;
}
if (empty($windowParams) || !is_array($windowParams)) {
$windowParams = array('width' => 700, 'height' => 400, 'resize' => false);
}
if (isset($catalogButtons['add_product'])) {
$params[self::$strMainPrefix . self::TAB_KEY] = self::TAB_CATALOG;
$url = '/bitrix/admin/' . CIBlock::GetAdminElementEditLink($iblock, null, $params);
$action = $APPLICATION->GetPopupLink(array("URL" => $url, "PARAMS" => $windowParams));
$productButton = array('TITLE' => Loc::getMessage('BT_CAT_ADM_TOOLS_ADD_PROD'), 'TEXT' => Loc::getMessage('BT_CAT_ADM_TOOLS_ADD_PROD_TITLE'), 'ACTION' => 'javascript:' . $action, 'ACTION_URL' => $url, 'ONCLICK' => $action, 'ICON' => 'bx-context-toolbar-create-icon', 'ID' => 'bx-context-toolbar-add-element');
$buttons['edit']['add_element'] = $productButton;
$buttons['configure']['add_element'] = $productButton;
$buttons['intranet'][] = array('TEXT' => $productButton['TEXT'], 'TITLE' => $productButton['TITLE'], 'ICON' => 'add', 'ONCLICK' => $productButton['ACTION'], 'SORT' => 1000);
$url = str_replace('&bxpublic=Y&from_module=iblock', '', $url);
$productButton['ACTION'] = "javascript:jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')";
unset($productButton['ONCLICK']);
$buttons['submenu']['add_element'] = $productButton;
unset($productButton);
}
if (isset($catalogButtons['add_sku'])) {
$params[self::$strMainPrefix . self::TAB_KEY] = self::TAB_SKU;
$url = '/bitrix/admin/' . CIBlock::GetAdminElementEditLink($iblock, null, $params);
$action = $APPLICATION->GetPopupLink(array("URL" => $url, "PARAMS" => $windowParams));
$skuButton = array('TITLE' => Loc::getMessage('BT_CAT_ADM_TOOLS_ADD_SKU'), 'TEXT' => Loc::getMessage('BT_CAT_ADM_TOOLS_ADD_SKU_TITLE'), 'ACTION' => 'javascript:' . $action, 'ACTION_URL' => $url, 'ONCLICK' => $action, 'ICON' => 'bx-context-toolbar-create-icon', 'ID' => 'bx-context-toolbar-add-sku');
$buttons['edit']['add_sku'] = $skuButton;
$buttons['configure']['add_sku'] = $skuButton;
$buttons['intranet'][] = array('TEXT' => $skuButton['TEXT'], 'TITLE' => $skuButton['TITLE'], 'ICON' => 'add', 'ONCLICK' => $skuButton['ACTION'], 'SORT' => 1010);
$url = str_replace('&bxpublic=Y&from_module=iblock', '', $url);
$skuButton['ACTION'] = "javascript:jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "')";
unset($skuButton['ONCLICK']);
$buttons['submenu']['add_sku'] = $skuButton;
unset($skuButton);
}
}
示例6: array
}
if(!empty($_REQUEST["productDelay"]))
{
$dbItem = CIBlockElement::GetList(array(), array("ID" => $_REQUEST["productDelay"]), false, false, array("ID", "NAME", "IBLOCK_ID", "IBLOCK_SECTION_ID"));
while($arItem = $dbItem->Fetch())
echo "<b>"."<a href=\"".CIBlock::GetAdminElementEditLink($arItem["IBLOCK_ID"], $arItem["ID"], array(
"find_section_section" => $arItem["IBLOCK_SECTION_ID"],
'WF' => 'Y',
))."\">".htmlspecialcharsbx($arItem["NAME"])."</a></b> (".GetMessage("NEWO_PRODUCTS_DELAY").")<br />";
}
if(!empty($_REQUEST["productNA"]))
{
$dbItem = CIBlockElement::GetList(array(), array("ID" => $_REQUEST["productNA"]), false, false, array("ID", "NAME", "IBLOCK_ID", "IBLOCK_SECTION_ID"));
while($arItem = $dbItem->Fetch())
echo "<b>"."<a href=\"".CIBlock::GetAdminElementEditLink($arItem["IBLOCK_ID"], $arItem["ID"], array(
"find_section_section" => $arItem["IBLOCK_SECTION_ID"],
'WF' => 'Y',
))."\">".htmlspecialcharsbx($arItem["NAME"])."</a></b> (".GetMessage("NEWO_PRODUCTS_NA").")<br />";
}
echo EndNote();
}
?>
<script type="text/javascript">
var arProduct = [];
var arProductEditCountProps = [];
var countProduct = 0;
</script>
<?
$arCurFormat = CCurrencyLang::GetCurrencyFormat($str_CURRENCY);
$CURRENCY_FORMAT = trim(str_replace("#", '', $arCurFormat["FORMAT_STRING"]));
$ORDER_TOTAL_PRICE = 0;
$ORDER_PRICE_WITH_DISCOUNT = 0;
示例7: getProductDataToFillBasket
//.........这里部分代码省略.........
if (isset($arProductData[$productId]))
$arElementInfo = $arProductData[$productId];
if (isset( $arSku2Parent[$productId]))
$arParent = $arProductData[$arSku2Parent[$productId]];
if (!empty($arSku2Parent)) // if sku element doesn't have value of some property - we'll show parent element value instead
{
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]))) // can be array or string
{
$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
$arPrice = CCatalogProduct::GetOptimalPrice($arElementInfo["ID"], 1, $arBuyerGroups, "N", array(), $LID);
$currentPrice = $arPrice["DISCOUNT_PRICE"];
$arElementInfo["PRICE"] = $currentPrice;
$arElementInfo["CURRENCY"] = $arPrice["PRICE"]["CURRENCY"];
$arElementInfo["DISCOUNT_PRICE"] = $arPrice["PRICE"]["PRICE"] - $arPrice["DISCOUNT_PRICE"];
$currentTotalPrice = ($arElementInfo["PRICE"] + $arElementInfo["DISCOUNT_PRICE"]);
$discountPercent = 0;
if ($arElementInfo["DISCOUNT_PRICE"] > 0)
$discountPercent = intval(($arElementInfo["DISCOUNT_PRICE"] * 100) / $currentTotalPrice);
$rsProducts = CCatalogProduct::GetList(
array(),
array('ID' => $productId),
false,
false,
array('ID', 'QUANTITY', 'WEIGHT', 'MEASURE', 'TYPE', 'BARCODE_MULTI')
);
if (!($arProduct = $rsProducts->Fetch()))
{
return array();
}
$balance = floatval($arProduct["QUANTITY"]);
// sku props
示例8: foreach
}
foreach ($arSelectedProps as $aProp) {
$v = '';
foreach ($arProperties[$aProp['ID']] as $property_value_id => $property_value) {
$res = '';
if ($aProp['PROPERTY_TYPE'] == 'F') {
$res = CFileInput::Show('NO_FIELDS[' . $property_value_id . ']', $property_value, array("IMAGE" => "Y", "PATH" => "Y", "FILE_SIZE" => "Y", "DIMENSIONS" => "Y", "IMAGE_POPUP" => "Y", "MAX_SIZE" => $maxImageSize, "MIN_SIZE" => $minImageSize), array('upload' => false, 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'del' => false, 'description' => false));
} elseif ($aProp['PROPERTY_TYPE'] == 'G') {
$t = GetSectionName($property_value);
if ($t) {
$res = $t['NAME'] . ' [<a href="' . htmlspecialcharsbx(CIBlock::GetAdminSectionEditLink($t['IBLOCK_ID'], $t['ID'])) . '" title="' . GetMessage("SPS_ELSEARCH_SECTION_EDIT") . '">' . $t['ID'] . '</a>]';
}
} elseif ($aProp['PROPERTY_TYPE'] == 'E') {
$t = GetElementName($property_value);
if ($t) {
$res = $t['NAME'] . ' [<a href="' . htmlspecialcharsbx(CIBlock::GetAdminElementEditLink($t['IBLOCK_ID'], $t['ID'])) . '" title="' . GetMessage("SPS_ELSEARCH_ELEMENT_EDIT") . '">' . $t['ID'] . '</a>]';
}
} else {
$res = htmlspecialcharsex($property_value);
}
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"]]);
示例9: GetMessage
echo GetMessage("IBLOCK_EL_SAVE_AND_ADD");
?>
">
<?php
$buttons_add_html = ob_get_contents();
ob_end_clean();
$tabControl->Buttons(false, $buttons_add_html);
} elseif (!$bPropertyAjax && $nobuttons !== "Y") {
$wfClose = "{\n\t\ttitle: '" . CUtil::JSEscape(GetMessage("IBLOCK_EL_CANC")) . "',\n\t\tname: 'dontsave',\n\t\tid: 'dontsave',\n\t\taction: function () {\n\t\t\tvar FORM = this.parentWindow.GetForm();\n\t\t\tFORM.appendChild(BX.create('INPUT', {\n\t\t\t\tprops: {\n\t\t\t\t\ttype: 'hidden',\n\t\t\t\t\tname: this.name,\n\t\t\t\t\tvalue: 'Y'\n\t\t\t\t}\n\t\t\t}));\n\t\t\tthis.disableUntilError();\n\t\t\tthis.parentWindow.Submit();\n\t\t}\n\t}";
$save_and_add = "{\n\t\ttitle: '" . CUtil::JSEscape(GetMessage("IBLOCK_EL_SAVE_AND_ADD")) . "',\n\t\tname: 'save_and_add',\n\t\tid: 'save_and_add',\n\t\tclassName: 'adm-btn-add',\n\t\taction: function () {\n\t\t\tvar FORM = this.parentWindow.GetForm();\n\t\t\tFORM.appendChild(BX.create('INPUT', {\n\t\t\t\tprops: {\n\t\t\t\t\ttype: 'hidden',\n\t\t\t\t\tname: 'save_and_add',\n\t\t\t\t\tvalue: 'Y'\n\t\t\t\t}\n\t\t\t}));\n\n\t\t\tthis.parentWindow.hideNotify();\n\t\t\tthis.disableUntilError();\n\t\t\tthis.parentWindow.Submit();\n\t\t}\n\t}";
$cancel = "{\n\t\ttitle: '" . CUtil::JSEscape(GetMessage("IBLOCK_EL_CANC")) . "',\n\t\tname: 'cancel',\n\t\tid: 'cancel',\n\t\taction: function () {\n\t\t\tBX.WindowManager.Get().Close();\n\t\t\tif(window.reloadAfterClose)\n\t\t\t\ttop.BX.reload(true);\n\t\t}\n\t}";
$tabControl->ButtonsPublic(array('.btnSave', $ID > 0 && $bWorkflow ? $wfClose : $cancel, $save_and_add));
}
$tabControl->Show();
if ((!defined('BX_PUBLIC_MODE') || BX_PUBLIC_MODE != 1) && CIBlockRights::UserHasRightTo($IBLOCK_ID, $IBLOCK_ID, "iblock_edit") && !$bAutocomplete) {
echo BeginNote(), GetMessage("IBEL_E_IBLOCK_MANAGE_HINT"), ' <a href="/bitrix/admin/iblock_edit.php?type=' . htmlspecialcharsbx($type) . '&lang=' . LANG . '&ID=' . $IBLOCK_ID . '&admin=Y&return_url=' . urlencode("/bitrix/admin/" . CIBlock::GetAdminElementEditLink($IBLOCK_ID, $ID, array("WF" => $WF == "Y" ? "Y" : null, "find_section_section" => intval($find_section_section), "return_url" => strlen($return_url) > 0 ? $return_url : null))) . '">', GetMessage("IBEL_E_IBLOCK_MANAGE_HINT_HREF"), '</a>', EndNote();
}
//////////////////////////
//END of the custom form
//////////////////////////
?>
<?php
}
}
if ($bAutocomplete) {
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_popup_admin.php";
} elseif ($bPropertyAjax) {
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin_js.php";
} else {
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
示例10: getProductDataToFillBasket
//.........这里部分代码省略.........
if (!empty($arProductData)) {
$arElementInfo = array();
foreach ($arProductData as $elemId => &$arElement) {
foreach ($arElement as $key => $value) {
if (strncmp($key, 'PROPERTY_', 9) == 0 && substr($key, -6) == "_VALUE") {
$columnCode = str_replace("_VALUE", "", $key);
$arElement[$key] = getIblockPropInfo($value, $arPropertyInfo[$columnCode], array("WIDTH" => 90, "HEIGHT" => 90));
}
}
}
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'));
}
static $buyersGroups = array();
if (empty($buyersGroups[$userId])) {
$buyersGroups[$userId] = \CUser::getUserGroup($userId);
}
$arBuyerGroups = $buyersGroups[$userId];
// price
$currentVatMode = \CCatalogProduct::getPriceVatIncludeMode();
$currentUseDiscount = \CCatalogProduct::getUseDiscount();
\CCatalogProduct::setUseDiscount(!$isSetItem);
\CCatalogProduct::setPriceVatIncludeMode(true);
\CCatalogProduct::setUsedCurrency(Sale\Internals\SiteCurrencyTable::getSiteCurrency($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'];
$currentTotalPrice = $arPrice['RESULT_PRICE']['BASE_PRICE'];
$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();
示例11: GetProductCatalogInfo
private static function GetProductCatalogInfo($productID)
{
$productID = intval($productID);
$result = "";
if ($productID <= 0)
return array();
$dbProduct = CIBlockElement::GetList(array(), array("ID" => $productID), false, false, array('ID', 'IBLOCK_ID', 'NAME'));
if ($arProduct = $dbProduct->Fetch())
{
if ($arProduct["IBLOCK_ID"] > 0)
$arProduct["EDIT_PAGE_URL"] = CIBlock::GetAdminElementEditLink($arProduct["IBLOCK_ID"], $productID);
}
return array(
"#PRODUCT_ID#" => $arProduct["ID"],
"#PRODUCT_NAME#" => $arProduct["NAME"],
);
}
示例12: GetProductSku
//.........这里部分代码省略.........
if($arProduct["PREVIEW_PICTURE"] != "")
$productImg = $arProduct["PREVIEW_PICTURE"];
elseif($arProduct["DETAIL_PICTURE"] != "")
$productImg = $arProduct["DETAIL_PICTURE"];
}
if ($productImg != "")
{
$arFile = CFile::GetFileArray($productImg);
$productImg = CFile::ResizeImageGet($arFile, array('width'=>80, 'height'=>80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false);
$arSkuTmp["ImageUrl"] = $productImg["src"];
}
}
}
if (($minItemPrice === 0) || ($arPrice["DISCOUNT_PRICE"] < $minItemPrice))
{
$minItemPrice = $arPrice["DISCOUNT_PRICE"];
$minItemPriceFormat = SaleFormatCurrency($arPrice["DISCOUNT_PRICE"], $arPrice["PRICE"]["CURRENCY"]);
}
foreach($arIblockOfferProps as $arCode)
{
if (array_key_exists($arCode["CODE"], $arOffer["PROPERTIES"]))
{
if (is_array($arOffer["PROPERTIES"][$arCode["CODE"]]["VALUE"]))
$arSkuTmp[] = implode("/", $arOffer["PROPERTIES"][$arCode["CODE"]]["VALUE"]);
else
$arSkuTmp[] = $arOffer["PROPERTIES"][$arCode["CODE"]]["VALUE"];
}
}
if (!empty($arCatalogProduct))
{
$arSkuTmp["BALANCE"] = $arCatalogProduct["QUANTITY"];
$arSkuTmp["WEIGHT"] = $arCatalogProduct["WEIGHT"];
$arSkuTmp["BARCODE_MULTI"] = $arCatalogProduct["BARCODE_MULTI"];
}
else
{
$arSkuTmp["BALANCE"] = 0;
$arSkuTmp["WEIGHT"] = 0;
$arSkuTmp["BARCODE_MULTI"] = 'N';
}
$urlEdit = CIBlock::GetAdminElementEditLink(
$arOffer["IBLOCK_ID"],
$arOffer['ID'],
array(
'find_section_section' => 0,
'WF' => 'Y',
)
);
$discountPercent = 0;
$arSkuTmp["USER_ID"] = $USER_ID;
$arSkuTmp["ID"] = $arOffer["ID"];
$arSkuTmp["NAME"] = CUtil::JSEscape($arOffer["NAME"]);
$arSkuTmp["PRODUCT_NAME"] = CUtil::JSEscape($PRODUCT_NAME);
$arSkuTmp["PRODUCT_ID"] = $PRODUCT_ID;
$arSkuTmp["LID"] = CUtil::JSEscape($LID);
$arSkuTmp["MIN_PRICE"] = $minItemPriceFormat;
$arSkuTmp["URL_EDIT"] = $urlEdit;
$arSkuTmp["DISCOUNT_PRICE"] = '';
$arSkuTmp["DISCOUNT_PRICE_FORMATED"] = '';
$arSkuTmp["PRICE"] = $arPrice["PRICE"]["PRICE"];
$arSkuTmp["PRICE_FORMATED"] = CurrencyFormatNumber($arPrice["PRICE"]["PRICE"], $arPrice["PRICE"]["CURRENCY"]);
$arPriceType = GetCatalogGroup($arPrice["PRICE"]["CATALOG_GROUP_ID"]);
$arSkuTmp["PRICE_TYPE"] = $arPriceType["NAME_LANG"];
$arSkuTmp["VAT_RATE"] = $arPrice["PRICE"]["VAT_RATE"];
if (count($arPrice["DISCOUNT"]) > 0)
{
$discountPercent = IntVal($arPrice["DISCOUNT"]["VALUE"]);
$arSkuTmp["DISCOUNT_PRICE"] = $arPrice["DISCOUNT_PRICE"];
$arSkuTmp["DISCOUNT_PRICE_FORMATED"] = CurrencyFormatNumber($arPrice["DISCOUNT_PRICE"], $arPrice["PRICE"]["CURRENCY"]);
}
$arCurFormat = CCurrencyLang::GetCurrencyFormat($arPrice["PRICE"]["CURRENCY"]);
$arSkuTmp["VALUTA_FORMAT"] = str_replace("#", '', $arCurFormat["FORMAT_STRING"]);
$arSkuTmp["DISCOUNT_PERCENT"] = $discountPercent;
$arSkuTmp["CURRENCY"] = $arPrice["PRICE"]["CURRENCY"];
$arSkuTmp["CAN_BUY"] = $arOffer["CAN_BUY"];
$arSku[] = $arSkuTmp;
}
if ((!is_array($arIblockOfferProps) || empty($arIblockOfferProps)) && is_array($arSku) && !empty($arSku))
{
$arIblockOfferProps[0] = array("CODE" => "TITLE", "NAME" => GetMessage("SKU_TITLE"));
foreach ($arSku as $key => $val)
$arSku[$key][0] = $val["NAME"];
}
$arResult["SKU_ELEMENTS"] = $arSku;
$arResult["SKU_PROPERTIES"] = $arIblockOfferProps;
$arResult["OFFERS_IBLOCK_ID"] = $arOffersIblock[$arProduct["IBLOCK_ID"]];
}//if OFFERS_IBLOCK_ID > 0
return $arResult;
}
示例13: getIBlockElementContentMenu
public static function getIBlockElementContentMenu($intIBlockID, $intID, &$arCatalog, $arParams)
{
$arResult = false;
$intIBlockID = (int) $intIBlockID;
$intID = (int) $intID;
if ($intIBlockID <= 0 || $intID <= 0) {
return false;
}
if (empty($arCatalog)) {
$arCatalog = CCatalogSKU::GetInfoByIBlock($intIBlockID);
}
if (empty($arCatalog)) {
return false;
}
if ($arCatalog['CATALOG'] != 'Y') {
return false;
}
if (empty($arParams) || !is_array($arParams)) {
$arParams = array();
}
$boolFeatureSet = CBXFeatures::IsFeatureEnabled('CatCompleteSet');
$intProductID = CIBlockElement::GetRealElement($intID);
$strProductType = '';
if (isset($_REQUEST[self::$strMainPrefix . 'PRODUCT_TYPE'])) {
$strProductType = (string) $_REQUEST[self::$strMainPrefix . 'PRODUCT_TYPE'];
if ('' != $strProductType && !in_array($strProductType, self::getTabList())) {
$strProductType = '';
}
}
if ('' != $strProductType && !$boolFeatureSet) {
if (self::TAB_SET == $strProductType || self::TAB_GROUP == $strProductType) {
$strProductType = '';
}
}
$boolExistOffers = false;
if (CCatalogSKU::TYPE_FULL == $arCatalog['CATALOG_TYPE']) {
$boolExistOffers = CCatalogSKU::IsExistOffers($intID, $intIBlockID);
}
$boolExistSet = CCatalogProductSet::isProductHaveSet($intProductID, CCatalogProductSet::TYPE_SET);
$boolExistGroup = CCatalogProductSet::isProductHaveSet($intProductID, CCatalogProductSet::TYPE_GROUP);
$arItems = array();
if (CCatalogSKU::TYPE_OFFERS != $arCatalog['CATALOG_TYPE']) {
if (!$boolExistOffers && !$boolExistSet) {
//product
$arItems[] = array('ICON' => '', 'TEXT' => Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_CATALOG'), 'CHECKED' => true);
if (CCatalogSKU::TYPE_FULL == $arCatalog['CATALOG_TYPE']) {
$arNewParams = $arParams;
$arNewParams[self::$strMainPrefix . 'PRODUCT_TYPE'] = self::TAB_SKU;
$arItems[] = array('ICON' => '', 'TEXT' => Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_SKU'), 'LINK' => CIBlock::GetAdminElementEditLink($intIBlockID, $intID, $arNewParams));
}
if ($boolFeatureSet) {
$arNewParams = $arParams;
$arNewParams[self::$strMainPrefix . 'PRODUCT_TYPE'] = self::TAB_SET;
$arItems[] = array('ICON' => '', 'TEXT' => Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_SET'), 'LINK' => CIBlock::GetAdminElementEditLink($intIBlockID, $intID, $arNewParams));
}
} elseif ($boolExistOffers) {
//offers
$arItems[] = array('ICON' => '', 'TEXT' => Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_CATALOG'), 'TITLE' => Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_CATALOG_FROM_SKU'), 'SHOW_TITLE' => true, 'DISABLED' => true);
$arItems[] = array('ICON' => '', 'TEXT' => Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_SKU'), 'CHECKED' => true);
if ($boolFeatureSet) {
$arItems[] = array('ICON' => '', 'TEXT' => Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_SET'), 'TITLE' => Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_SET_FROM_SKU'), 'SHOW_TITLE' => true, 'DISABLED' => true);
}
} elseif ($boolExistSet) {
if ($boolFeatureSet) {
//set
$arNewParams = $arParams;
$arNewParams['setdel'] = 'Y';
$arNewParams['sessid'] = bitrix_sessid();
$arItems[] = array('ICON' => '', 'TEXT' => Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_CATALOG'), 'ACTION' => "if(confirm('" . CUtil::JSEscape(Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_SET_DELETE_CONFIRM')) . "'))window.location='" . CIBlock::GetAdminElementEditLink($intIBlockID, $intID, $arNewParams) . "';");
if (CCatalogSKU::TYPE_FULL == $arCatalog['CATALOG_TYPE']) {
$arNewParams[self::$strMainPrefix . 'PRODUCT_TYPE'] = self::TAB_SKU;
$arItems[] = array('ICON' => '', 'TEXT' => Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_SKU'), 'ACTION' => "if(confirm('" . CUtil::JSEscape(Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_SET_DELETE_CONFIRM')) . "'))window.location='" . CIBlock::GetAdminElementEditLink($intIBlockID, $intID, $arNewParams) . "';");
}
$arItems[] = array('ICON' => '', 'TEXT' => Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_SET'), 'CHECKED' => true);
}
}
}
if (!$boolFeatureSet && CCatalogSKU::TYPE_FULL != $arCatalog['CATALOG_TYPE']) {
$arItems = array();
}
//group
if ($boolFeatureSet && self::TAB_GROUP != $strProductType) {
$arItems[] = array('SEPARATOR' => 'Y');
if (!$boolExistGroup) {
$arNewParams = $arParams;
$arNewParams[self::$strMainPrefix . 'PRODUCT_TYPE'] = self::TAB_GROUP;
$arItems[] = array('ICON' => '', 'TEXT' => Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_GROUP_ADD'), 'LINK' => CIBlock::GetAdminElementEditLink($intIBlockID, $intID, $arNewParams));
} else {
$arNewParams = $arParams;
$arNewParams['groupdel'] = 'Y';
$arNewParams['sessid'] = bitrix_sessid();
$arItems[] = array('ICON' => 'delete', 'TEXT' => Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_GROUP_DELETE'), 'ACTION' => "if(confirm('" . CUtil::JSEscape(Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_GROUP_DELETE_CONFIRM')) . "'))window.location='" . CIBlock::GetAdminElementEditLink($intIBlockID, $intID, $arNewParams) . "';");
}
}
if (!empty($arItems)) {
$arResult = array('TEXT' => Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_SELECTOR'), 'TITLE' => Loc::getMessage('BT_CAT_SET_PRODUCT_TYPE_SELECTOR_TITLE'), 'MENU' => $arItems);
}
return $arResult;
}
示例14: array
$iblockIterator = CIBlock::GetList(array(), array('ID' => $entityId, 'CHECK_PERMISSIONS' => 'Y', 'MIN_PERMISSION' => 'S'), false);
$iblock = $iblockIterator->Fetch();
if (empty($iblock)) {
$errors[] = Loc::getMessage('BX_IBLOCK_REDIRECT_ENTITY_ERR_IBLOCK_NOT_FOUND');
} else {
$redirectUrl = CIBlock::GetAdminElementListLink($iblock['ID'], array('find_section_section' => -1, 'WF' => 'Y', 'menu' => null));
}
unset($iblock, $iblockIterator);
break;
case 'ELEMENT':
$elementIterator = CIBlockElement::GetList(array(), array('ID' => $entityId, 'CHECK_PERMISSIONS' => 'Y', 'MIN_PERMISSION' => 'S'), false, false, array('ID', 'IBLOCK_ID', 'WF_PARENT_ELEMENT_ID'));
$element = $elementIterator->Fetch();
if (empty($element)) {
$errors[] = Loc::getMessage('BX_IBLOCK_REDIRECT_ENTITY_ERR_ELEMENT_NOT_FOUND');
} else {
$redirectUrl = CIBlock::GetAdminElementEditLink($element['IBLOCK_ID'], !empty($element['WF_PARENT_ELEMENT_ID']) ? $element['WF_PARENT_ELEMENT_ID'] : $element['ID'], array('find_section_section' => -1, 'WF' => 'Y', 'menu' => null));
}
unset($element, $elementIterator);
break;
}
if ($redirectUrl != '') {
LocalRedirect('/bitrix/admin/' . $redirectUrl);
}
}
}
$APPLICATION->SetTitle(Loc::getMessage('BX_IBLOCK_REDIRECT_ENTITY_TITLE'));
require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_admin_after.php';
if (!empty($errors)) {
$errorMessage = new CAdminMessage(array('DETAILS' => implode('<br>', $errors), 'TYPE' => 'ERROR', 'HTML' => true));
echo $errorMessage->Show();
unset($errorMessage);
示例15: GetRecommendetProduct
/**
* Returns list of recommended products for specific product
*
* @param integer $USER_ID
* @param string $LID
* @param array $arFilterRecomendet
* @param bool $recomMore
* @param integer $cntProductDefault
* @return array
*/
public static function GetRecommendetProduct($USER_ID, $LID, $arFilterRecomendet = array(), $recomMore = 'N', $cntProductDefault = 2)
{
$arRecomendetResult = array();
if (CModule::IncludeModule('catalog') && CModule::IncludeModule('iblock') && count($arFilterRecomendet) > 0) {
$rsIblock = CIBlock::GetList(array(), array('TYPE' => 'catalog', 'SITE_ID' => $LID, 'ACTIVE' => 'Y', 'CODE' => 'furniture'));
$arIblock = $rsIblock->Fetch();
$arFilter = array("ACTIVE" => "Y", "IBLOCK_ID" => $arIblock["ID"], "ID" => $arFilterRecomendet);
$rsElement = CIBlockElement::GetList(array(), $arFilter, false, false);
while ($obElement = $rsElement->GetNextElement()) {
$arElementProps = $obElement->GetProperties();
if (isset($arElementProps["RECOMMEND"]) && is_array($arElementProps["RECOMMEND"]["VALUE"]) > 0) {
foreach ($arElementProps["RECOMMEND"]["VALUE"] as $val) {
$arRecomendet[$val] = $val;
}
}
}
if (count($arRecomendet) > 0) {
$arBuyerGroups = CUser::GetUserGroup($USER_ID);
$arFilter = array("ACTIVE" => "Y", "ID" => $arRecomendet);
$rsElement = CIBlockElement::GetList(array(), $arFilter, false, false, array("NAME", "ID", "LID", 'IBLOCK_ID', 'IBLOCK_SECTION_ID', "DETAIL_PICTURE", "PREVIEW_PICTURE", "DETAIL_PAGE_URL"));
while ($arElement = $rsElement->GetNext()) {
if (!in_array($arElement["ID"], $arFilterRecomendet)) {
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);
$currentPrice = $arPrice["DISCOUNT_PRICE"];
$arElement["PRICE"] = $currentPrice;
$arElement["CURRENCY"] = $arPrice["PRICE"]["CURRENCY"];
$arElement["DISCOUNT_PRICE"] = $arPrice["PRICE"]["PRICE"] - $arPrice["DISCOUNT_PRICE"];
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;
}
}
}
}
return $arRecomendetResult;
}
}