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 OrderServiceOrder extends ServiceOrder {
  4     static $db = array(     
  5         'AdditionalFieldData' => 'Varchar(255)', // Содержимое дополнительного пол¤ услуги заказа (если есть) - напр. у трансфера номер поезда и время прибытия
  6     );  
  7     
  8     static $has_one = array(
  9         'OrderService' => 'OrderService', // услуга
 10         'Order' => 'BookingOrder', // заказ
 11     );
 12     
 13     static $summary_fields = array('Title', 'AdditionalField',  'OrderServicePrice');
 14     
 15     function fieldLabels($includerelations = true) {
 16         $labels = parent::fieldLabels($includerelations);
 17         $labels['Title'] = _t('OrderServiceOrder.Title', 'Title');
 18         $labels['AdditionalField'] = _t('OrderServiceOrder.AdditionalField', 'Additional Field');
 19         $labels['OrderServicePrice'] = _t('OrderServiceOrder.OrderServicePrice', 'Order Service Price');
 20         return $labels;
 21     }
 22     
 23     function onBeforeWrite() {
 24         parent::onBeforeWrite();
 25         
 26         if ($this->OrderServiceID && $this->OrderService()) {
 27             if (!$this->ServiceTitle) {
 28                 $this->ServiceTitle = $this->OrderService()->Title;
 29             }
 30             if (!$this->ServicePrice) {
 31                 $this->ServicePrice = $this->OrderService()->Price;
 32             }
 33         }
 34     }
 35     
 36         
 37     function onAfterWrite() {
 38         parent::onAfterWrite();     
 39         $order = $this->Order();
 40         $order->calculateOrderCost();
 41         $order->write();        
 42     }
 43     
 44     function onAfterDelete() {              
 45         $order = $this->Order();
 46         $order->calculateOrderCost();
 47         $order->write();        
 48         parent::onAfterDelete();
 49     }
 50     
 51     function OrderServicePrice() {
 52         $cost = 0;
 53         if ($this->ServicePrice) {
 54             $cost = $this->Count * $this->ServicePrice;
 55         } else {
 56             $cost = $this->Count * $this->OrderService()->Price;
 57         }
 58         if ($this->OrderService()->Repeat == 'every_day') {
 59             $cost *= $this->Order()->OrderLength();
 60         }
 61         return $cost;       
 62     }
 63     
 64     function getTitle() {
 65         if ($this->ServiceTitle) {
 66             return $this->ServiceTitle;
 67         }
 68         return $this->OrderService()->Title;
 69     }
 70     
 71     // ????? Количество - по идее мы создаем экземпляр на каждую заказываемую услугу - поэтому количество всегда равно ЕДИНИЦЕ ?????
 72     /*
 73     function getCount() {
 74         return 1;
 75     }
 76     */
 77     
 78     function AdditionalField() {
 79         if ($this->OrderService()->HasAdditionalField) {
 80             return $this->OrderService()->AdditionalFieldTitle . ': ' . $this->AdditionalFieldData;
 81         }
 82     }
 83     
 84     function getCMSFields() {
 85         $fields = parent::getCMSFields();       
 86         if ($this->OrderService()->HasAdditionalField) {
 87             $fields->replaceField('Count', new HiddenField('Count', 'Count', 1)); // количество всегда равно единице - не показываем поле
 88         }                   
 89         if ($this->OrderService()->HasAdditionalField) {
 90             $fields->dataFieldByName('AdditionalFieldData')->setTitle($this->OrderService()->AdditionalFieldTitle);
 91         } else {
 92             $fields->removeByName('AdditionalFieldData');
 93         }
 94         
 95         $rs = array();
 96         if (OrderService::get_active()) {
 97             $rs = OrderService::get_active()->map();
 98         }
 99         $f = new DropdownField('OrderServiceID', $this->fieldLabel('OrderService'), $rs);
100         $f->setEmptyString('');
101         $fields->replaceField('OrderServiceID', $f);
102         
103         
104         if ($this->OrderServiceID) {
105             $fields->replaceField('OrderServiceID', $fields->dataFieldByName('OrderServiceID')->performReadonlyTransformation());
106         }
107         return $fields;
108     }
109     
110     
111 
112 }
[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