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

  • 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 ShippingSiteConfig extends SiteConfigDecorator {
10         
11     function extraStatics() {
12         return array(
13             'db' => array(
14                 'AllowedCountries' => 'Text',
15             ),
16         );
17     }
18     
19     function populateDefaults() {
20         $this->owner->AllowedCountries = Geoip::visitor_country();
21     }
22     
23     function updateCMSFields($fields) {
24         $tab = WebylonSiteConfig::get_config_tab($fields, 'Shipping');
25         $tab->push(new CheckboxSetField('AllowedCountries', $this->owner->fieldLabel('AllowedCountries'), Geoip::getCountryDropDown()));
26     }
27     
28     /**
29      * Get list of allowed countries
30      * @param boolean $prefixisocode - prefix the country code
31      * @return array
32      */
33     function getCountriesList($prefixisocode = false) {
34         $countries = Geoip::getCountryDropDown();       
35         if ($allowed = $this->owner->AllowedCountries) {            
36             $allowed = explode(",",$allowed);
37             if (count($allowed > 0))
38                 $countries = array_intersect_key($countries, array_flip($allowed));
39         }
40 
41         if ($prefixisocode) {
42             foreach ($countries as $key => $value) {
43                 $countries[$key] = "$key - $value";
44             }
45         }
46         return $countries;
47     }
48 }
[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