Webylon 3.2 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • 1c
    • exchange
      • catalog
  • auth
  • Booking
  • building
    • company
  • cart
    • shipping
    • steppedcheckout
  • Catalog
    • monument
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • AdditionalMenuWidget_Item
  • AdvancedSliderHomepageWidget_Item
  • AssetManagerFolder
  • BannerWidget_Item
  • BaseObjectDecorator
  • BookingOrder
  • BookingPaymentMethod
  • BookingService
  • Boolean
  • ButtonsBlockHomepageWidget_Item
  • CarouselHomepageWidget_Item
  • CatalogFilter
  • CatalogRubricsHomepageWidget_CatalogDecorator
  • ClientEmailOrderNotification
  • ClientVKOrderNotification
  • ComponentSet
  • Currency
  • DatabaseAdmin
  • DataObject
  • DataObjectDecorator
  • DataObjectLog
  • DataObjectSet
  • DataObjectSet_Iterator
  • Date
  • DB
  • DBField
  • Decimal
  • DocumentItem
  • DocumentPage_File
  • Double
  • Enum
  • ErrorPageSubsite
  • FileDataObjectTrackingDecorator
  • FileImportDecorator
  • Float
  • FlowerGarden_Size
  • ForeignKey
  • Hierarchy
  • HouseCatalogProductDecorator
  • HTMLText
  • HTMLVarchar
  • Import1CLog
  • Import1CLog_File
  • Import1CLog_Item
  • Import1CLog_Task
  • ImportCatalog1C_PriceType
  • ImportCatalog1C_ProductProp
  • Int
  • ManagerEmailOrderNotification
  • Material3D_File
  • MediawebPage_File
  • MediawebPage_Photo
  • MobileContentDecorator
  • Money
  • MonumentGalleryItem
  • MonumentPhotoGallery
  • MultiEnum
  • MySQLDatabase
  • MySQLQuery
  • Notification
  • OrderDataObject
  • OrderDecorator
  • OrderHandlersDecorator
  • OrderItemDecorator
  • OrderItemVariationDecorator
  • Orders1CExchange_OrdersDecorator
  • OrderService
  • OrderServiceOrder
  • PageIcon
  • PageWidgets
  • Payment
  • PaymentMethodShippingDecorator
  • PaymentOrderExtension
  • Percentage
  • Person
  • PhotoAlbumItem
  • PhotoAlbumProductLinkDecorator
  • PhotoAlbumWidgetLinkDecorator
  • PhotoGalleryHomepageWidget_Item
  • PortraitType
  • PrimaryKey
  • Product3DDecorator
  • ProductCatalogCatalogLinkedDecorator
  • ProductImportLog
  • ProductImportLog_Item
  • ProductParam
  • ProductParamValue
  • ProductVariation
  • RatePeriod
  • RealtyImportLog
  • RealtyImportLog_Item
  • RedirectEntry
  • RoomOrder
  • RoomOrderPerson
  • RoomRate
  • RoomService
  • RoomServiceOrder
  • SberbankPaymentDecorator
  • SeoOpenGraphPageDecorator
  • ServiceOrder
  • ShippingMethodPaymentDecorator
  • ShopCountry
  • SimpleOrderCatalogDecorator
  • SimpleOrderProductDecorator
  • SiteConfigWidgets
  • SiteTreeDecorator
  • SiteTreeImportDecorator
  • SliderHomepageWidget_Item
  • SMSCOrderNotification
  • SMSOrderNotification
  • SortableDataObject
  • SQLMap
  • SQLMap_Iterator
  • SQLQuery
  • SS_Database
  • SS_Datetime
  • SS_Query
  • StringField
  • SubsiteDomain
  • Text
  • TextAnonsWidget_Item
  • Texture3D_File
  • Time
  • Varchar
  • Versioned
  • Versioned_Version
  • VideoCategory
  • VideoEntry
  • VKNotificationQueue
  • WebylonWidget_Item
  • YaMoneyPaymentDecorator
  • Year

