Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
catalogstore.php
1<?php
8
9class CatalogStore extends Base
10{
14 public function __construct($id)
15 {
16 parent::__construct($id);
17 $this->fieldMap = array(
18 "name" => "TITLE",
19 //not accessible from template engine
20 "ID" => "ID",
21 );
22 }
23
31 public function resolve($entity)
32 {
33 if (intval($entity) > 0)
34 {
35 if (\Bitrix\Main\Loader::includeModule('catalog'))
36 return new CatalogStore(intval($entity));
37 }
38 return parent::resolve($entity);
39 }
40
48 public function setFields(array $fields)
49 {
50 parent::setFields($fields);
51 if (
52 is_array($this->fields)
53 //&& $this->fields["MEASURE"] > 0
54 )
55 {
56 //$this->fields["MEASURE"] = new ElementCatalogMeasure($this->fields["MEASURE"]);
57 //TODO
58 }
59 }
60
67 protected function loadFromDatabase()
68 {
69 if (!isset($this->fields) && ($this->id > 0))
70 {
71 $storeList = \CCatalogStore::getList(array(), array(
72 "ID" => $this->id,
73 ), false, false, array("ID", "TITLE"));
74 $this->fields = $storeList->fetch();
75 }
76 return is_array($this->fields);
77 }
78}