当前位置: 首页>>代码示例>>PHP>>正文


PHP CCatalogMeasure类代码示例

本文整理汇总了PHP中CCatalogMeasure的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogMeasure类的具体用法?PHP CCatalogMeasure怎么用?PHP CCatalogMeasure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CCatalogMeasure类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDefaultMeasure

 public static function getDefaultMeasure($getStub = false, $getExt = false)
 {
     if (self::$defaultMeasure === null) {
         $measureRes = CCatalogMeasure::getList(array(), array('IS_DEFAULT' => 'Y'), false, false, array());
         if ($measure = $measureRes->GetNext()) {
             $measure['ID'] = (int) $measure['ID'];
             $measure['CODE'] = (int) $measure['CODE'];
             self::$defaultMeasure = $measure;
         }
     }
     if (self::$defaultMeasure === null) {
         $measureRes = CCatalogMeasure::getList(array(), array('CODE' => self::DEFAULT_MEASURE_CODE), false, false, array());
         if ($measure = $measureRes->GetNext()) {
             $measure['ID'] = (int) $measure['ID'];
             $measure['CODE'] = (int) $measure['CODE'];
             self::$defaultMeasure = $measure;
         }
     }
     if (self::$defaultMeasure === null) {
         if ($getStub) {
             $defaultMeasureDescription = CCatalogMeasureClassifier::getMeasureInfoByCode(self::DEFAULT_MEASURE_CODE);
             if ($defaultMeasureDescription !== null) {
                 self::$defaultMeasure = array('ID' => 0, 'CODE' => self::DEFAULT_MEASURE_CODE, 'MEASURE_TITLE' => $defaultMeasureDescription['MEASURE_TITLE'], 'SYMBOL_RUS' => $defaultMeasureDescription['SYMBOL_RUS'], 'SYMBOL_INTL' => $defaultMeasureDescription['SYMBOL_INTL'], 'SYMBOL_LETTER_INTL' => $defaultMeasureDescription['SYMBOL_LETTER_INTL']);
                 if ($getExt) {
                     self::$defaultMeasure['~MEASURE_TITLE'] = self::$defaultMeasure['MEASURE_TITLE'];
                     self::$defaultMeasure['~SYMBOL_RUS'] = self::$defaultMeasure['SYMBOL_RUS'];
                     self::$defaultMeasure['~SYMBOL_INTL'] = self::$defaultMeasure['SYMBOL_INTL'];
                     self::$defaultMeasure['~SYMBOL_LETTER_INTL'] = self::$defaultMeasure['SYMBOL_LETTER_INTL'];
                 }
             }
         }
     }
     return self::$defaultMeasure;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:34,代码来源:measure.php

示例2: load

 protected function load()
 {
     $measureList = \CCatalogMeasure::getList(array(), array("ID" => $this->key), false, false, array("MEASURE_TITLE"));
     $measure = $measureList->fetch();
     if ($measure) {
         return $measure['MEASURE_TITLE'];
     } else {
         return "";
     }
 }
开发者ID:ASDAFF,项目名称:open_bx,代码行数:10,代码来源:elementcatalog.php

示例3: getMeasureByCode

 public static function getMeasureByCode($code)
 {
     if (!Main\Loader::includeModule('catalog')) {
         throw new Main\SystemException("Could not load 'catalog' module.");
     }
     $dbMeasureResult = \CCatalogMeasure::getList(array(), array('=CODE' => $code), false, false, array('ID', 'CODE', 'SYMBOL_RUS', 'SYMBOL_INTL', 'IS_DEFAULT'));
     $measureFields = is_object($dbMeasureResult) ? $dbMeasureResult->Fetch() : null;
     if (!is_array($measureFields)) {
         return null;
     }
     return array('ID' => intval($measureFields['ID']), 'CODE' => intval($measureFields['CODE']), 'IS_DEFAULT' => isset($measureFields['IS_DEFAULT']) && $measureFields['IS_DEFAULT'] === 'Y', 'SYMBOL' => isset($measureFields['SYMBOL_RUS']) ? $measureFields['SYMBOL_RUS'] : $measureFields['SYMBOL_INTL']);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:12,代码来源:measure.php

示例4: foreach

                    foreach ($arResult["SET_ITEMS"][$key]["PRICE_MATRIX"]["COLS"] as $keyColumn => $arColumn) {
                        $arResult["SET_ITEMS"][$key]["PRICE_MATRIX"]["COLS"][$keyColumn]["NAME_LANG"] = htmlspecialcharsbx($arColumn["NAME_LANG"]);
                    }
                }
            } else {
                $arResult["SET_ITEMS"][$key]["PRICES"] = CIBlockPriceTools::GetItemPrices($arParams["IBLOCK_ID"], $arResultPrices, $arResult["SET_ITEMS"][$key], $arParams['PRICE_VAT_INCLUDE'], $arConvertParams);
                if (!empty($arResult["SET_ITEMS"][$key]["PRICES"])) {
                    foreach ($arResult["SET_ITEMS"][$key]['PRICES'] as &$arOnePrice) {
                        if ('Y' == $arOnePrice['MIN_PRICE']) {
                            $arResult["SET_ITEMS"][$key]['MIN_PRICE'] = $arOnePrice;
                            break;
                        }
                    }
                    unset($arOnePrice);
                }
            }
            if ($arParams["SHOW_MEASURE"] == "Y" && $setItem["CATALOG_MEASURE"]) {
                $arResult["SET_ITEMS"][$key]["MEASURE"] = CCatalogMeasure::getList(array(), array("ID" => $setItem["CATALOG_MEASURE"]), false, false, array())->GetNext();
            }
        }
    }
}
/*$cp = $this->__component;
if (is_object($cp))
{
	$cp->arResult["SECTION_FULL"] =$db_res;
	$cp->SetResultCacheKeys("SECTION_FULL");
}*/
if ($arResult["DETAIL_PICTURE"]["SRC"]) {
    $APPLICATION->AddHeadString('<link rel="image_src" href="' . $arResult["DETAIL_PICTURE"]["SRC"] . '"  />', true);
}
开发者ID:Andreyjktl,项目名称:rezina74,代码行数:31,代码来源:result_modifier.php

