27 $variant = new \CSaleOrderPropsVariant();
34 if(!isset($fields[
'XML_ID']) && $fields[
'XML_ID'] ==
'')
36 $fields[
'XML_ID'] = OrderPropsTable::generateXmlId();
39 $variantId = $variant->Add($fields);
40 if ((
int)$variantId <= 0)
42 if ($ex = self::getApplication()->GetException())
44 $r->addError(
new Error($ex->GetString(), $ex->GetID()));
48 $r->addError(
new Error(
'variant add error', 201550000002));
55 foreach ($r->getErrors() as $error)
57 $this->addError(
new Error($error->getMessage(), 201550000003));
62 return [
'PROPERTY_VARIANT'=>$this->
get($variantId)];
67 $variant = new \CSaleOrderPropsVariant();
72 if(empty($fields) ==
false)
74 if(!$variant->Update($id, $fields))
76 if ($ex = self::getApplication()->GetException())
78 $r->addError(
new Error($ex->GetString(), $ex->GetID()));
82 $r->addError(
new Error(
'variant update error', 201550000004));
90 return [
'PROPERTY_VARIANT'=>$this->
get($id)];
94 $this->addErrors($r->getErrors());
141 public function listAction($select=[], $filter=[], $order=[], $start=0)
145 $orderPropsVariant = new \CSaleOrderPropsVariant();
147 $select = empty($select)? [
'*']:$select;
148 $order = empty($order)? [
'ID'=>
'ASC']:$order;
150 $r = $orderPropsVariant->GetList($order, $filter,
false, self::getNavData($start), $select);
151 while ($l = $r->fetch())
154 return new Page(
'PROPERTY_VARIANTS', $result,
function() use ($filter)
156 return (
int)\CSaleOrderPropsVariant::GetList([], $filter, []);