Skip to content

Instantly share code, notes, and snippets.

View nick2687's full-sized avatar

Nick Clark nick2687

View GitHub Profile
@nick2687
nick2687 / scCart.html
Created October 30, 2015 11:51
This is the cart tpl where [[+cart.total.delivery_formatted]] is returning 0.00
[[!FormIt? &store=`1` &hooks=`spam,redirect` &submitVar=`checkout` &redirectTo=`[[*id:scFirstChild]]` ]] [[!scCartUpdate]]
<div id="simplecart">
<form action="[[~[[*id]]]]" method="post" id="form_cartoverview">
<input type="hidden" name="updatecart" value="true" />
<div class="table-responsive bottommargin">
<table class="table cart">
<thead>
<tr>
@nick2687
nick2687 / ajaxPage.html
Created July 6, 2015 15:22
SHows how to set up infinate scroll on a site using getPage and getResources
[[!getPage?
&elementClass=`modSnippet`
&element=`getResources`
&parents=`[[!getUrlParam? &name=`parent`]]`
&depth=`0`
&limit=`3`
&pageVarKey=`page`
&includeTVs=`1`
&includeContent=`1`
&hideContainers=`1`
@nick2687
nick2687 / .htaccess
Last active August 29, 2015 14:23 — forked from splittingred/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)$ rest/index.php?_rest=$1 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ rest/index.php [QSA,NC,L]
</IfModule>
@nick2687
nick2687 / ModRestAuthController.php
Created June 17, 2015 01:52
This controller can be used with the modrestcontroller class to preform basic remote authentication through the modrestservice class (modx rest api). Should only be used over https as it requires the username & pass to be sent along as a url param.
<?php
/**
* Found at: Controllers/Box.php
*
* Handle requests to [URL]/Controllers/Box. Automagically handles CRUD (GET/POST/PUT/DELETE) for the xPDOObject class myBox.
*/
class MyControllerAuth extends modRestController {
public $classKey = 'modUser';
public $defaultSortField = 'id';
@nick2687
nick2687 / getPageFeed.php
Last active April 10, 2018 17:07
Simple modx snippet that will pull facebook page feed data and display it using a chunk
<?php
// Facebook App id & secret
$fb_app_id = isset($fb_app_id) ? $fb_app_id : NULL;
$fb_app_secret = isset($fb_app_secret) ? $fb_app_secret : NULL;
$access_token = $fb_app_id . '|' . $fb_app_secret;
// Other options
$page_id = isset($page_id) ? $page_id : NULL ;
$chunk = isset($chunk) ? $chunk : 'getPageFeedTpl' ;
@nick2687
nick2687 / textlink.css
Created February 14, 2014 15:06
snippet for good looking link text.