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


PHP CIBlockElement::Getlist方法代码示例

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


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

示例1: AddProduct

 function AddProduct($NAME)
 {
     $iblock_permission = CIBlock::GetPermission(IBLOCK_ID);
     if ($iblock_permission < "W") {
         $GLOBALS["USER"]->RequiredHTTPAuthBasic();
         return new CSOAPFault('Server Error', 'Unable to authorize user.');
     }
     $code = self::translit($NAME);
     $i = 1;
     while (true) {
         $res = CIBlockElement::Getlist(array(), array("CODE" => $code), false, array("CODE"));
         if ($res->Fetch()) {
             $code = self::translit($NAME) . $i;
         } else {
             break;
         }
         $i++;
     }
     $arFields = array("IBLOCK_ID" => IBLOCK_ID, "NAME" => $NAME);
     $ib_element = new CIBlockElement();
     $result = $ib_element->Add($arFields);
     if ($result > 0) {
         return $result;
     }
     return new CSOAPFault('Server Error', 'Error: ' . $ib_element->LAST_ERROR);
 }
开发者ID:doppler324,项目名称:componentforworkingwithbitrix,代码行数:26,代码来源:HelperProduct.php

示例2: GetElement

 public function GetElement($types, $MS)
 {
     $strXML = "";
     $arSort = array("ID" => "ASC");
     $arResult["OFFER"] = array();
     if (self::CheckArray($this->IBLOCK_ID)) {
         foreach ($this->IBLOCK_ID as $ibl) {
             $rsElements = CIBlockElement::Getlist($arSort, $this->arFilter[$ibl], false, false, $this->arSelect);
             if ($this->DETAIL_PAGE_URL) {
                 $rsElements->SetUrlTemplates($this->DETAIL_PAGE_URL);
             }
             while ($arOffer = $rsElements->GetNext()) {
                 $flag = 0;
                 if ($this->USE_SKU && $this->sku_IBLOCK_ID[$ibl] > 0) {
                     if (is_array($this->arSKU_Filter[$ibl]) && sizeof($this->arSKU_Filter[$ibl]) > 0) {
                         $skuFILTER = $this->arSKU_Filter[$ibl];
                         $skuFILTER["IBLOCK_ID"] = $this->sku_IBLOCK_ID[$ibl];
                         $skuFILTER[CGMExport::GetProp($this->sku_PROPERTY[$ibl])] = $arOffer["ID"];
                         $skuFILTER["ACTIVE"] = "Y";
                     } else {
                         $skuFILTER["IBLOCK_ID"] = $this->sku_IBLOCK_ID[$ibl];
                         $skuFILTER["ACTIVE"] = "Y";
                         $skuFILTER[CGMExport::GetProp($this->sku_PROPERTY[$ibl])] = $arOffer["ID"];
                     }
                     $arOfferInOb = CIBLockElement::GetList($arSort, $skuFILTER, false, false, $this->arSelect);
                     if ($this->DETAIL_PAGE_URL) {
                         $arOfferInOb->SetUrlTemplates($this->DETAIL_PAGE_URL);
                     }
                     while ($arOfferIn = $arOfferInOb->GetNext()) {
                         $flag = 1;
                         $arOfferIn1["g:availability"] = "in stock";
                         $arOfferIn1["g:id"] = $arOfferIn["ID"];
                         $arOfferIn1["g:condition"] = $this->CONDITIONS;
                         $arOfferIn1["g:item_group_id"] = $arOffer["ID"];
                         switch ($this->NAMESCHEMA) {
                             case "NAME_OFFER":
                                 $arOfferIn1["title"] = text2xml($arOffer["NAME"], true, true, $this->ENCODING);
                                 break;
                             case "NAME_OFFER_SKU":
                                 $arOfferIn1["title"] = text2xml($arOffer["NAME"] . "/" . $arOfferIn["NAME"], true, true, $this->ENCODING);
                                 break;
                             default:
                                 $arOfferIn1["title"] = text2xml($arOfferIn["NAME"], true, true, $this->ENCODING);
                                 break;
                         }
                         $arOfferIn1["g:price"] = $this->yandex_GetPrice(array("IBLOCK_ID" => $this->sku_IBLOCK_ID[$ibl], "ID" => $arOfferIn["ID"]));
                         if ($arOfferIn1["g:price"] > 0) {
                             $arOfferIn1["g:price"] .= " " . $this->baseCur;
                         }
                         $tr = CCatalogProduct::GetByID($arOfferIn["ID"]);
                         if ($tr["QUANTITY_TRACE"] == "N") {
                             $arOfferIn1["g:availability"] = "in stock";
                         } else {
                             if ($tr["QUANTITY"] > 0) {
                                 $arOfferIn1["g:availability"] = "in stock";
                             } else {
                                 if ($this->FORORDER) {
                                     $arOfferIn1["g:availability"] = "preorder";
                                 } else {
                                     $arOfferIn1["g:availability"] = "out of stock";
                                 }
                             }
                         }
                         $arOfferIn1["g:product_type"] = str_replace(">", "&gt;", $this->GOOGLE_CATEGORY[$arOffer["IBLOCK_SECTION_ID"]]["THIS"]);
                         $arOfferIn1["g:google_product_category"] = str_replace(">", "&gt;", $this->GOOGLE_CATEGORY[$arOffer["IBLOCK_SECTION_ID"] ? $arOffer["IBLOCK_SECTION_ID"] : $arOffer["IBLOCK_ID"]]["GOOGLE"]);
                         if ($arOffer["DETAIL_PAGE_URL"]) {
                             $arOfferIn1["g:link_href"] = "http://" . $this->DOMAIN_NAME . $arOffer["DETAIL_PAGE_URL"] . "#" . $arOfferIn["ID"];
                         } else {
                             $arOfferIn1["g:link_href"] = "http://" . $this->DOMAIN_NAME . $arOffer["DETAIL_PAGE_URL"];
                         }
                         if ($arOfferIn["PREVIEW_PICTURE"]) {
                             $db_file = CFile::GetByID($arOfferIn["PREVIEW_PICTURE"]);
                             if ($ar_file = $db_file->Fetch()) {
                                 $arOfferIn1["g:image_link"] = "http://" . $this->DOMAIN_NAME . "/" . COption::GetOptionString("main", "upload_dir", "upload") . "/" . $ar_file["SUBDIR"] . "/" . implode("/", array_map("rawurlencode", explode("/", $ar_file["FILE_NAME"])));
                             }
                         }
                         if ($arOfferIn["DETAIL_PICTURE"]) {
                             $db_file = CFile::GetByID($arOfferIn["DETAIL_PICTURE"]);
                             if ($ar_file = $db_file->Fetch()) {
                                 $arOfferIn1["g:image_link"] = "http://" . $this->DOMAIN_NAME . "/" . COption::GetOptionString("main", "upload_dir", "upload") . "/" . $ar_file["SUBDIR"] . "/" . implode("/", array_map("rawurlencode", explode("/", $ar_file["FILE_NAME"])));
                             }
                         }
                         if ($this->GetPropInData("g:image_link", $this->XML_DATA)) {
                             $ph = CIBlockElement::GetProperty($this->sku_IBLOCK_ID, $arOfferIn["ID"], array("sort" => "asc"), array("ID" => $this->GetPropInData("g:image_link", $this->XML_DATA)));
                             while ($ob = $ph->GetNext()) {
                                 $arFile = CFile::GetFileArray($ob["VALUE"]);
                                 if (!empty($arFile)) {
                                     if (strpos($arFile["SRC"], "http") === false) {
                                         $pic = "http://" . $this->DOMAIN_NAME . implode("/", array_map("rawurlencode", explode("/", $arFile["SRC"])));
                                     } else {
                                         $ar = explode("http://", $arFile["SRC"]);
                                         $pic = "http://" . implode("/", array_map("rawurlencode", explode("/", $ar[1])));
                                     }
                                     $arOfferIn1["g:image_link"][] = $pic;
                                 }
                             }
                         }
                         if (!$arOfferIn["g:image_link"]) {
                             if ($arOffer["PREVIEW_PICTURE"]) {
                                 $db_file = CFile::GetByID($arOffer["PREVIEW_PICTURE"]);
//.........这里部分代码省略.........
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:101,代码来源:profile.php


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