Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
storeinfo.php
1<?php
2
4
5
8
9abstract class StoreInfo
10{
11 private static array $storeNameList = [];
12
13 private int $storeId;
14
15 public function __construct(int $storeId)
16 {
17 $this->storeId = $storeId;
18 }
19
20 public function getStoreId(): int
21 {
22 return $this->storeId;
23 }
24
31 public function getStoreName(): string
32 {
33 if (!isset(self::$storeNameList[$this->storeId]))
34 {
35 self::loadStoreName($this->storeId);
36 }
37
38 return self::$storeNameList[$this->storeId];
39 }
40
49 public static function loadStoreName(int ...$storeIds): void
50 {
51 $storeNamesData = StoreTable::getList([
52 'select' => ['ID', 'TITLE'],
53 'filter' => ['=ID' => $storeIds],
54 ])->fetchAll();
55
56 foreach ($storeIds as $storeId)
57 {
58 if (!isset(self::$storeNameList[$storeId]))
59 {
60 self::setStoreName($storeId, Loc::getMessage('STORE_INFO_DEFAULT_STORE_NAME'));
61 }
62 }
63
64 foreach ($storeNamesData as $storeNameData)
65 {
66 if (!empty($storeNameData['TITLE']))
67 {
68 self::setStoreName($storeNameData['ID'], $storeNameData['TITLE']);
69 }
70 }
71 }
72
73 public static function setStoreName(int $storeId, string $storeName): void
74 {
75 self::$storeNameList[$storeId] = $storeName;
76 }
77
82 abstract public function getCalculatedSumPrice(): float;
83}
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29