Version: current

     1 <?php
     2 // Справочник Реквизитов товара
     3 class ImportCatalog1C_ProductProp extends DataObject {
     4     static $db = array(
     5         'Title' => 'Varchar(250)',
     6         'ProductField' => 'Varchar(250)', // в какое поле товара копируем значение этого Реквизита
     7     );
     8
     9     function getCMSFields() {
    10         $fields = parent::getCMSFields();
    11
    12         if ($productFields = singleton('Product')->db()) {
    13             $rs = array('' => 'не выбрано');
    14             foreach($productFields as $productField=>$type) {
    15                 $rs[$productField] = singleton('Product')->fieldLabel($productField);
    16             }
    17             $fields->replaceField('ProductField', new DropdownField('ProductField', $this->fieldLabel('ProductField'), $rs));
    18         }
    19
    20         return $fields;
    21     }
    22 }
    23
    24 class ImportCatalog1C_ProductProp_Admin extends ModelAdmin {
    25     static $url_segment = 'props';
    26     static $menu_title = 'Реквизиты';
    27     static $managed_models = 'ImportCatalog1C_ProductProp';
    28
    29 }

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -