$productsWithBarCode = array(); while ($product = $rsProducts->Fetch()) { if (isset($arRows['E'.$product["ID"]])) { if ($product["BARCODE_MULTI"] == "Y") $arRows['E'.$product["ID"]]->arRes["CATALOG_BAR_CODE"] = GetMessage("IBLIST_A_CATALOG_BAR_CODE_MULTI"); else $productsWithBarCode[] = $product["ID"]; } } if (!empty($productsWithBarCode)) { $arBarCodes = array(); $rsProducts = CCatalogStoreBarCode::getList(array(), array( "PRODUCT_ID" => $productsWithBarCode, )); while ($product = $rsProducts->Fetch()) { $arBarCodes[$product["PRODUCT_ID"]][] = htmlspecialcharsEx($product["BARCODE"]); } foreach($arBarCodes as $productId => $barcode) { if (isset($arRows['E'.$productId])) { $arRows['E'.$productId]->arRes["CATALOG_BAR_CODE"] = implode(', ', $barcode); } } } } if (!empty($arProductGroupIDs))
protected function getFilter() { $arFilter = array("IBLOCK_ID" => $this->getIblockId(), 'SECTION_ID' => $this->getSectionId() > 0 ? $this->getSectionId() : 0, 'ACTIVE' => empty($_REQUEST['filter_active']) ? 'Y' : $_REQUEST['filter_active'], "WF_PARENT_ELEMENT_ID" => false, "SHOW_NEW" => "Y"); if ($arProps = $this->getProps()) { $filtered = null; foreach ($arProps as $arProp) { $value = $_REQUEST['filter_el_property_' . $arProp["ID"]]; if (array_key_exists("AddFilterFields", $arProp["PROPERTY_USER_TYPE"])) { call_user_func_array($arProp["PROPERTY_USER_TYPE"]["AddFilterFields"], array($arProp, array("VALUE" => "filter_el_property_" . $arProp["ID"]), &$arFilter, &$filtered)); } elseif (is_array($value) || strlen($value)) { if ($value === "NOT_REF") { $value = false; } $arFilter["?PROPERTY_" . $arProp["ID"]] = $value; } } } $arSubQuery = array(); if ($arSKUProps = $this->getSkuProps()) { $arCatalog = $this->getOffersCatalog(); $arSubQuery = array("IBLOCK_ID" => $arCatalog['IBLOCK_ID']); $filtered = null; for ($i = 0, $intPropCount = count($arSKUProps); $i < $intPropCount; $i++) { if ('Y' == $arSKUProps[$i]["FILTRABLE"] && 'F' != $arSKUProps[$i]["PROPERTY_TYPE"] && $arCatalog['SKU_PROPERTY_ID'] != $arSKUProps[$i]["ID"]) { if (array_key_exists("AddFilterFields", $arSKUProps[$i]["PROPERTY_USER_TYPE"])) { call_user_func_array($arSKUProps[$i]["PROPERTY_USER_TYPE"]["AddFilterFields"], array($arSKUProps[$i], array("VALUE" => "filter_sub_el_property_" . $arSKUProps[$i]["ID"]), &$arSubQuery, &$filtered)); } else { $value = $_REQUEST['filter_sub_el_property_' . $arSKUProps[$i]["ID"]]; if (is_array($value) || strlen($value)) { if ($value === "NOT_REF") { $value = false; } $arSubQuery["?PROPERTY_" . $arSKUProps[$i]["ID"]] = $value; } } } } } if (!empty($_REQUEST["filter_timestamp_from"])) { $arFilter["DATE_MODIFY_FROM"] = $_REQUEST["filter_timestamp_from"]; } if (!empty($_REQUEST["filter_timestamp_to"])) { $arFilter["DATE_MODIFY_TO"] = $_REQUEST["filter_timestamp_to"]; } if (!empty($_REQUEST["filter_code"])) { $arFilter["CODE"] = $_REQUEST["filter_code"]; } $arSearchedIds = $arSearchedSectionIds = null; if (!empty($_REQUEST['QUERY'])) { $arFilter['QUERY'] = $_REQUEST['QUERY']; $arSearchedIds = $arSearchedSectionIds = array(0); if (preg_match('#^[0-9\\s]+$#', $_REQUEST['QUERY'])) { $barcode = preg_replace('#[^0-9]#', '', $_REQUEST['QUERY']); if (strlen($barcode) > 0) { $rsBarCode = \CCatalogStoreBarCode::getList(array(), array("BARCODE" => $barcode), false, false, array('PRODUCT_ID')); while ($res = $rsBarCode->Fetch()) { $res2 = \CCatalogSKU::GetProductInfo($res["PRODUCT_ID"]); $arSearchedIds[] = $res2 ? $res2['ID'] : $res['PRODUCT_ID']; } } } elseif ($this->isAdvancedSearchAvailable()) { $arFilter['PARAM2'] = $this->getIblockId(); if (!empty($arFilter['SECTION_ID'])) { $arFilter['PARAMS'] = array('iblock_section' => $arFilter['SECTION_ID']); } $obSearch = new \CSearch(); $obSearch->Search($arFilter); $cnt = 0; $activeSectionId = $this->getSectionId(); while ($ar = $obSearch->Fetch()) { if (strpos($ar['ITEM_ID'], 'S') === 0) { $sectionId = preg_replace('#[^0-9]+#', '', $ar['ITEM_ID']); if ($sectionId != $activeSectionId) { $arSearchedSectionIds[] = $sectionId; } } else { $arSearchedIds[] = $ar['ITEM_ID']; } if (++$cnt >= 100) { break; } } } else { $arSearchedIds = $arSearchedSectionIds = null; $arFilter['NAME'] = $_REQUEST['QUERY']; } } if (sizeof($arSubQuery) > 1) { $arFilteredIds = array(0); $db = \CIBlockElement::GetList(array(), $arSubQuery, false, false, array('PROPERTY_' . $arCatalog['SKU_PROPERTY_ID'])); while ($res = $db->Fetch()) { $arFilteredIds[] = $res['PROPERTY_' . $arCatalog['SKU_PROPERTY_ID'] . '_VALUE']; } $arFilter['ID'] = is_array($arSearchedIds) ? array_intersect($arFilteredIds, $arSearchedIds) : $arFilteredIds; } elseif ($arSearchedIds) { $arFilter['ID'] = $arSearchedIds; } if ($arSearchedSectionIds) { $arFilter['S_ID'] = $arSearchedSectionIds; } unset($arFilter['PARAM1'], $arFilter['PARAM2'], $arFilter['PARAMS']); if ($this->isFiltering() || !empty($_REQUEST['QUERY'])) { $arFilter['INCLUDE_SUBSECTIONS'] = 'Y'; if (isset($arFilter['SECTION_ID']) && $arFilter['SECTION_ID'] == 0) { unset($arFilter["SECTION_ID"]); } } return $arFilter; }
unset($arSelectedProps[$aProp['ID']]["CACHE"]); } } } else { $fieldValue = ""; $nearestQuantity = $QUANTITY; $amountToStore = 0; if ($storeFromId > 0) { $dbStoreProduct = CCatalogStoreProduct::GetList(array(), array("PRODUCT_ID" => $arItems["ID"], "STORE_ID" => $storeFromId)); if ($arStoreProduct = $dbStoreProduct->Fetch()) { $amountToStore = $arStoreProduct["AMOUNT"]; } } $arCatalogProduct["BARCODE"] = ''; if ($arCatalogProduct["BARCODE_MULTI"] == 'N') { $dbBarCodes = CCatalogStoreBarCode::getList(array(), array("PRODUCT_ID" => $arItems["ID"])); while ($arBarCode = $dbBarCodes->Fetch()) { $arCatalogProduct["BARCODE"][] = $arBarCode["BARCODE"]; } } if (is_array($arCatalogProduct["BARCODE"])) { $arCatalogProduct["BARCODE"] = implode(', ', $arCatalogProduct["BARCODE"]); } $balance = $storeFromId > 0 ? FloatVal($arCatalogProduct["QUANTITY"]) . " / " . FloatVal($amountToStore) : FloatVal($arCatalogProduct["QUANTITY"]); $row->AddField("BALANCE", $balance); $row->AddViewField("PREVIEW_PICTURE", CFileInput::Show('NO_FIELDS[' . $arItems['ID'] . '][PREVIEW_PICTURE]', $arItems['PREVIEW_PICTURE'], 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))); $row->AddViewField("DETAIL_PICTURE", CFileInput::Show('NO_FIELDS[' . $arItems['ID'] . '][DETAIL_PICTURE]', $arItems['DETAIL_PICTURE'], 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))); $bCanBuy = true; if ($arCatalogProduct["CAN_BUY_ZERO"] != "Y" && ($arCatalogProduct["QUANTITY_TRACE"] == "Y" && doubleval($arCatalogProduct["QUANTITY"]) <= 0)) { $bCanBuy = false; }
protected function getProductIdByBarcodeAction() { \Bitrix\Main\Loader::includeModule('catalog'); $barcode = $this->request['barcode']; if (strlen($barcode) > 0) { $rsBarCode = \CCatalogStoreBarCode::getList(array(), array("BARCODE" => $barcode), false, false, array('PRODUCT_ID')); $arBarCode = $rsBarCode->Fetch(); } $this->addResultData('RESULT', array("PRODUCT_ID" => isset($arBarCode["PRODUCT_ID"]) ? intval($arBarCode["PRODUCT_ID"]) : 0)); }
} foreach($arAllDocumentElement as $arDocumentElement) { $arElement = $arElementBarcode = array(); $isMultiSingleBarcode = $selectedBarcode = false; foreach($arDocumentElement as $key => $value) { $arElement[$key] = $value; } if($arDocumentElement["IS_MULTIPLY_BARCODE"] == 'N') { if(isset($arElement["BARCODE"])) unset($arElement["BARCODE"]); $dbDocumentStoreBarcode = CCatalogStoreBarCode::getList(array(), array("PRODUCT_ID" => $arDocumentElement["ELEMENT_ID"])); while($arDocumentStoreBarcode = $dbDocumentStoreBarcode->Fetch()) { $arElementBarcode[] = $arDocumentStoreBarcode["BARCODE"]; } if(count($arElementBarcode) > 1) { $isMultiSingleBarcode = true; if($bReadOnly) $arElementBarcode = array(); } } if($arDocumentElement["IS_MULTIPLY_BARCODE"] == 'Y' || $isMultiSingleBarcode) {
function fEnableSub() { if (document.getElementById('tbl_sale_order_edit')) document.getElementById('tbl_sale_order_edit').style.zIndex = 10000; } </script> <?php if ($ID > 0) { $arSelect = array("ID", "DOC_ID", "STORE_FROM", "STORE_TO", "ELEMENT_ID", "AMOUNT", "PURCHASING_PRICE", "IS_MULTIPLY_BARCODE"); $dbResult = CCatalogStoreDocsElement::GetList(array(), array('DOC_ID' => $ID), false, false, $arSelect); while ($product = $dbResult->GetNext()) { $docElementId = $product["ID"]; $product = array_merge($product, CCatalogStoreControlUtil::getProductInfo($product["ELEMENT_ID"])); $product["BARCODE"] = ''; if ($product["IS_MULTIPLY_BARCODE"] == 'N') { $dbBarCode = CCatalogStoreBarCode::getList(array(), array("PRODUCT_ID" => $product["ELEMENT_ID"])); if ($arBarCode = $dbBarCode->GetNext()) { $product["BARCODE"] = $arBarCode["BARCODE"]; } } elseif ($product["IS_MULTIPLY_BARCODE"] == 'Y') { $dbBarCodes = CCatalogStoreDocsBarcode::getList(array(), array("DOC_ELEMENT_ID" => $docElementId)); while ($arBarCode = $dbBarCodes->GetNext()) { $product["BARCODE"][] = $arBarCode["BARCODE"]; } } $storeFromName = CCatalogStoreControlUtil::getStoreName($product["STORE_FROM"]); $storeToName = CCatalogStoreControlUtil::getStoreName($product["STORE_TO"]); ?> <script type="text/javascript"> var arBarCodes = new Array(); <?php