示例5: foreach

     $arIDs[] = $arItem["PRODUCT_ID"];
 }
 foreach ($arResult["ITEMS"]["DelDelCanBuy"] as $key => $arItem) {
     $arIDs[] = $arItem["PRODUCT_ID"];
 }
 foreach ($arResult["ITEMS"]["nAnCanBuy"] as $key => $arItem) {
     $arIDs[] = $arItem["PRODUCT_ID"];
 }
 foreach ($arResult["ITEMS"]["ProdSubscribe"] as $key => $arItem) {
     $arIDs[] = $arItem["PRODUCT_ID"];
 }
 $db_res = CCatalogProduct::GetList(array(), array("ID" => $arIDs), false, false, array("ID", "MEASURE"));
 while ($res = $db_res->GetNext()) {
     $arMeasures[$res["ID"]] = $res["MEASURE"];
 }
 $db_res = CCatalogMeasure::getList(array(), array("ID" => $arMeasures), false, false, array());
 while ($res = $db_res->GetNext()) {
     foreach ($arMeasures as $key => $value) {
         if ($res["ID"] == $value) {
             $arMeasures[$key] = $res;
         }
     }
 }
 foreach ($arResult["ITEMS"]["AnDelCanBuy"] as $key => $arItem) {
     foreach ($arMeasures as $i => $value) {
         if ($arItem["PRODUCT_ID"] == $i) {
             $arResult["ITEMS"]["AnDelCanBuy"][$key]["MEASURE"] = $value;
         }
     }
 }
 foreach ($arResult["ITEMS"]["DelDelCanBuy"] as $key => $arItem) {
开发者ID:Andreyjktl,项目名称:rezina74,代码行数:31,代码来源:result_modifier.php

示例6: htmlspecialcharsex

	{
		$strProductType = '';
		if (isset($arProductTypeList[$arRows['E'.$intOneElemID]->arRes['CATALOG_TYPE']]))
			$strProductType = $arProductTypeList[$arRows['E'.$intOneElemID]->arRes['CATALOG_TYPE']];
		if (isset($arProductGroupIDs[$intOneElemID]) && $arProductGroupIDs[$intOneElemID])
			$strProductType .= ('' != $strProductType ? ', ' : '').GetMessage('IBLIST_A_CATALOG_TYPE_MESS_GROUP');
		$arRows['E'.$intOneElemID]->AddViewField('CATALOG_TYPE', $strProductType);
	}
	if (isset($intOneElemID))
		unset($intOneElemID);
	if (isset($arVisibleColumnsMap['CATALOG_MEASURE']) && !empty($arMeasureIDs))
	{
		$rsMeasures = CCatalogMeasure::getList(
			array(),
			array('@ID' => array_keys($arMeasureIDs)),
			false,
			false,
			array()
		);
		while ($arMeasure = $rsMeasures->Fetch())
		{
			$arMeasure['ID'] = (int)$arMeasure['ID'];
			$strMeasure = htmlspecialcharsex('' != $arMeasure['SYMBOL_RUS'] ? $arMeasure['SYMBOL_RUS'] : $arMeasure['MEASURE_TITLE']);
			if (isset($arMeasureIDs[$arMeasure['ID']]) && !empty($arMeasureIDs[$arMeasure['ID']]))
			{
				foreach ($arMeasureIDs[$arMeasure['ID']] as $intID)
				{
					if ($showCatalogWithOffers || $arRows['E'.$intID]->arRes['CATALOG_TYPE'] != CCatalogProduct::TYPE_SKU)
						$arRows['E'.$intID]->AddViewField('CATALOG_MEASURE', $strMeasure);
					else
						$arRows['E'.$intID]->AddViewField('CATALOG_MEASURE', ' ');
开发者ID:nycmic,项目名称:bittest,代码行数:31,代码来源:iblock_list_admin.php

示例7: exportElement

 function exportElement($arElement, $SECTION_MAP, $PROPERTY_MAP)
 {
     if (strlen($arElement["XML_ID"]) > 0) {
         $xml_id = $arElement["XML_ID"];
     } else {
         $xml_id = $arElement["ID"];
     }
     if ($this->PRODUCT_IBLOCK_ID > 0) {
         $arPropOrder = array("sort" => "asc", "id" => "asc", "enum_sort" => "asc", "value_id" => "asc");
         $rsLink = CIBlockElement::GetProperty($this->arIBlock["ID"], $arElement["ID"], $arPropOrder, array("ACTIVE" => "Y", "CODE" => "CML2_LINK"));
         $arLink = $rsLink->Fetch();
         if (is_array($arLink) && !is_array($arLink["VALUE"]) && $arLink["VALUE"] > 0) {
             $xml_id = $this->GetElementXML_ID($this->PRODUCT_IBLOCK_ID, $arLink["VALUE"]) . "#" . $xml_id;
         }
     }
     fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_ID") . ">" . htmlspecialcharsbx($xml_id) . "</" . GetMessage("IBLOCK_XML2_ID") . ">\n");
     if (!$this->only_price) {
         $this->exportElementFields($arElement, $SECTION_MAP);
         if ($this->next_step["catalog"] && !$this->bExtended) {
             fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_ITEM_ATTRIBUTES") . ">\n");
         } else {
             fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_PROPERTIES_VALUES") . ">\n");
         }
         $this->exportElementProperties($arElement, $PROPERTY_MAP);
         if ($this->next_step["catalog"] && !$this->bExtended) {
             fwrite($this->fp, "\t\t\t\t</" . GetMessage("IBLOCK_XML2_ITEM_ATTRIBUTES") . ">\n");
         } else {
             fwrite($this->fp, "\t\t\t\t</" . GetMessage("IBLOCK_XML2_PROPERTIES_VALUES") . ">\n");
         }
         if ($this->bExtended) {
             $elementTemplates = new \Bitrix\Iblock\InheritedProperty\ElementTemplates($this->arIBlock["ID"], $arElement["ID"]);
             $this->exportInheritedTemplates(4, $elementTemplates);
         }
     }
     if ($this->next_step["catalog"]) {
         $rsProduct = CCatalogProduct::GetList(array(), array("ID" => $arElement["ID"]));
         $arProduct = $rsProduct->Fetch();
         static $measure = null;
         if (!isset($measure)) {
             $measure = array();
             $rsBaseUnit = CCatalogMeasure::GetList(array(), array());
             while ($arIDUnit = $rsBaseUnit->Fetch()) {
                 $measure[$arIDUnit["ID"]] = $arIDUnit["CODE"];
             }
         }
         $xmlMeasure = GetMessage("IBLOCK_XML2_PCS");
         if ($arProduct["MEASURE"] > 0 && isset($measure[$arProduct["MEASURE"]])) {
             $xmlMeasure = $measure[$arProduct["MEASURE"]];
         }
         $arPrices = array();
         $rsPrices = CPrice::GetList(array(), array("PRODUCT_ID" => $arElement["ID"]));
         while ($arPrice = $rsPrices->Fetch()) {
             if (!$arPrice["QUANTITY_FROM"] && !$arPrice["QUANTITY_TO"]) {
                 $arPrices[] = array(GetMessage("IBLOCK_XML2_PRICE_TYPE_ID") => $this->prices[$arPrice["CATALOG_GROUP_ID"]], GetMessage("IBLOCK_XML2_PRICE_FOR_ONE") => $arPrice["PRICE"], GetMessage("IBLOCK_XML2_CURRENCY") => $arPrice["CURRENCY"], GetMessage("IBLOCK_XML2_MEASURE") => $xmlMeasure);
             }
         }
         if (count($arPrices) > 0) {
             fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_PRICES") . ">\n");
             foreach ($arPrices as $arPrice) {
                 fwrite($this->fp, "\t\t\t\t\t<" . GetMessage("IBLOCK_XML2_PRICE") . ">\n");
                 foreach ($arPrice as $key => $value) {
                     fwrite($this->fp, "\t\t\t\t\t\t<" . $key . ">" . htmlspecialcharsbx($value) . "</" . $key . ">\n");
                 }
                 fwrite($this->fp, "\t\t\t\t\t</" . GetMessage("IBLOCK_XML2_PRICE") . ">\n");
             }
             fwrite($this->fp, "\t\t\t\t</" . GetMessage("IBLOCK_XML2_PRICES") . ">\n");
             $arCatalogProduct = CCatalogProduct::GetByID($arElement["ID"]);
             if ($arCatalogProduct) {
                 fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_AMOUNT") . ">" . htmlspecialcharsbx($arCatalogProduct["QUANTITY"]) . "</" . GetMessage("IBLOCK_XML2_AMOUNT") . ">\n");
             }
         }
     }
 }
开发者ID:nycmic,项目名称:bittest,代码行数:73,代码来源:cml2.php

示例8: foreach

		<?php 
    foreach ($arResult["ITEMS"] as $arItem) {
        $this->AddEditAction($arItem['ID'], $arItem['EDIT_LINK'], CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "ELEMENT_EDIT"));
        $this->AddDeleteAction($arItem['ID'], $arItem['DELETE_LINK'], CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "ELEMENT_DELETE"), array("CONFIRM" => GetMessage('CT_BCS_ELEMENT_DELETE_CONFIRM')));
        ?>
		<?php 
        $totalCount = CIshop::GetTotalCount($arItem);
        $arAddToBasketData = CIshop::GetAddToBasketArray($arItem, $totalCount);
        ?>
			<tr id="<?php 
        echo $this->GetEditAreaId($arItem['ID']);
        ?>
">
			<?php 
        if ($arParams["SHOW_MEASURE"] == "Y" && $arItem["CATALOG_MEASURE"]) {
            $arMeasure = CCatalogMeasure::getList(array(), array("ID" => $arItem["CATALOG_MEASURE"]), false, false, array())->GetNext();
        }
        ?>
				<td class="image">
					<a href="<?php 
        echo $arItem["DETAIL_PAGE_URL"];
        ?>
" class="thumb">
						<?php 
        if (!empty($arItem["PREVIEW_PICTURE"])) {
            ?>
							<?php 
            $img_preview = CFile::ResizeImageGet($arItem["PREVIEW_PICTURE"], array("width" => 40, "height" => 40), BX_RESIZE_IMAGE_PROPORTIONAL_ALT, true);
            ?>
							<img border="0" src="<?php 
            echo $img_preview["src"];
开发者ID:Andreyjktl,项目名称:rezina74,代码行数:31,代码来源:template.php

示例9: calculateSetParams

 protected function calculateSetParams($productID, $items)
 {
     global $DB;
     $quantityTrace = 'N';
     $canBuyZero = 'Y';
     $quantity = null;
     $weight = 0;
     $allItems = true;
     $tracedItems = array_filter($items, 'CCatalogProductSet::isTracedItem');
     if (empty($tracedItems)) {
         $tracedItems = $items;
     } else {
         $allItems = false;
         $quantityTrace = 'Y';
         $canBuyZero = 'N';
         foreach ($items as &$oneItem) {
             $weight += $oneItem['WEIGHT'] * $oneItem['QUANTITY_IN_SET'];
         }
         unset($oneItem);
     }
     foreach ($tracedItems as &$oneItem) {
         if ($oneItem['QUANTITY'] <= 0) {
             $itemQuantity = 0;
         } else {
             $itemQuantity = (int) floor($oneItem['QUANTITY'] / $oneItem['QUANTITY_IN_SET']);
         }
         if ($quantity === null || $quantity > $itemQuantity) {
             $quantity = $itemQuantity;
         }
         if ($allItems) {
             $weight += $oneItem['WEIGHT'] * $oneItem['QUANTITY_IN_SET'];
         }
     }
     unset($oneItem);
     $measure = CCatalogMeasure::getDefaultMeasure(true, false);
     $fields = array('WEIGHT' => $weight, 'QUANTITY' => $quantity, 'QUANTITY_TRACE' => $quantityTrace, 'CAN_BUY_ZERO' => $canBuyZero, 'NEGATIVE_AMOUNT_TRACE' => $canBuyZero, 'MEASURE' => $measure['ID'], 'TYPE' => CCatalogProduct::TYPE_SET);
     $update = $DB->PrepareUpdate('b_catalog_product', $fields);
     if (!empty($update)) {
         $query = "update b_catalog_product set " . $update . " where ID = " . $productID;
         $DB->Query($query, false, 'File: ' . __FILE__ . '<br>Line: ' . __LINE__);
     }
     $query = "delete from b_catalog_measure_ratio where PRODUCT_ID = " . $productID;
     $DB->Query($query, false, 'File: ' . __FILE__ . '<br>Line: ' . __LINE__);
     $fields = array('PRODUCT_ID' => $productID, 'RATIO' => 1);
     $insert = $DB->PrepareInsert('b_catalog_measure_ratio', $fields);
     $query = "insert into b_catalog_measure_ratio (" . $insert[0] . ") values(" . $insert[1] . ")";
     $DB->Query($query, false, 'File: ' . __FILE__ . '<br>Line: ' . __LINE__);
     return true;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:49,代码来源:product_set.php

示例10: array

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if ($arResult["ELEMENT"]['DETAIL_PICTURE'] || $arResult["ELEMENT"]['PREVIEW_PICTURE']) {
    $arFileTmp = CFile::ResizeImageGet($arResult["ELEMENT"]['DETAIL_PICTURE'] ? $arResult["ELEMENT"]['DETAIL_PICTURE'] : $arResult["ELEMENT"]['PREVIEW_PICTURE'], array("width" => "150", "height" => "180"), BX_RESIZE_IMAGE_PROPORTIONAL, true);
    $arResult["ELEMENT"]['DETAIL_PICTURE'] = $arFileTmp;
}
if ($arParams["SHOW_MEASURE"] == "Y" && $arResult["ELEMENT"]["CATALOG_MEASURE"]) {
    $arResult["ELEMENT"]["MEASURE"] = CCatalogMeasure::getList(array(), array("ID" => $arResult["ELEMENT"]["CATALOG_MEASURE"]), false, false, array())->GetNext();
}
$arDefaultSetIDs = array($arResult["ELEMENT"]["ID"]);
foreach (array("DEFAULT", "OTHER") as $type) {
    foreach ($arResult["SET_ITEMS"][$type] as $key => $arItem) {
        $arElement = array("ID" => $arItem["ID"], "NAME" => $arItem["NAME"], "DETAIL_PAGE_URL" => $arItem["DETAIL_PAGE_URL"], "DETAIL_PICTURE" => $arItem["DETAIL_PICTURE"], "PREVIEW_PICTURE" => $arItem["PREVIEW_PICTURE"], "PRICE_CURRENCY" => $arItem["PRICE_CURRENCY"], "PRICE_DISCOUNT_VALUE" => $arItem["PRICE_DISCOUNT_VALUE"], "PRICE_PRINT_DISCOUNT_VALUE" => $arItem["PRICE_PRINT_DISCOUNT_VALUE"], "PRICE_VALUE" => $arItem["PRICE_VALUE"], "PRICE_PRINT_VALUE" => $arItem["PRICE_PRINT_VALUE"], "PRICE_DISCOUNT_DIFFERENCE_VALUE" => $arItem["PRICE_DISCOUNT_DIFFERENCE_VALUE"], "PRICE_DISCOUNT_DIFFERENCE" => $arItem["PRICE_DISCOUNT_DIFFERENCE"], "CATALOG_MEASURE" => $arItem["CATALOG_MEASURE"]);
        if ($arParams["SHOW_MEASURE"] == "Y" && $arElement["CATALOG_MEASURE"]) {
            $arElement["MEASURE"] = CCatalogMeasure::getList(array(), array("ID" => $arElement["CATALOG_MEASURE"]), false, false, array())->GetNext();
        }
        if ($arItem["PRICE_CONVERT_DISCOUNT_VALUE"]) {
            $arElement["PRICE_CONVERT_DISCOUNT_VALUE"] = $arItem["PRICE_CONVERT_DISCOUNT_VALUE"];
        }
        if ($arItem["PRICE_CONVERT_VALUE"]) {
            $arElement["PRICE_CONVERT_VALUE"] = $arItem["PRICE_CONVERT_VALUE"];
        }
        if ($arItem["PRICE_CONVERT_DISCOUNT_DIFFERENCE_VALUE"]) {
            $arElement["PRICE_CONVERT_DISCOUNT_DIFFERENCE_VALUE"] = $arItem["PRICE_CONVERT_DISCOUNT_DIFFERENCE_VALUE"];
        }
        if ($type == "DEFAULT") {
            $arDefaultSetIDs[] = $arItem["ID"];
        }
        if ($arItem['DETAIL_PICTURE'] || $arItem['PREVIEW_PICTURE']) {
            $arFileTmp = CFile::ResizeImageGet($arItem['DETAIL_PICTURE'] ? $arItem['DETAIL_PICTURE'] : $arItem['PREVIEW_PICTURE'], array("width" => "150", "height" => "180"), BX_RESIZE_IMAGE_PROPORTIONAL, true);
开发者ID:Andreyjktl,项目名称:rezina74,代码行数:31,代码来源:result_modifier.php

示例11: GetDefaultMeasure

 public static function GetDefaultMeasure()
 {
     if (self::$catalogIncluded === null) {
         self::$catalogIncluded = Loader::includeModule('catalog');
     }
     return self::$catalogIncluded ? array() : CCatalogMeasure::getDefaultMeasure(true, true);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:7,代码来源:comp_pricetools.php

示例12: array

                        $lAdmin->AddGroupError(GetMessage("ERROR_DELETING_TYPE"), $ID);
                    }
                } else {
                    $DB->Commit();
                }
                break;
        }
    }
}
$arSelect = array("ID", "MEASURE_TITLE", "SYMBOL_RUS", "SYMBOL_INTL", "SYMBOL_LETTER_INTL", "IS_DEFAULT");
if (array_key_exists("mode", $_REQUEST) && $_REQUEST["mode"] == "excel") {
    $arNavParams = false;
} else {
    $arNavParams = array("nPageSize" => CAdminResult::GetNavSize($sTableID));
}
$dbResultList = CCatalogMeasure::getList(array($_REQUEST["by"] => $_REQUEST["order"]), array(), false, $arNavParams, $arSelect);
$dbResultList = new CCatalogMeasureAdminResult($dbResultList, $sTableID);
$dbResultList->NavStart();
$lAdmin->NavText($dbResultList->GetNavPrint(GetMessage("CAT_MEASURE_TITLE")));
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "ID", "default" => true), array("id" => "CODE", "content" => GetMessage("CAT_MEASURE_CODE"), "sort" => "CODE", "default" => true), array("id" => "MEASURE_TITLE", "content" => GetMessage("CAT_MEASURE_MEASURE_TITLE"), "sort" => "MEASURE_TITLE", "default" => true), array("id" => "SYMBOL_RUS", "content" => GetMessage("CAT_MEASURE_SYMBOL_RUS"), "sort" => "SYMBOL_RUS", "default" => true), array("id" => "SYMBOL_INTL", "content" => GetMessage("CAT_MEASURE_SYMBOL_INTL"), "sort" => "SYMBOL_INTL", "default" => true), array("id" => "SYMBOL_LETTER_INTL", "content" => GetMessage("CAT_MEASURE_SYMBOL_LETTER_INTL"), "sort" => "SYMBOL_LETTER_INTL", "default" => false), array("id" => "IS_DEFAULT", "content" => GetMessage("CAT_MEASURE_IS_DEFAULT"), "sort" => "IS_DEFAULT", "default" => true)));
$arSelectFieldsMap = array("ID" => false, "CODE" => false, "MEASURE_TITLE" => false, "SYMBOL_RUS" => false, "SYMBOL_INTL" => false, "SYMBOL_LETTER_INTL" => false, "IS_DEFAULT" => false);
$arSelectFields = $lAdmin->GetVisibleHeaderColumns();
if (!in_array('ID', $arSelectFields)) {
    $arSelectFields[] = 'ID';
}
$arSelectFieldsMap = array_merge($arSelectFieldsMap, array_fill_keys($arSelectFields, true));
$arUserList = array();
$arUserID = array();
$strNameFormat = CSite::GetNameFormat(true);
$arRows = array();
while ($arRes = $dbResultList->Fetch()) {
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:cat_measure_list.php

示例13: getCurrentRatioWithMeasure

 /**
  * Returns ratio and measure for products.
  *
  * @param array|int $product				Product ids.
  * @return array|bool
  * @throws Main\ArgumentException
  */
 public static function getCurrentRatioWithMeasure($product)
 {
     if (!is_array($product)) {
         $product = array($product);
     }
     Main\Type\Collection::normalizeArrayValuesByInt($product, true);
     if (empty($product)) {
         return false;
     }
     $result = array();
     $defaultMeasure = \CCatalogMeasure::getDefaultMeasure(true, true);
     $defaultRow = array('RATIO' => 1, 'MEASURE' => !empty($defaultMeasure) ? $defaultMeasure : array());
     $existProduct = array();
     $measureMap = array();
     $productRows = array_chunk($product, 500);
     foreach ($productRows as &$row) {
         $productIterator = self::getList(array('select' => array('ID', 'MEASURE'), 'filter' => array('@ID' => $row), 'order' => array('ID' => 'ASC')));
         while ($item = $productIterator->fetch()) {
             $item['ID'] = (int) $item['ID'];
             $item['MEASURE'] = (int) $item['MEASURE'];
             self::$existProductCache[$item['ID']] = true;
             $existProduct[] = $item['ID'];
             $result[$item['ID']] = $defaultRow;
             if ($item['MEASURE'] > 0) {
                 if (!isset($measureMap[$item['MEASURE']])) {
                     $measureMap[$item['MEASURE']] = array();
                 }
                 $measureMap[$item['MEASURE']][] =& $result[$item['ID']];
             }
         }
         unset($item, $productIterator);
     }
     unset($row, $productRows);
     unset($defaultRow, $defaultMeasure);
     if (empty($existProduct)) {
         return false;
     }
     $ratioResult = MeasureRatioTable::getCurrentRatio($existProduct);
     if (!empty($ratioResult)) {
         foreach ($ratioResult as $ratioProduct => $ratio) {
             $result[$ratioProduct]['RATIO'] = $ratio;
         }
         unset($ratio, $ratioProduct);
     }
     unset($ratioResult);
     unset($existProduct);
     if (!empty($measureMap)) {
         $measureIterator = \CCatalogMeasure::getList(array(), array('@ID' => array_keys($measureMap)), false, false, array());
         while ($measure = $measureIterator->getNext()) {
             $measure['ID'] = (int) $measure['ID'];
             if (empty($measureMap[$measure['ID']])) {
                 continue;
             }
             foreach ($measureMap[$measure['ID']] as &$product) {
                 $product['MEASURE'] = $measure;
             }
             unset($product);
         }
         unset($measure, $measureIterator);
     }
     unset($measureMap);
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:70,代码来源:product.php

示例14: GetDefaultMeasure

	public static function GetDefaultMeasure()
	{
		if (self::$catalogIncluded === null)
			self::$catalogIncluded = \Freetrix\Main\Loader::includeModule('catalog');
		return (self::$catalogIncluded ? array() : CCatalogMeasure::getDefaultMeasure(true, true));
	}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:6,代码来源:comp_pricetools.php

示例15: SubscribeProduct

/**
 * @param int $intProductID
 * @param array $arRewriteFields
 * @param array $arProductParams
 * @return bool|int
 */
function SubscribeProduct($intProductID, $arRewriteFields = array(), $arProductParams = array())
{
    global $USER, $APPLICATION;
    if (!CCatalog::IsUserExists()) {
        return false;
    }
    if (!$USER->IsAuthorized()) {
        return false;
    }
    $intUserID = (int) $USER->GetID();
    $intProductID = (int) $intProductID;
    if ($intProductID <= 0) {
        $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_EMPTY_PRODUCT_ID'), "EMPTY_PRODUCT_ID");
        return false;
    }
    if (!Loader::includeModule("sale")) {
        $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_NO_SALE_MODULE'), "NO_SALE_MODULE");
        return false;
    }
    if (Loader::includeModule("statistic") && isset($_SESSION['SESS_SEARCHER_ID']) && (int) $_SESSION["SESS_SEARCHER_ID"] > 0) {
        $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_SESS_SEARCHER'), "SESS_SEARCHER");
        return false;
    }
    $rsProducts = CCatalogProduct::GetList(array(), array('ID' => $intProductID), false, false, array('ID', 'WEIGHT', 'WIDTH', 'HEIGHT', 'LENGTH', 'TYPE', 'MEASURE', 'SUBSCRIBE'));
    if (!($arCatalogProduct = $rsProducts->Fetch())) {
        $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_NO_PRODUCT'), "NO_PRODUCT");
        return false;
    }
    if ($arCatalogProduct['SUBSCRIBE'] == 'N') {
        $APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_NO_SUBSCRIBE'), 'SUBSCRIBE');
        return false;
    }
    $arCatalogProduct['MEASURE'] = (int) $arCatalogProduct['MEASURE'];
    $arCatalogProduct['MEASURE_NAME'] = '';
    $arCatalogProduct['MEASURE_CODE'] = 0;
    if ($arCatalogProduct['MEASURE'] <= 0) {
        $arMeasure = CCatalogMeasure::getDefaultMeasure(true, true);
        $arCatalogProduct['MEASURE_NAME'] = $arMeasure['~SYMBOL_RUS'];
        $arCatalogProduct['MEASURE_CODE'] = $arMeasure['CODE'];
    } else {
        $rsMeasures = CCatalogMeasure::getList(array(), array('ID' => $arCatalogProduct['MEASURE']), false, false, array('ID', 'SYMBOL_RUS', 'CODE'));
        if ($arMeasure = $rsMeasures->GetNext()) {
            $arCatalogProduct['MEASURE_NAME'] = $arMeasure['~SYMBOL_RUS'];
            $arCatalogProduct['MEASURE_CODE'] = $arMeasure['CODE'];
        }
    }
    $rsItems = CIBlockElement::GetList(array(), array("ID" => $intProductID, "ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "CHECK_PERMISSIONS" => "Y", "MIN_PERMISSION" => "R"), false, false, array('ID', 'IBLOCK_ID', 'NAME', 'XML_ID', 'DETAIL_PAGE_URL'));
    if (!($arProduct = $rsItems->GetNext())) {
        return false;
    }
    $arParentSku = CCatalogSku::GetProductInfo($intProductID, $arProduct['IBLOCK_ID']);
    if (!empty($arParentSku)) {
        if (strpos($arProduct["~XML_ID"], '#') === false) {
            $parentIterator = Iblock\ElementTable::getList(array('select' => array('ID', 'XML_ID'), 'filter' => array('ID' => $arParentSku['ID'])));
            if ($parent = $parentIterator->fetch()) {
                $arProduct["~XML_ID"] = $parent['XML_ID'] . '#' . $arProduct["~XML_ID"];
            }
            unset($parent, $parentIterator);
        }
    }
    $arPrice = array('PRICE' => 0.0, 'CURRENCY' => CSaleLang::GetLangCurrency(SITE_ID), 'VAT_RATE' => 0, 'PRODUCT_PRICE_ID' => 0, 'CATALOG_GROUP_NAME' => '');
    $arBuyerGroups = $USER->GetUserGroupArray();
    $arSubscrPrice = CCatalogProduct::GetOptimalPrice($intProductID, 1, $arBuyerGroups, "N", array(), SITE_ID, array());
    if (!empty($arSubscrPrice) && is_array($arSubscrPrice)) {
        $arPrice['PRICE'] = $arSubscrPrice['DISCOUNT_PRICE'];
        $arPrice['CURRENCY'] = CCurrency::GetBaseCurrency();
        $arPrice['VAT_RATE'] = $arSubscrPrice['PRICE']['VAT_RATE'];
        $arPrice['PRODUCT_PRICE_ID'] = $arSubscrPrice["PRICE"]["ID"];
        $arPrice['CATALOG_GROUP_NAME'] = $arSubscrPrice["PRICE"]["CATALOG_GROUP_NAME"];
    }
    $arProps = array();
    $strIBlockXmlID = (string) CIBlock::GetArrayByID($arProduct['IBLOCK_ID'], 'XML_ID');
    if ($strIBlockXmlID !== '') {
        $arProps[] = array("NAME" => "Catalog XML_ID", "CODE" => "CATALOG.XML_ID", "VALUE" => $strIBlockXmlID);
    }
    if (!empty($arProductParams) && is_array($arProductParams)) {
        foreach ($arProductParams as &$arOneProductParams) {
            $arProps[] = array("NAME" => $arOneProductParams["NAME"], "CODE" => $arOneProductParams["CODE"], "VALUE" => $arOneProductParams["VALUE"], "SORT" => $arOneProductParams["SORT"]);
        }
        unset($arOneProductParams);
    }
    $arProps[] = array("NAME" => "Product XML_ID", "CODE" => "PRODUCT.XML_ID", "VALUE" => $arProduct["XML_ID"]);
    $arFields = array("PRODUCT_ID" => $intProductID, "PRODUCT_PRICE_ID" => $arPrice['PRODUCT_PRICE_ID'], "PRICE" => $arPrice['PRICE'], "CURRENCY" => $arPrice['CURRENCY'], "WEIGHT" => $arCatalogProduct["WEIGHT"], "DIMENSIONS" => serialize(array("WIDTH" => $arCatalogProduct["WIDTH"], "HEIGHT" => $arCatalogProduct["HEIGHT"], "LENGTH" => $arCatalogProduct["LENGTH"])), "QUANTITY" => 1, "LID" => SITE_ID, "DELAY" => "N", "CAN_BUY" => "N", "SUBSCRIBE" => "Y", "NAME" => $arProduct["~NAME"], "MODULE" => "catalog", "PRODUCT_PROVIDER_CLASS" => "CCatalogProductProvider", "NOTES" => $arPrice["CATALOG_GROUP_NAME"], "DETAIL_PAGE_URL" => $arProduct["~DETAIL_PAGE_URL"], "CATALOG_XML_ID" => $strIBlockXmlID, "PRODUCT_XML_ID" => $arProduct["~XML_ID"], "PROPS" => $arProps, "TYPE" => $arCatalogProduct["TYPE"] == CCatalogProduct::TYPE_SET ? CCatalogProductSet::TYPE_SET : NULL, "MEASURE_NAME" => $arCatalogProduct['MEASURE_NAME'], "MEASURE_CODE" => $arCatalogProduct['MEASURE_CODE'], 'IGNORE_CALLBACK_FUNC' => 'Y');
    if (!empty($arRewriteFields) && is_array($arRewriteFields)) {
        if (array_key_exists('SUBSCRIBE', $arRewriteFields)) {
            unset($arRewriteFields['SUBSCRIBE']);
        }
        if (array_key_exists('CAN_BUY', $arRewriteFields)) {
            unset($arRewriteFields['CAN_BUY']);
        }
        if (array_key_exists('DELAY', $arRewriteFields)) {
            unset($arRewriteFields['DELAY']);
        }
        if (!empty($arRewriteFields)) {
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:include.php


注:本文中的CCatalogMeasure类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。