Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<model package="gbfoxycart" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
<object class="FCartTransactionCustomer" table="gbfoxycart_transaction_customer" extends="xPDOSimpleObject">
<field key="transaction_id" dbtype="int" precision="11" phptype="integer" null="false" index="index" />
<field key="transaction_date" dbtype="timestamp" phptype="timestamp" null="false" default="CURRENT_TIMESTAMP" index="index" extra="on update current_timestamp" />
<field key="customer_id" dbtype="int" precision="11" phptype="integer" null="false" />
<field key="is_anonymous" dbtype="tinyint" precision="1" phptype="integer" null="false" />
<field key="customer_first_name" dbtype="varchar" precision="50" phptype="string" null="false" />
<field key="customer_last_name" dbtype="varchar" precision="50" phptype="string" null="false" />
<?php
$feeds = array(
array('transaction_id' => 123,'customer' => array('...customer data...'),'details' => array('...line items...')),
array('transaction_id' => 456,'customer' => array('...customer data...'),'details' => array('...line items...'))
);
foreach($feeds as $transaction) {
$detailTrans = array();
@enminc
enminc / README.md
Created March 6, 2017 21:47 — forked from lavaxun/README.md
Rancher on docker-for-mac with xhyve

Install Docker for Mac (http://beta.docker.com)

Install docker-machine-driver-xhyve (https://github.com/zchee/docker-machine-driver-xhyve)

brew install docker-machine-driver-xhyve
sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve

Deploy the latest release

@enminc
enminc / onelementnotfound.plugin.php
Created December 17, 2015 17:49
MODX OnElementNotFound plugin demo
<?php
/**
* MODX Revolution OnElementNotFound plugin
* Add static elements inside categories for defined packages OnElementNotFound
*
* Author: Jeroen Kenters / www.kenters.com
* Version: 1.0.0-beta
* License: GPL
*
* Warning:
@enminc
enminc / putMethodsInYourClass .php
Last active August 29, 2015 14:00
modx.getSnippet
<?php
/**
* Similar in practice to localizing getChunk and _getChunkTpl
* in your class to pull chunks from disk but for snippet code
*/
class putMethodsInYourClass {
/**
<?php
/**
* =========================
* defaultTemplateByParentTv
* =========================
*
* Plugin for modX Revolution
* Set default template for children of a ressource
*
* Author:
@enminc
enminc / modx.batchDeleteUnwantedUsers.php
Created October 2, 2013 06:16
simple modx api script to remove unwanted users
$dontRem = array('adam','admin'); /* add any additional context you dont wish to have removed here */
$users = $modx->getCollection('modUser');
foreach($users as $user){
$id = $user->get('id');
$name = $user->get('username');
if(!in_array($name,$dontRem)) {
$response = $modx->runProcessor('security/user/delete',array('id'=>$id));
if ($response->isError()) {
echo $response->getMessage() . '<hr/>';
@enminc
enminc / modx.batchRemoveContexts
Created October 2, 2013 06:05
Simple utility script to remove all undesired context and associated resources from modx db
$dontRem = array('web','mgr'); /* add any additional context you dont wish to have removed here */
$contexts = $modx->getCollection('modContext');
foreach($contexts as $ctx){
$key = $ctx->get('key');
if(!in_array($key,$dontRem)) {
$response = $modx->runProcessor('context/remove',array('key'=>$key));
if ($response->isError()) {
echo $response->getMessage() . '<hr/>';
<?php
/**
* Example of how to fetch your own db table records cached, without using the snippet cached.
*
* Useful when the user can filter the data, like in a seach engine
*
* @package yourpackage
*/
$yourpackage = $modx->getService('yourpackage','yourpackage',$modx->getOption('yourpackage.core_path',null,$modx->getOption('core_path').'components/yourpackage/').'model/yourpackage/',$scriptProperties);
<?php
/* LangRouter
* ==========
*
* This plugin is meant to be used with Babel extra for MODX Revolution. It
* takes care of switching contexts, which hold translations, depending on URL
* requested by client. LangRouter works with so called subfolder based setup,
* in which many languages are served under a single domain but are
* differentiated by a virtual subfolder indicating the language, eg.
* mydomain.com/pl/.