Система управления «Сайт PRO»
Версия 20240107

Класс Price

Объект $Price: Cms\Root\Price наследует Cms\Site\Page

Объект «Позиция каталога»

Исходный код
class Price extends \Cms\Site\Page { … }

Методы

register()

$Price->register($Main);
Исходный код
    function register($Main) {
        return array(
            "table" => "catalog",
            "title" => "Позиция каталога",
            "create" => "Создать позицию каталога",
        );
    }

myPrice()

$Price->myPrice();
Исходный код
    function myPrice() {
        $Cart = $this->Main()->Cart();
        return $Cart->myPrice($this->id);
    }

getPrice()

$Price->getPrice();
Исходный код
    function getPrice() {
        $Cart = $this->Main()->Cart();
        return $Cart->getPrice($this->id);
    }

oldPrice()

$Price->oldPrice();
Исходный код
    function oldPrice() {
        $Cart = $this->Main()->Cart();
        return $Cart->oldPrice($this->id);
    }

displayPrice()

$Price->displayPrice($digit=0);
Исходный код
    function displayPrice($digit = 0) {
        $Main = $this->Main();
        return $Main->formatPrice($this->getPrice(), $digit);
    }

canBuy()

$Price->canBuy();
Исходный код
    function canBuy() {
        return $this->menu && $this->getPrice() > 0;
    }

getPanel()

$Price->getPanel();

Список элементов в панели администрирования

Возвращает: array Панель

Исходный код
    function getPanel() {
        if ($this->id)
        return array(
            "page" => array(
                "href" => "?a=page&p=" . urlencode($this->id),
                "title" => "Свойства позиции каталога",
                "image" => "edit",
                "can" => "page|edit",
            ),
            "move" => array(
                "href" => "?a=move&p=" . urlencode($this->id),
                "title" => "Переместить позицию каталога",
                "image" => "move",
                "can" => "move|edit",
            ),
            "delete" => array(
                "href" => "?a=delete&p=" . urlencode($this->id),
                "title" => "Удалить позицию каталога",
                "image" => "delete",
                "can" => "delete",
            ),
        );
    }