Skip to content

Instantly share code, notes, and snippets.

@kalenjordan
kalenjordan / repurchase-rate.sql
Last active January 1, 2016 20:59
Magento Repurchase Rate Note: This assumes you don't use guest checkout - if you do, you could probably group by customer_email and get relatively accurate results.
# The number of customers who haveve only purchased once from December 2012 to December 2013
SELECT customers_in_segment
FROM
(
SELECT count(*) AS customers_in_segment, order_count
FROM
(
SELECT customer_id, min(created_at) AS first_order_at, count(*) AS order_count
FROM sales_flat_order
@kalenjordan
kalenjordan / magento-admin-gamification.md
Last active August 29, 2015 13:56
Magento Admin Gamification

Magento Admin Gamification

The Idea

The idea is to use gamification in the Magento backend to help to train admins who are new to using Magento with some kind of interactive tutorial along with earning points for doing things like updating their store address in system config and creating a new product, etc.

How Would It Work

Not totally sure, just a rough idea right now. But my thinking is - some combination of an interactive tutorial with points and badges earned for different actions.

@kalenjordan
kalenjordan / gist:9085832
Created February 19, 2014 03:59
3 Easy Steps To Get Rich Using SEO
1. Make something cool
2. Write stuff
3. Don't suck
@kalenjordan
kalenjordan / winkles-law.md
Created February 20, 2014 20:06
Winkle's Law

For any problem that can be encountered in Magento, a solution has already been discovered by @philwinkle.

<div class="block-item cleanse col-md-12 visible-desktop">
<div class="content">
<div class="clearfix">
<div class="program-image visible-phone-tablet">
<h3 class="visible-phone">Start Here</h3>
<img class="img-responsive" src="http://skin.cleanprogram.com/2014-02-24-8-26-UTC/skin/frontend/clean/default/images/clean-cleanse-home.jpg" alt="Clean Cleanse">
</div>
<div class="program-detail col-sm-6 col-md-6 col-lg-12">
<h3 class="hidden-phone">Start Here</h3>
<img class="visible-desktop center-block-element" src="http://skin.cleanprogram.com/2014-02-24-8-26-UTC/skin/frontend/clean/default/images/clean-cleanse-home.jpg" alt="Clean Cleanse">

Edit Content over the Frontend

Background

Content editing is always a little bit of a hassle. Sometimes your team might not know where a given piece of content exists - whether in CMS Pages, Static Blocks, Product content, or static HTML.

The Idea

Give admins the ability to edit content directly through the frontend via something like a blogger-style interface (you guys remember the blogger days, right?).

The Featuh's

  • Load via AJAX after page load - only shows if the admin is viewing the page.
/* Here are some example custom report queries for use with the custom
* reports module
*
* http://magemail.co/free-custom-reports-module-for-magento/
*/
/*
* Number of items in order
*
* Useful to find out whether customers are buying a given product
@kalenjordan
kalenjordan / admin-grid-status.js
Last active August 29, 2015 13:57
Gray out rows in a grid if a status column is inactive
// Drop this javascript in the page where your grid is - maybe using a .phtml
// in before_body_end or whatever.
var statuses = document.querySelectorAll(".admin-autoemail-adminhtml-rule-index td");
[].forEach.call(statuses, function (status) {
if (status.textContent.indexOf("Inactive") > -1) {
status.up('tr').style.color = "#aaa";
status.up('tr').down('a').style.color = "#aaa";
}
});
@kalenjordan
kalenjordan / tar-magento.sh
Created March 27, 2014 13:03
Tar Magento Files
tar --exclude="media" --exclude="includes" --exclude="var" -cvf var/files.tar .
@kalenjordan
kalenjordan / public-key
Last active August 29, 2015 13:59
Public Key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2vHCsJ9mmtA2c7gSdmJtpL91tBPhdlKv3liIO/FLKUZugfNNv7p+p/xJ8ZUiEMPMYroaw4vAWu99wsRMiwCkoIExhQj5duNQaE0ZJmM/7fX3uTCICNdEQd7vS8vvoN0XelHRbmZ5Ut7ZXjRnc6v6uYnJEboZhtVLFD/sfbGmZ8Pz8HRi1K4U+YpTDf4CLVyiDd8byL6dJv4KMio/LngSkncaLHZcA959U9baomi/zziYCOFSy8QN9J7APefvodFYIhRD4ynOFeQwr96eJqfJU7a2Rf9kIrdEjbnteY6yE7EdQiifLiidRTdydgB5ZBdxyfmTp0Ay30c8t7zEHkTi7 kalenj@Kalens-Mac-mini.local