This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* @package FoxyStripe | |
* | |
*/ | |
class ProductCategory extends DataObject { | |
private static $db = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once( dirname(dirname(__FILE__)).'/thirdparty/simple_html_dom.php' ); | |
// Transforms the content area of the page | |
// Usage: | |
// $Content.Parse(ContentParser) | |
class ContentParser extends TextParser { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyCustomProduct extends ProductPage{ | |
/* ... */ | |
public function ProductOptionsForm() { | |
$form = $this->StartForm(); | |
$form .= $this->AddBaseProductDetails(); | |
$form .= $this>ProductOptionsSet(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class OrderDetailDataExtension extends DataExtension { | |
private static $db = array( | |
'MyCustomField' => 'Varchar(50)' | |
); | |
public function onAfterWrite(){ | |
parent::onBeforeWrite(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteCond %{HTTP_HOST} !newdomain.com$ [NC] | |
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getCMSFields(){ | |
$fields = parent::getCMSFields(); | |
$rootTab = $fields->fieldByName('Root'); | |
$this->extend('updateCMSFields', $fields); | |
$tabs = $rootTab->getTabSet(); | |
$last = $tabs->last()->name; | |
$rootTab->insertAfter(Tab::create('FoolashTab'), $last); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getCMSFields() { | |
$fields = FieldList::create( | |
$tabSet = new TabSet('Root', | |
$mainTab = new Tab('Main', | |
new TextField('FieldOne'), | |
new TextField('FieldTwo') | |
) | |
) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Remove fields so we can customise them | |
$dbFields = $this->stat('db'); | |
foreach($dbFields as $dbFieldKey => $val){ | |
$fields->removeByName($dbFieldKey); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SampleDO extends DataObject { | |
public function canCreate($memeber = null){ | |
return true; | |
} | |
public function canEdit($memeber = null){ | |
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function onBeforeWrite(){ | |
parent::onBeforeWrite(); | |
$siteConfig = SiteConfig::current_site_config(); | |
if(!$siteConfig->StoreKey){ | |
$key = FoxyCart::setStoreKey(); | |
+ while(!ctype_alnum($key)){ | |
+ $key = FoxyCart::setStoreKey(); |