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

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • 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

  • AddressBookProfilePageExtension
  • ContactFormAddressExtension
  • CostTableShippingMethod
  • FixedShippingMethod
  • ProductShippingDecorator
  • RegionRestriction
  • RestrictionRegionCountryDropdownField
  • ShippingMemberDecorator
  • ShippingMethod
  • ShippingMethodAdmin
  • ShippingOrderDecorator
  • ShippingSiteConfig
  • TableShippingMethod
  • WeightTableShippingMethod
 1 <?php
 2 
 3 /**
 4  * Способ оплаты на основе цены посылки
 5  *
 6  * @package cart_shipping
 7  * @author menedem
 8  */
 9 class CostTableShippingMethod extends TableShippingMethod {
10 
11     static $has_many = array(
12         "Rates" => "CostTableShippingRate"
13     );
14     
15     function getConstraints() {
16         return array('Cost');
17     }
18     
19     function getCMSFields(){
20         $fields = parent::getCMSFields();
21         
22         $rate = new CostTableShippingRate();
23         $fieldList = array(
24             "Country" => $rate->fieldLabel('Country'),
25             "State" => $rate->fieldLabel('State'),
26             "City" => $rate->fieldLabel('City'),
27             "PostalCode" => $rate->fieldLabel('PostalCode'),
28             "CostMin" => $rate->fieldLabel('CostMin'),
29             "CostMax" => $rate->fieldLabel('CostMax'),
30             "Rate" => $rate->fieldLabel('Rate'),
31         );
32         
33         $fieldTypes = array_merge(RegionRestriction::get_table_field_types(),array(
34             "CostMin" => "TextField",
35             "CostMax" => "TextField",
36             "Rate" => "TextField"
37         ));
38         
39         $fields->fieldByName('Root')->removeByName("Rates");
40         if ($this->isInDB()) {
41             $tablefield = new TableField("Rates", "CostTableShippingRate", $fieldList, $fieldTypes);
42             $tablefield->setCustomSourceItems($this->Rates());
43             $fields->addFieldToTab("Root.Main", $tablefield);
44         }
45         return $fields;
46     }   
47 }
48 
49 /**
50  * Adds extra metric ranges to restrict with, rather than just region.
51  */
52 class CostTableShippingRate extends TableShippingRate{
53     
54     static $db = array(
55         "CostMin" => "Decimal(8,2)",
56         "CostMax" => "Decimal(8,2)",
57     );
58     
59     static $has_one = array(
60         "ShippingMethod" => "CostTableShippingMethod"
61     );  
62     
63     static $summary_fields = array(
64         'Country',
65         'State',
66         'City',
67         'PostalCode',
68         'CostMin',
69         'CostMax',
70         'Rate'
71     );
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.1 API Docs API documentation generated by ApiGen 2.8.0