Skip to content

Instantly share code, notes, and snippets.

update JobDescription
set j.Description = convert(nvarchar(max), isnull(j.Description, "")) + ?
where j.Heading = 'Notes:' AND m.Ref10 = ?
@fRAiLtY-
fRAiLtY- / gist:2139391a3e568e76466a
Created October 10, 2014 09:14
Get customers lifetime sales and last time an order placed from Magento
SELECT customer_email As 'Email', customer_firstname AS 'First name', customer_lastname AS 'Surname',
CONCAT('£', FORMAT(SUM(sales_flat_order.grand_total), 2)) AS 'Lifetime sales', COUNT(sales_flat_order.entity_id) AS 'Orders', MAX(created_at) AS 'Last order'
FROM sales_flat_order
WHERE state != 'canceled'
GROUP BY sales_flat_order.customer_id
ORDER BY SUM(sales_flat_order.grand_total) DESC
@fRAiLtY-
fRAiLtY- / catalog.xml
Created November 4, 2013 07:54
Caching of product_view block
<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
<action method="setCacheLifetime">
<lifetime>86400</lifetime>
</action>
<block type="review/product_view_list" name="product.info.product_additional_data" as="product_review" template="review/product/view/list.phtml">
<block type="review/form" name="product.review.form" as="review_form"/>
</block>
public function manageAttachmentsAction()
{
if (!$this->_loadValidOrder()) {
$this->_forward('noRoute');
return false;
}
$this->loadLayout();
$this->_initLayoutMessages('catalog/session');
/**
* Index action, checks for login
*/
public function index()
{
//Check login
$this->load->library('form_validation');
$this->form_validation->set_rules('username','Username','required');
$this->form_validation->set_rules('password','Password','required|min_length[5]');
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?php echo $title ?></title>
<meta name="description" content="">
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Home controller
*
* @package CodeIgniter v2.0.3
* @author: Tom Davison <hello@magentom.co.uk>
* @copyright Copyright (c) 2013 Tom Davison
* @category Controllers
*/
public function index()
{
//Check login
$this->load->library('form_validation');
$this->form_validation->set_rules('username','Username','required');
$this->form_validation->set_rules('password','Password','required|min_length[5]');
//If valid proceed
if($this->form_validation->run() !== FALSE){
$this->load->model('login');
public function index()
{
//Check login
$this->load->library('form_validation');
$this->form_validation->set_rules('username','Username','required');
$this->form_validation->set_rules('password','Password','required|min_length[5]');
//If valid proceed
if($this->form_validation->run() !== FALSE){
$this->load->model('login');