Interfaces

  • CompositeDBField
  • CurrentPageIdentifier
  • DataObjectInterface
  1 <?php
  2 // Параметр категории - определение параметров товара в этой категории
  3 class CatalogFilter extends DataObject {
  4     static $db = array(
  5         'Title' => 'Varchar(250)',
  6         'TechTitle' => 'Varchar(50)',
  7         'FilterField' => 'Varchar(50)',     
  8         'Important' => 'Boolean',       
  9         'Type' => "Enum('text, bool, boolgroup, slider, list, multiselect')",
 10         'Sort' => 'Int', //Сортировка в фильтре, если не указана берется максимальная + 1     
 11         'GroupTitle' => 'Varchar(50)',      
 12         'ShowDefault' => 'Boolean',     
 13         'DefaultValue' => 'Varchar(255)',
 14         'Unit' => 'Varchar', // единица измерения
 15     );
 16     static $has_one = array(
 17         'ParentCatalog' => 'Catalog'
 18     );
 19     
 20     static $belongs_many_many = array(
 21         'Catalogs' => 'Catalog'
 22     );
 23     
 24     static $defaults = array(
 25         'FilterField' => '',
 26         'Type' => 'text',
 27     );
 28     
 29     function fieldLabels($relations = true) {       
 30         $labels = parent::fieldLabels($relations);
 31         $labels['LocalType'] = $labels['Type'];     
 32         $labels['LocalFilterField'] = $labels['FilterField'];       
 33         return $labels;
 34     }
 35     
 36     
 37     static $default_sort = 'Important DESC, Sort ASC, Title ASC';
 38     
 39     static $searchable_fields = array('Title', 'FilterField', 'Important', 'Type', 'Sort');
 40     
 41     static $summary_fields = array('Title', 'LocalFilterField', 'Important', 'LocalType', 'Sort');
 42     
 43     static function getFilterTypes() {
 44         $types = array();
 45         foreach(singleton('CatalogFilter')->dbObject('Type')->enumValues() as $val) {
 46             $types[$val] = _t('CatalogFilter.Type_' . $val);
 47         }
 48         return $types;      
 49     }
 50     
 51     function getLocalType() {
 52         $types = self::getFilterTypes();
 53         return $types[$this->Type];
 54     }
 55     
 56     function getLocalFilterField() {
 57         $fields = $this->getPossibleFilterFields();
 58         if (isset($fields[$this->FilterField])) {
 59             return $fields[$this->FilterField];
 60         }
 61         return $this->FilterField;
 62     }
 63     
 64     function populateDefaults() {
 65         parent::populateDefaults();
 66         $this->TechTitle = 'filter' . (DB::query("select max(ID) from CatalogFilter")->value() + 1);
 67         $this->Sort = $max = DB::query("select max(Sort) from CatalogFilter")->value() + 1;
 68     }
 69         
 70     function getCMSFields() {
 71         $fields = parent::getCMSFields();
 72         $fields->replaceField('Type', new DropdownField('Type', $this->fieldLabel('Type'), self::getFilterTypes(), $this->Type));
 73         $fields->replaceField('ParentCatalogID', new HiddenField('ParentCatalogID', $this->fieldLabel('ParentCatalog')));
 74         $fields->removeByName('Catalogs');
 75         //debug::show(DataObject::database_fields('Product'));
 76         
 77         $ffTitle = $this->fieldLabel('FilterField');
 78         if (!$this->ID) {
 79             $ffTitle .= _t('CatalogFilter.NeedSaveToViewAll');
 80         }
 81         $fields->replaceField('FilterField', new DropdownField('FilterField', $ffTitle, $this->getPossibleFilterFields(), $this->FilterField));
 82         return $fields;
 83     }   
 84     
 85     function getPossibleFilterFields() {
 86         $filterFields = Product::get_possible_filter_fields();
 87         if ($this->ParentCatalogID && $this->ParentCatalog()) {
 88             if ($catalogParams = $this->ParentCatalog()->catalogParams()) {
 89                 foreach($catalogParams as $catalogParam) {
 90                     $filterFields[$catalogParam->TechTitle] = $catalogParam->Title;
 91                 }
 92             }           
 93         } else {
 94             //debug::show(DataObject::get('ProductParam', "ParentCatalogID = 0 AND ShowDefault = 1"));
 95             if ($catalogParams = DataObject::get('ProductParam', "ParentCatalogID = 0")) {
 96                 foreach($catalogParams as $catalogParam) {
 97                     $filterFields[$catalogParam->TechTitle] = $catalogParam->Title;
 98                 }
 99             }
100         }
101         return $filterFields;
102     }
103 }
[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. -
Webylon 3.2 API Docs API documentation generated by ApiGen 2.8.0