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

  • Address
  • AddSubsiteTask
  • Announcement
  • AnnouncementDecorator
  • AnnouncementHolder
  • AssociatedFolderDecorator
  • AttachedFiles
  • AudioPhpCaptcha
  • AutoCompleteField
  • Base1CExchanger
  • BookingOrder_StatusLog
  • CalendarUtil
  • CalendarWidgetExtention
  • CatalogCatalogLinkedDecorator
  • CatalogOldFieldsDecorator
  • CatalogProductLinkedDecorator
  • CheckoutStep_ShippingMethod
  • ChequePayment
  • ClearHistoryTask
  • ClientEmailOrderNotification_SiteConfig
  • ClientVKOrderNotification_SiteConfig
  • CommentsSiteConfig
  • ContactsPage
  • CookieExtention
  • CostTableShippingRate
  • CustomMenu
  • CustomMenuAdmin
  • CustomMenuDecorator
  • CustomMenuHolder
  • CustomMenuItem
  • CustomPayment
  • DataObjectLoggerExtension
  • DataObjectSubsites
  • DefaultCMSActionDecorator
  • DocPage
  • DocumentDirection
  • DocumentHaving
  • DocumentSearchForm
  • DocumentSiteConfig
  • DocumentsPage
  • DocumentType
  • DOMUtil
  • ExtendPageAnnouncement
  • ExtendPagePoll
  • FavoriteExtention
  • FavoritePage
  • FavoriteProductMemberExtention
  • FavoriteProducts
  • FileOversizeDecorator
  • FindCyrillicSiteConfig
  • FolderRenameTask
  • GDMergeAlpha
  • HomePage
  • ImageAutoResize
  • ImageResizeTask
  • ImportCatalog1C_Importer
  • ImportCatalogSiteConfig
  • ImportSiteConfig
  • LoggerAdmin
  • LogItem
  • ManagerEmailOrderNotification_SiteConfig
  • MapObject
  • MapObjectGroup
  • MapPage
  • MediawebForm
  • MemberLoggerExtension
  • MonumentsSiteConfig
  • MultiUploadConfig
  • NearestEventExtention
  • NewDocumentsAdmin
  • NewsArchive
  • NewsEntry
  • NewsHolder
  • NewsSiteConfig
  • Order_StatusLog
  • Orders1CExchange_Exporter
  • PageHideFieldsExtension
  • PageInformerRates
  • PageInformerWeather
  • Payment_Failure
  • Payment_Processing
  • Payment_Result
  • Payment_Success
  • PaymentMethod
  • PaymentSiteConfig
  • PayPalPayment
  • PayPalPayment_Handler
  • PhoneField
  • PhotoAlbumExtentions
  • PhpCaptcha
  • PhpCaptchaColour
  • PhpCaptchaField
  • phpMorphy
  • phpMorphy_AncodesResolver_AsIs
  • phpMorphy_AncodesResolver_Proxy
  • phpMorphy_AncodesResolver_ToDialingAncodes
  • phpMorphy_AncodesResolver_ToText
  • phpMorphy_AnnotDecoder_Base
  • phpMorphy_AnnotDecoder_Common
  • phpMorphy_AnnotDecoder_Factory
  • phpMorphy_AnnotDecoder_Predict
  • phpMorphy_FilesBundle
  • phpMorphy_Fsa
  • phpMorphy_Fsa_Decorator
  • phpMorphy_Fsa_Proxy
  • phpMorphy_Fsa_Sparse_File
  • phpMorphy_Fsa_Sparse_Mem
  • phpMorphy_Fsa_Sparse_Shm
  • phpMorphy_Fsa_Tree_File
  • phpMorphy_Fsa_Tree_Mem
  • phpMorphy_Fsa_Tree_Shm
  • phpMorphy_Fsa_WordsCollector
  • phpMorphy_GramInfo
  • phpMorphy_GramInfo_AncodeCache
  • phpMorphy_GramInfo_Decorator
  • phpMorphy_Graminfo_File
  • phpMorphy_Graminfo_Mem
  • phpMorphy_GramInfo_Proxy
  • phpMorphy_GramInfo_Proxy_WithHeader
  • phpMorphy_GramInfo_RuntimeCaching
  • phpMorphy_Graminfo_Shm
  • phpMorphy_GrammemsProvider_Base
  • phpMorphy_GrammemsProvider_Decorator
  • phpMorphy_GrammemsProvider_Empty
  • phpMorphy_GrammemsProvider_Factory
  • phpMorphy_GrammemsProvider_ForFactory
  • phpMorphy_GrammemsProvider_ru_RU
  • phpMorphy_GramTab
  • phpMorphy_GramTab_Empty
  • phpMorphy_GramTab_Proxy
  • phpMorphy_Link
  • phpMorphy_Link_Annot
  • phpMorphy_Link_Base
  • phpMorphy_Morphier_Base
  • phpMorphy_Morphier_Bulk
  • phpMorphy_Morphier_Common
  • phpMorphy_Morphier_Empty
  • phpMorphy_Morphier_Finder_Base
  • phpMorphy_Morphier_Finder_Common
  • phpMorphy_Morphier_Finder_Predict_Databse
  • phpMorphy_Morphier_Finder_Predict_Suffix
  • phpMorphy_Morphier_Helper
  • phpMorphy_Morphier_Predict_Database
  • phpMorphy_Morphier_Predict_Suffix
  • phpMorphy_Morphier_PredictCollector
  • phpMorphy_Semaphore
  • phpMorphy_Semaphore_Empty
  • phpMorphy_Semaphore_Nix
  • phpMorphy_Semaphore_Win
  • phpMorphy_Shm_Cache
  • phpMorphy_Shm_Cache_FileDescriptor
  • phpMorphy_Shm_Header
  • phpMorphy_Source_Dba
  • phpMorphy_Source_Fsa
  • phpMorphy_State
  • phpMorphy_Storage
  • phpMorphy_Storage_Factory
  • phpMorphy_Storage_File
  • phpMorphy_Storage_Mem
  • phpMorphy_Storage_Proxy
  • phpMorphy_Storage_Shm
  • phpMorphy_UnicodeHelper
  • phpMorphy_UnicodeHelper_Base
  • phpMorphy_UnicodeHelper_MultiByteFixed
  • phpMorphy_UnicodeHelper_singlebyte
  • phpMorphy_UnicodeHelper_ucs_2be
  • phpMorphy_UnicodeHelper_ucs_2le
  • phpMorphy_UnicodeHelper_ucs_4be
  • phpMorphy_UnicodeHelper_ucs_4le
  • phpMorphy_UnicodeHelper_utf_16_Base
  • phpMorphy_UnicodeHelper_utf_16be
  • phpMorphy_UnicodeHelper_utf_16le
  • phpMorphy_UnicodeHelper_utf_32_Base
  • phpMorphy_UnicodeHelper_utf_32be
  • phpMorphy_UnicodeHelper_utf_32le
  • phpMorphy_UnicodeHelper_utf_8
  • phpMorphy_WordDescriptor
  • phpMorphy_WordDescriptor_Collection
  • phpMorphy_WordDescriptor_Collection_Serializer
  • phpMorphy_WordForm
  • ProductCatalogImportTask
  • ProductOldFieldsDecorator
  • ProductParamValue_BoolValueField
  • ProductParamValue_MultiValueField
  • ProductParamValue_MultiValueSetField
  • ProductParamValue_ValueField
  • ProductProductLinkedDecorator
  • PublHolder
  • Publication
  • PublicationSiteTree
  • RatingDataObject
  • RatingExtension
  • RealtySiteConfigDecorator
  • RecentComments
  • RecentFiles
  • RecentPages
  • RelatedPageLink
  • RoomRate_PriceField
  • RussianUpLower
  • SberbankPayment
  • SberbankPayment_Handler
  • SetMainSiteHomePageTypeTask
  • ShippingEstimator
  • ShippingPackage
  • ShowUserFromExtension
  • ShowViewedProductExtention
  • SiteConfigDecorator
  • SiteConfigSubsites
  • SiteTreeSubsites
  • SMSCOrderNotification_SiteConfig
  • SMSOrderNotification_SiteConfig
  • Socle
  • SocleSize
  • SortCMSActionDecorator
  • SS_Report_FakeQuery
  • SSMorphy
  • SSNController
  • SteppedCheckout_PageMessages
  • SubpageListField
  • SubscribeFormAllPagesExtension
  • SubsiteDropdownField
  • SubsiteReportWrapper
  • TableShippingRate
  • UnitellerPayment
  • UnitellerPayment_Handler
  • UnmoderatedComments
  • VAT
  • VideoManager
  • VideoSiteConfig
  • ViewedProductExtention
  • WatermarkImage
  • WatermarkSiteConfig
  • WeightTableShippingRate
  • XMLValidate
  • YaMoneyPayment
  • YaMoneyPayment_Handler
  • YMLExporter
  • YMLSiteConfig

