Skip to content

Instantly share code, notes, and snippets.

@mpchadwick
mpchadwick / enabled-categories-with-no-products.sql
Created December 7, 2015 20:07
Magento Enabled Categories with No Products
# Replace the attribute IDs as needed
SELECT
cce.entity_id AS "Category ID",
cce.path as "Category Path",
ccev.value as "Category Name",
COUNT(ccp.product_id) as "Number of Products"
FROM catalog_category_entity cce
INNER JOIN catalog_category_entity_varchar ccev
ON cce.entity_id = ccev.entity_id
@mpchadwick
mpchadwick / magento-catalog-product-list-api-first-1000-products.php
Created December 9, 2015 21:34
Magento Catalog Product List API First 1000 Products
<?php
$client = new SoapClient('https://example.com/api/v2_soap?wsdl');
$session = $client->login('my_user_name', 'my_password');
$result = $client->catalogProductList($session, array(
'complex_filter' => array(
array(
'key' => 'product_id',
'value' => array('key' => 'from', 'value' => '1')
@mpchadwick
mpchadwick / zend-date-issue.php
Created January 4, 2016 15:05
zend-date-issue
<?php
// Replace this with whatever you need to initialize Magento
// this is really only needed to be able to instantiate a `Zend_Date` object
require_once('/var/www/html/app/Mage.php');
Mage::app();
$createdAt = '2016-01-03 05:01:24';
$timezone = 'America/New_York';
@mpchadwick
mpchadwick / script-timeout.html
Last active April 22, 2016 19:22
Script Timeout
<script src="http://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://example.com/thisCouldTakeAWhile.js" async></script>
<script type="text/javascript">
$(document).ready(function() {
setTimeout(() => $('script[src="https://example.com/thisCouldTakeAWhile.js"]').remove(), 3000);
})
</script>
@mpchadwick
mpchadwick / long-running-crons.sql
Created April 28, 2016 14:59
long-running-crons.sql
# Find the crons that take the longest to run
# Note: kill_request will only be present if you have installed AOE_Scheduler
# And will only be used if your are running the watchdog task
SELECT
job_code,
executed_at,
finished_at,
schedule_id,
kill_request,
TIMEDIFF(finished_at, executed_at)
@mpchadwick
mpchadwick / query-string-usage-report.php
Created July 3, 2016 19:24
query-string-usage-report
<?php
$handle = fopen("ssl_access_log", "r");
$i = 0;
$reportParamCount = [];
$reportParamParts = [];
$giveFeedbackEvery = 1000;
> SHOW DIAGNOSTICS
name: build
-----------
Branch Build Time Commit Version
0.13 e57fb88a051ee40fd9277094345fbd47bb4783ce 0.13.0
name: network
-------------
hostname
name: database
tags: database=_internal
numMeasurements numSeries
--------------- ---------
10 295
name: database
tags: database=client_production
numMeasurements numSeries
> SHOW SHARDS
name: _internal
---------------
id database retention_policy shard_group start_time end_time expiry_time owners
48 _internal monitor 48 2016-07-18T00:00:00Z 2016-07-19T00:00:00Z 2016-07-26T00:00:00Z
55 _internal monitor 55 2016-07-19T00:00:00Z 2016-07-20T00:00:00Z 2016-07-27T00:00:00Z
58 _internal monitor 58 2016-07-20T00:00:00Z 2016-07-21T00:00:00Z 2016-07-28T00:00:00Z
67 _internal monitor 67 2016-07-21T00:00:00Z 2016-07-22T00:00:00Z 2016-07-29T00:00:00Z
70 _internal monitor 70 2016-07-22T00:00:00Z 2016-07-23T00:00:00Z 2016-07-30T00:00:00Z
73 _internal monitor 73 2016-07-23T00:00:00Z 2016-07-24T00:00:00Z 2016-07-31T00:00:00Z
[run] 2016/07/25 16:02:54 InfluxDB starting, version 0.13.0, branch 0.13, commit e57fb88a051ee40fd9277094345fbd47bb4783ce
[run] 2016/07/25 16:02:54 Go version go1.6.2, GOMAXPROCS set to 2
[run] 2016/07/25 16:02:54 Using configuration at: /etc/influxdb/influxdb.conf
[store] 2016/07/25 16:02:54 Using data dir: /var/lib/influxdb/data
[tsm1wal] 2016/07/25 16:02:54 tsm1 WAL starting with 10485760 segment size
[tsm1wal] 2016/07/25 16:02:54 tsm1 WAL writing to /var/lib/influxdb/wal4/_internal/monitor/58
[tsm1wal] 2016/07/25 16:02:54 tsm1 WAL starting with 10485760 segment size
[tsm1wal] 2016/07/25 16:02:54 tsm1 WAL writing to /var/lib/influxdb/wal4/telegraf/default/29
[filestore] 2016/07/25 16:02:54 /var/lib/influxdb/data/_internal/monitor/58/000000003-000000002.tsm (#0) opened in 3.930727ms
[filestore] 2016/07/25 16:02:54 /var/lib/influxdb/data/telegraf/default/29/000000012-000000003.tsm (#0) opened in 11.161611ms