Skip to content

Instantly share code, notes, and snippets.

View americkson's full-sized avatar
😎

Adam Erickson americkson

😎
View GitHub Profile
@americkson
americkson / Contract Killer 3.md
Created April 11, 2016 21:19
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@americkson
americkson / customers.sql
Created October 20, 2015 19:46 — forked from leek/_Magento1_DeleteTestData.md
Magento - Delete All Test Data
SET FOREIGN_KEY_CHECKS=0;
-- Customers
TRUNCATE `customer_address_entity`;
TRUNCATE `customer_address_entity_datetime`;
TRUNCATE `customer_address_entity_decimal`;
TRUNCATE `customer_address_entity_int`;
TRUNCATE `customer_address_entity_text`;
TRUNCATE `customer_address_entity_varchar`;
TRUNCATE `customer_entity`;
@americkson
americkson / gist:17c1ffaeafa4a41eccef
Created September 22, 2015 13:44
Magento Enterprise 1.14 Clear Product Data
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `catalog_product_bundle_option`;
TRUNCATE TABLE `catalog_product_bundle_option_value`;
TRUNCATE TABLE `catalog_product_bundle_price_index`;
TRUNCATE TABLE `catalog_product_bundle_selection`;
TRUNCATE TABLE `catalog_product_bundle_selection_price`;
TRUNCATE TABLE `catalog_product_bundle_stock_index`;
TRUNCATE TABLE `catalog_product_entity_datetime`;
TRUNCATE TABLE `catalog_product_entity_decimal`;
TRUNCATE TABLE `catalog_product_entity_gallery`;
@americkson
americkson / gist:cdfb7c24d41d5aefcf42
Last active August 4, 2023 19:11
Ioncube Install - Nginx

Ioncube Install - Nginx

This guide will help with install ioncube loader on an Nginx web server http://www.ioncube.com/loaders.php

** In this guide there are some specific directories that might not be the same for all environments

Check your version of PHP

This is needed to know which ioncube extension you will need to use. For example, if you are running php 5.5 you will need the ioncube_loader_lin_5.5.so file

@americkson
americkson / Magento SSH Install
Created December 12, 2013 19:47
Magento SSH Install
Just replace the VERSION Number for the version you want.
wget http://www.magentocommerce.com/downloads/assets/1.7.0.2/magento-1.7.0.2.tar.gz
tar -zxvf magento-1.7.0.2.tar.gz
mv magento/* magento/.htaccess .
chmod -R o+w media var
chmod o+w app/etc
@americkson
americkson / Magento Category Anchors
Last active February 22, 2017 10:09
Magento - Set all categories to be an anchor
IMPORTANT NOTE: To have this work you cannot have Flat Catalog enabled
// ORIGINAL -----------------------
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
// Load Up Magento Core
define('MAGENTO', realpath(''));
@americkson
americkson / Get a list of Events fired in Magento
Last active December 22, 2015 20:19
Get a list of Events fired in Magento
Look in the file:
app/Mage.php
in Mage.php look for the dispatchEvent() function
public static function dispatchEvent($name, array $data = array())
inside the dispatchEvent() function add a Mage::log()
Mage::log('events: '.$name);
@americkson
americkson / gist:5354605
Last active December 16, 2015 01:19
Random Magento Snippets

Truncate Text

truncate($STRING, $LENGTH); ?>

Ways to print attributes

  • this should work for drop downs and multi-select
getAttributeText('attribute_name'); ?>
  • this should work for text fields
@americkson
americkson / gist:5196021
Last active September 6, 2016 03:43
GIT - Working with branches

Create a branch:

$ git branch <name_of_your_new_branch>  

Push the branch on github :

$ git push origin <name_of_your_new_branch>  

Switch to your new branch :

@americkson
americkson / Wordpress Database Move
Created February 25, 2013 15:02
Wordpress Database Move
UPDATE wp_options SET option_value = Replace(option_value, 'current-staging-domain', 'primary-domain-name');
UPDATE wp_posts SET post_content = Replace(post_content, 'current-staging-domain', 'primary-domain-name');
UPDATE wp_posts SET guid = Replace(guid, 'current-staging-domain', 'primary-domain-name');