Interfaces

  • PaymentObjectInterface
  • phpMorphy_AncodesResolver_Interface
  • phpMorphy_AnnotDecoder_Interface
  • phpMorphy_Fsa_Interface
  • phpMorphy_GramInfo_Interace
  • phpMorphy_GrammemsProvider_Interface
  • phpMorphy_GramTab_Interface
  • phpMorphy_Morphier_Finder_Interface
  • phpMorphy_Morphier_Interface
  • phpMorphy_Shm_Cache_Interface
  • phpMorphy_Source_Interface

Exceptions

  • phpMorphy_Exception

Functions

  • column_sort
  • column_sort_callback_basic
  • encodeFileForEmail
  • encodeMultipart
  • getMimeType
  • htmlEmail
  • loadMimeTypes
  • phpmorphy_overload_mb_funcs
  • plaintextEmail
  • processHeaders
  • QuotedPrintable_encode
  • supressOutput
  • validEmailAddr
  • wrapImagesInline
  • wrapImagesInline_rewriter
  1 <?php
  2 // Значение параметра категории (ProductParam) у конкретного товара
  3 class ProductParamValue extends DataObject {
  4     static $db = array(
  5         'Value' => 'Varchar(255)',
  6         'TechTitle' => 'Varchar(50)', // копия из ProductParam для упрощения запросов
  7     );
  8     
  9     static $has_one = array(
 10         'Product' => 'Product',
 11         'ProductParam' => 'ProductParam',
 12         'ProductVariation' => 'ProductVariation',
 13     );
 14 
 15     static $indexes = array(
 16         'TitleValue' => '(TechTitle,Value)',
 17         'ProductTitle' => '(ProductID,TechTitle)',
 18     );  
 19     
 20     function getCMSFields() {
 21         $fields = parent::getCMSFields();
 22         $fields->replaceField('ProductParamID', new HiddenField('ProductParamID', 'ProductParamID'));       
 23         if (!Catalog::$use_variations) {
 24             $fields->removeByName('ProductVariationID');
 25         }
 26         
 27         return $fields;
 28     }   
 29     
 30     function onBeforeWrite() {
 31         parent::onBeforeWrite();
 32         
 33         if ($this->ProductParamID && $this->ProductParam()) {
 34             $this->TechTitle = $this->ProductParam()->TechTitle;
 35             if ($this->ProductParam()->ParamForVariation && ($variation = $this->ProductVariation())) {
 36                 $this->ProductID = $variation->ProductID;
 37             }
 38         }
 39     }
 40     
 41     function ParamTitle() {
 42         return $this->ProductParam()->Title;
 43     }
 44     
 45 }
 46 
 47 /**
 48  * Поле для редактирования значения параметра
 49  *
 50  * @author dvp, menedem
 51  */
 52 class ProductParamValue_ValueField extends TextField {
 53 
 54     function __construct($name, $param, $productID, $relation="ProductID") {
 55         $name .= "_{$param->ID}_{$productID}_{$relation}";      
 56         $value = false;
 57         if ($v = DataObject::get_one('ProductParamValue', "ProductParamID = {$param->ID} AND {$relation} = {$productID}")) {
 58             $value = $v->Value;
 59         }
 60         parent::__construct($name, $param->Title, $value);
 61     }
 62 
 63     function saveInto(DataObject $record) {
 64        if (!preg_match('/(\w+)_(\d+)_(\d+)_(\w+)/', $this->name, $matches))
 65             user_error("ProductParamValue_ValueField::saveInto() $this->name has invalid format");
 66         
 67         $fieldName = $matches[1];
 68         $paramID = $matches[2];
 69         $productID = $matches[3];
 70         $relation = $matches[4];
 71 
 72         $saveDest = $record->$fieldName();
 73 
 74         if (!$saveDest)
 75             user_error("ProductParamValue_ValueField::saveInto() Field '$fieldName' not found on $record->class.$record->ID", E_USER_ERROR);
 76 
 77         $paramValue = DataObject::get_one('ProductParamValue', "ProductParamID = {$paramID} AND {$relation} = {$productID}");
 78         if (!$paramValue) {
 79             $paramValue = new ProductParamValue();
 80             $paramValue->ProductParamID = $paramID;
 81             $paramValue->{$relation} = $productID;          
 82             $paramValue->write();
 83         }
 84         $paramValue->Value = $this->value;
 85         $paramValue->write();
 86     }
 87 }
 88 
 89 /**
 90  * Поле для редактирования значения параметра
 91  *
 92  * @author dvp, menedem
 93  */
 94 class ProductParamValue_MultiValueField extends DropdownField {
 95 
 96     function __construct($name, $param, $productID, $relation="ProductID") {
 97         $name .= "_{$param->ID}_{$productID}_{$relation}";      
 98         $value = false;
 99         if ($v = DataObject::get_one('ProductParamValue', "ProductParamID = {$param->ID} AND {$relation} = {$productID}")) {
100             $value = $v->Value;
101         }
102         parent::__construct($name, $param->Title, $param->PossibleValuesList(), $value);
103     }
104 
105     function saveInto(DataObject $record) {
106         if (!preg_match('/(\w+)_(\d+)_(\d+)_(\w+)/', $this->name, $matches))
107             user_error("ProductParamValue_ValueField::saveInto() $this->name has invalid format");
108         
109         $fieldName = $matches[1];
110         $paramID = $matches[2];
111         $productID = $matches[3];
112         $relation = $matches[4];
113 
114         $saveDest = $record->$fieldName();
115 
116         if (!$saveDest)
117             user_error("ProductParamValue_ValueField::saveInto() Field '$fieldName' not found on $record->class.$record->ID", E_USER_ERROR);
118 
119         $paramValue = DataObject::get_one('ProductParamValue', "ProductParamID = {$paramID} AND {$relation} = {$productID}");
120         if (!$paramValue) {
121             $paramValue = new ProductParamValue();
122             $paramValue->ProductParamID = $paramID;
123             $paramValue->{$relation} = $productID;          
124             $paramValue->write();
125         }
126         $paramValue->Value = $this->value;
127         $paramValue->write();
128     }
129 }
130 
131 /**
132  * Поле для редактирования значения параметра
133  *
134  * @author dvp, menedem
135  */
136 class ProductParamValue_MultiValueSetField extends CheckboxSetField {
137 
138     function __construct($name, $param, $productID, $relation="ProductID") {
139         $name .= "_{$param->ID}_{$productID}_{$relation}";
140         $values = array();
141         if ($allParamValues = DataObject::get('ProductParamValue', "ProductParamID = {$param->ID} AND {$relation} = {$productID}")) {
142             $values = $allParamValues->map('Value', 'Value');
143         }
144         parent::__construct($name, $param->Title, $param->PossibleValuesList(), $values); //, $param->Value
145     }
146 
147     function saveInto(DataObject $record) {     
148         if (!preg_match('/(\w+)_(\d+)_(\d+)_(\w+)/', $this->name, $matches))
149             user_error("ProductParamValue_ValueField::saveInto() $this->name has invalid format");
150         
151         $fieldName = $matches[1];
152         $paramID = $matches[2];
153         $productID = $matches[3];
154         $relation = $matches[4];
155 
156         $saveDest = $record->$fieldName();
157         
158         if (!$saveDest)
159             user_error("ProductParamValue_ValueField::saveInto() Field '$fieldName' not found on $record->class.$record->ID", E_USER_ERROR);
160         
161         $allParamValues = DataObject::get('ProductParamValue', "ProductParamID = {$paramID} AND {$relation} = {$productID}");
162         $IDs = ($allParamValues) ? $allParamValues->map('ID', 'ID'): array();
163         foreach($this->value as $value) {
164             $paramValue = DataObject::get_one('ProductParamValue', "ProductParamID = {$paramID} AND {$relation} = {$productID} AND Value = '{$value}'");
165             if (!$paramValue) {
166                 $paramValue = new ProductParamValue();
167                 $paramValue->ProductParamID = $paramID;
168                 $paramValue->{$relation} = $productID;
169                 $paramValue->Value = $value;
170                 $paramValue->write();
171             } else {
172                 unset($IDs[$paramValue->ID]);
173             }
174         }
175         if (count($IDs)) {
176             foreach($IDs as $ID) {
177                 DataObject::delete_by_id('ProductParamValue', $ID);
178             }
179         }
180     }
181 }
182 
183 /**
184  * Поле для редактирования значения параметра
185  *
186  * @author dvp, menedem
187  */
188 class ProductParamValue_BoolValueField extends DropdownField {
189 
190     function __construct($name, $param, $productID, $relation="ProductID") {
191         $name .= "_{$param->ID}_{$productID}_{$relation}";      
192         $value = false;
193         if ($v = DataObject::get_one('ProductParamValue', "ProductParamID = {$param->ID} AND {$relation} = {$productID}")) {
194             $value = $v->Value;
195         }
196         $map = array(
197             0 => _t('Boolean.NO'),
198             1 => _t('Boolean.YES'),
199         );      
200         parent::__construct($name, $param->Title, $map, $value);
201     }
202 
203     function saveInto(DataObject $record) {
204          if (!preg_match('/(\w+)_(\d+)_(\d+)_(\w+)/', $this->name, $matches))
205             user_error("ProductParamValue_ValueField::saveInto() $this->name has invalid format");
206         
207         $fieldName = $matches[1];
208         $paramID = $matches[2];
209         $productID = $matches[3];
210         $relation = $matches[4];
211 
212         $saveDest = $record->$fieldName();
213 
214         if (!$saveDest)
215             user_error("ProductParamValue_ValueField::saveInto() Field '$fieldName' not found on $record->class.$record->ID", E_USER_ERROR);
216 
217         $paramValue = DataObject::get_one('ProductParamValue', "ProductParamID = {$paramID} AND {$relation} = {$productID}");
218         if (!$paramValue) {
219             $paramValue = new ProductParamValue();
220             $paramValue->ProductParamID = $paramID;
221             $paramValue->{$relation} = $productID;          
222             $paramValue->write();
223         }
224         $paramValue->Value = $this->value;
225         $paramValue->write();
226     }
227 }
[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