Skip to content

Instantly share code, notes, and snippets.

@MichaelJJames
MichaelJJames / checkout.pre.php
Last active September 5, 2019 12:12
Disable Cart Pop-up CS Cart -- File should be in /app/addons/my_changes/controller/frontend/checkout.pre.php
<?php
if ( !defined('AREA') ) { die('Access denied'); }
if($mode == cart) {
$_SESSION['cart']['skip_notification'] = TRUE;
}
Name: Flash
Serial: eNrzzU/OLi0odswsqnHLSSzOqDGoca7JKCkpsNLXLy8v1ytJTczVLUotKNFLzs8FAJHYETc=
if anyone wants to thank ETH: 0x527c2aB55b744D6167dc981576318af96ed26676
Thank you!
@MichaelJJames
MichaelJJames / Category.php
Last active November 14, 2017 15:28
Silverstripe TagField Example
<?php
class Category extends DataObject
{
private static $db = array(
'Title' => 'Varchar(255)'
);
private static $belongs_many_many = array(
'CaseStudies' => 'CaseStudy',
@MichaelJJames
MichaelJJames / CommentingControllerExtension.php
Last active November 3, 2017 15:03
Silverstripe - Removing Field from Comments Module
<?php
class CommentingControllerExtension extends DataExtension {
public function alterCommentForm($form) {
$form->fields->removeByName('URL');
}
}
<?php
global $project;
$project = 'mysite';
global $database;
$database = '';
require_once('conf/ConfigureFromEnv.php');
class Page_Controller extends ContentController {
private static $allowed_actions = array(
'LandingPage'
);
public function LandingPage() {
$this->customise(array(
'Title' => $this->Title',
'Content' => $this->Content'
@MichaelJJames
MichaelJJames / _config.php
Created October 12, 2017 11:02
GEO Redirect
<?php
global $project;
$project = 'mysite';
global $database;
$database = '';
require_once('conf/ConfigureFromEnv.php');
@MichaelJJames
MichaelJJames / ImageTextBlock.php
Created February 23, 2017 21:02
Example for silverstripe forum
<?php
class ImageTextBlock extends Block {
private static $db = array(
'Title' => 'Varchar(255)',
'Content' => 'HTMLText'
);
private static $has_one = array(
'Image' => 'Image'
);
}
<!DOCTYPE html>
<html>
<head>
<title>DB-Convert</title>
<style>
body { font-family:"Courier New", Courier, monospace;" }
</style>
</head>
<body>
@MichaelJJames
MichaelJJames / main.scss
Last active August 27, 2016 13:09
Sass Mixins
// FONT MIXIN
@mixin Font($Font, $FontFallBack, $Size, $Weight, $Style, $Colour) {
font-family: $Font, $FontFallBack;
font-size: $Size;
font-weight: $Weight;
font-style: $Style;
color: $Colour;
}
body {
@include Font('Open Sans', sans-serif, 16px, 500, normal, #000);