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  * Сопутствующие рубрики к рубрике
 4  *
 5  * @author menedem
 6  */
 7 class CatalogCatalogLinkedDecorator extends DataObjectDecorator {
 8     static function add_extension() {
 9         Object::add_extension('Product', 'ProductCatalogCatalogLinkedDecorator');
10         Object::add_extension('Catalog', 'CatalogCatalogLinkedDecorator');
11     }
12 
13     function extraStatics() {
14         return array(
15             'many_many' => array(
16                 'LinkedCatalogs' => 'Catalog',
17             )
18         );
19     }
20     
21     function updateCMSFields(FieldSet &$fields) {
22         if ($this->owner->ClassName == 'Catalog') {
23             $m = new ManyManyComplexTableField(
24                 $this->owner,
25                 'LinkedCatalogs',
26                 'Catalog',
27                 array('Title' => 'Каталог'),
28                 null,
29                 '"ClassName" = \'Catalog\' AND "SiteTree"."ID" <> ' . $this->owner->ID
30             );
31             $m->setPermissions(array());
32             $m->setPageSize(300);
33             $fields->findOrMakeTab('Root.Content.LinkedCatalogs', 'Связанные рубрики');
34             $fields->addFieldToTab("Root.Content.LinkedCatalogs", $m);
35         }
36     }
37 }
38 
39 class ProductCatalogCatalogLinkedDecorator  extends DataObjectDecorator {
40 
41     function extraStatics() {}
42     
43     static $showProductCount = 10;
44     
45     static function setShowProductCount($value) {
46         self::$showProductCount = $value;
47     }
48     
49     static function getShowProductCount() {
50         return self::$showProductCount;
51     }
52     
53     /**
54      * Получение связнанных(с текущим продуктом) продуктов
55      *
56      * @return DataObjectSet
57      */
58     function LinkedProducts() {
59         $rs = false;
60         if (($rubrics = $this->owner->Parent()->LinkedCatalogs()) && $rubrics->Count()) {
61             $IDs = array();
62             foreach($rubrics as $rubric) {
63                 $IDs[] = $rubric->ID;
64                 $descendantIDs = $rubric->getDescendantIDList();
65                 $IDs = array_merge($IDs, $descendantIDs);
66             }
67             $IDs = array_unique($IDs);
68             // !! TODO возможно добавить точку расширения для where, чтоб на конкретном сайте можно изменить условия подбора связанных товаров
69             $rs = Dataobject::get('Product', "ParentID IN (".implode(',', $IDs).")", 'RAND()', "", self::$showProductCount);
70         }
71         return $rs;
72     }
73 }
[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