OrderPropsValue.class.php
1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?
namespace Cpeople\Classes\Sale;
class OrderPropsValue
{
private $data = array();
public static function getOrderPropsValue($orderId, $fetchByCode = true)
{
static $result = array();
$hash = $orderId . '_' . $fetchByCode;
if($result[$hash] === null)
{
$result[$hash] = array();
$rs = \CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $orderId), false, false, array('NAME', 'VALUE', 'CODE'));
while($ar = $rs->GetNext(true, false))
{
$obj = new OrderPropsValue($ar);
if($fetchByCode)
{
$result[$hash][$ar['CODE']] = $obj;
}
else
{
$result[$hash][] = $obj;
}
}
}
return $result[$hash];
}
public function __construct($data)
{
$this->data = $data;
}
public function getName()
{
return $this->data['NAME'];
}
public function getValue()
{
return $this->data['VALUE'];
}
}