1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
elementskuprice.php
См. документацию.
1<?php
7namespace Bitrix\Iblock\Template\Entity;
8
9class ElementSkuPrice extends Base
10{
11 protected $ids = null;
12
16 protected static function getInstance($id)
17 {
18 $key = implode(',', $id);
19 $class = get_called_class();
20 if (!isset(static::$instance[$class]))
21 {
22 static::$instance[$class] = [];
23 }
24 if (!isset(static::$instance[$class][$key]))
25 {
26 static::$instance[$class][$key] = new static($id);
27 }
28 return static::$instance[$class][$key];
29 }
30
34 public function __construct($ids)
35 {
36 parent::__construct(0);
37 $this->ids = $ids;
38 }
39
47 public function setFields(array $fields)
48 {
49 parent::setFields($fields);
50 if (
51 is_array($this->fields)
52 //&& $this->fields["MEASURE"] > 0
53 )
54 {
55 //$this->fields["MEASURE"] = new ElementCatalogMeasure($this->fields["MEASURE"]);
56 //TODO
57 }
58 }
59
66 protected function loadFromDatabase()
67 {
68 if (!isset($this->fields) && is_array($this->ids))
69 {
70 $this->fields = array();
71 $pricesList =\CPrice::getListEx(array(), array(
72 "=PRODUCT_ID" => $this->ids,
73 "+<=QUANTITY_FROM" => 1,
74 "+>=QUANTITY_TO" => 1,
75 ), false, false, array("PRICE", "CURRENCY", "CATALOG_GROUP_ID", "CATALOG_GROUP_CODE"));
76 $this->fields = array();
77 while ($priceInfo = $pricesList->fetch())
78 {
79 $priceId = $priceInfo["CATALOG_GROUP_ID"];
80 $price = \CCurrencyLang::currencyFormat($priceInfo["PRICE"], $priceInfo["CURRENCY"], true);
81 $this->fields[$priceId][] = $price;
82 $this->addField($priceId, $priceId, $price);
83 $this->addField($priceInfo["CATALOG_GROUP_CODE"], $priceId, $price);
84 }
85 }
86 return is_array($this->fields);
87 }
88}
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
if(empty($signedUserToken)) $key
Определения quickway.php:257
$fields
Определения yandex_run.php:501