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

  • Announcement_Controller
  • AnnouncementHolder_Controller
  • BookingAdminPage_Controller
  • BookingPage_Controller
  • Cart_Controller
  • CartPage_Controller
  • Catalog_Controller
  • CheckoutPage_Controller
  • ChequePayment_Handler
  • ContactsPage_Controller
  • ContentController
  • ContentNegotiator
  • Controller
  • DataObjectManager_Controller
  • DatePickerField_Controller
  • Director
  • DocPage_Controller
  • DocumentsPage_Controller
  • Event_Controller
  • EventHolder_Controller
  • FavoritePage_Controller
  • FileDataObjectManager_Controller
  • FindCyrillic_Controller
  • HomePage_Controller
  • Import1C_Controller
  • ImportCatalog1C_Controller
  • LastDoc_Controller
  • LiveCalendarWidget_Controller
  • MapObject_Controller
  • MapObjectGroup_Controller
  • MapPage_Controller
  • MediawebPage_Controller
  • ModelAsController
  • Monument_Controller
  • MonumentCatalog_Controller
  • MonumentForm_Controller
  • MultiUploadControls
  • NewsArchive_Controller
  • NewsEntry_Controller
  • NewsHolder_Controller
  • Orders1CExchange_Controller
  • Page_Controller
  • Payment_Handler
  • PhotoAlbumManager_Controller
  • Product_Controller
  • ProductSearchPage_Controller
  • ProfilePage_Controller
  • PublHolder_Controller
  • Publication_Controller
  • RatingExtension_Controller
  • RegistrationPage_Controller
  • RemoveOrphanedPagesTask
  • RequestHandler
  • Room_Controller
  • RoomCatalog_Controller
  • RootURLController
  • SapphireInfo
  • Search_Controller
  • Session
  • SimpleOrderPage_Controller
  • SiteMap_Controller
  • Socle_Controller
  • SocleSize_Controller
  • SpecialCatalog_Controller
  • SS_HTTPRequest
  • SS_HTTPResponse
  • StartCatalog_Controller
  • SubsitesSelectorPage_Controller
  • VideoBankPage_Controller

Interfaces

  • NestedController

Exceptions

  • SS_HTTPResponse_Exception
 1 <?php
 2 
 3 /**
 4  * Специальные разделы каталога.
 5  * Используется для анонсов товаров, а так же являются частью системы скидок.
 6  *
 7  * @package cart
 8  * @author inxo, dvp
 9  */
10 class SpecialCatalog extends Catalog {
11 
12     static $icon = 'catalog/images/special';
13     static $allowed_children = 'none';
14 
15     static $db = array(
16         'Discount' => 'Int', // Размер скидки
17     );
18 
19     static $defaults = array(
20         'AutoChild' => 0,
21         'Discount' => 0, // 0% скидки
22         'ShowInSearch' => 0,
23         'ShowInSiteMap' => 0,
24     );
25 
26     static $many_many = array(
27         'LinkedProducts' => 'Product',
28     );
29 
30     function getCMSFields() {
31         $fields = parent::getCMSFields();
32 
33         $fields->removeByName('Copy');
34         $fields->removeByName('Subpages');
35         $fields->removeByName('Virtual');
36 
37         if (class_exists('Cart'))
38             $fields->addFieldToTab('Root.Content.Main', new NumericField('Discount', $this->fieldLabel('Discount')), 'Description');
39 
40         $products = new ManyManyDataObjectManager(
41                         $this,
42                         'LinkedProducts',
43                         'Product',
44                         array('Title'=>'Title', 'RealPrice'=>'Price', 'Vendor'=>'Vendor', 'ProductAdminLink' => 'Ссылка')
45         );
46         $products->setOnlyRelated(true);
47         $products->setPermissions(array('delete'));
48         $products->setPluralTitle(_t('SpecialCatalog.Products', 'Product list'));
49 
50         $fields->addFieldToTab('Root.Content.tabSubPages', $products);
51 
52         return $fields;
53     }
54 
55     /**
56      * Возвращает список порубрик
57      * Для спецкаталога всегда false
58      *
59      * @return DataObjectset|bool
60      */
61     public function Subcats() {
62         return false;
63     }
64 
65     public function CountItems() {
66         return $this->LinkedProducts()->Count();
67     }
68 
69     public function Widget($id, $count=1) {
70         // ??? move to extension
71         if (!$special = DataObject::get_by_id('SpecialCatalog', $id))
72             return false;
73 
74         return $special->LinkedProducts(null, 'RAND()', null, $count);
75     }
76     
77     function getProductsListQuery($orderby, $limit) {
78         $query = $this->getManyManyComponentsQuery('LinkedProducts', "", $orderby, "", $limit);
79         return $query;
80     }
81 }
82 
83 class SpecialCatalog_Controller extends Catalog_Controller {
84 }
85 
[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