Skip to content

Instantly share code, notes, and snippets.

Peter Jaap Blaakmeer peterjaap

Block or report user

Report or block peterjaap

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
peterjaap / fullquery.diff
Created Jan 31, 2014
Show full query in Magento stack trace
View fullquery.diff
diff --git a/lib/Zend/Db/Statement/Pdo.php b/lib/Zend/Db/Statement/Pdo.php
index cd0a947..b116e3d 100644
--- a/lib/Zend/Db/Statement/Pdo.php
+++ b/lib/Zend/Db/Statement/Pdo.php
@@ -231,7 +231,7 @@ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggrega
} catch (PDOException $e) {
#require_once 'Zend/Db/Statement/Exception.php';
- throw new Zend_Db_Statement_Exception($e->getMessage(), (int) $e->getCode(), $e);
+ throw new Zend_Db_Statement_Exception($e->getMessage() . PHP_EOL . $this->_stmt->queryString, (int) $e->getCode(), $e);
peterjaap / placeInCategoryBasedOnAttributeset.sql
Last active Aug 29, 2015
Place products in a specified category based on attribute set
View placeInCategoryBasedOnAttributeset.sql
SELECT @cat_id := entity_id FROM catalog_category_flat_store_1 WHERE url_path = 'merken/makita';
SELECT @attr_set_id := attribute_set_id FROM eav_attribute_set WHERE attribute_set_name = 'Makita';
INSERT IGNORE catalog_category_product (category_id,product_id) SELECT @cat_id, entity_id FROM catalog_product_entity WHERE attribute_set_id = @attr_set_id;
peterjaap / getArrayToObjectResults.php
Created Mar 5, 2014
This function creates a multi-dimensional Varien_Object by inputting a multi-dimensional array
View getArrayToObjectResults.php
public function getArrayToObjectResults($array) {
$obj = new Varien_Object();
foreach($array as $k => $v) {
if(strlen($k)) {
if(is_array($v)) {
$obj->{$k} = $this->getArrayToObjectResults($v);
} elseif ($k !== '') {
$obj->{$k} = $v;
peterjaap / separate_db.php
Last active Aug 29, 2015
Magento separate db connection
View separate_db.php
$db = new Zend_Db_Adapter_Pdo_Mysql(array(
'host'=> '',
'username' => 'webuser',
'password' => 'xxxxxxxx',
'dbname'=> 'test',
'profiler' => true,
peterjaap / abandonedcart_stock_check.php
Last active Aug 29, 2015
Ebizmarts_AbandonedCart doesn't check whether a product that will be sent in an Abandoned Cart email is still available. This piece of code checks whether the product still exists, is enabled and has stock available (if stock is managed). If any of these 3 do not comply, the product is removed from the quote. Finally, we check whether there are …
View abandonedcart_stock_check.php
/* Place this on line 117, right after foreach($collection as $quote) in app/code/community/Ebizmarts/AbandonedCart/Model/Cron.php */
foreach($quote->getAllVisibleItems() as $item) {
$removeFromQuote = false;
$product = Mage::getModel('catalog/product')->load($item->getProductId());
if(!$product || $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED)
Mage::log('AbandonedCart; ' . $product->getSku() .' is no longer present or enabled; remove from quote ' . $quote->getId() . ' for email',null,'Ebizmarts_AbandonedCart.log');
peterjaap / analyzeVoys.php
Last active Aug 29, 2015
Analyze Voys CDRS file (downloadable from
View analyzeVoys.php
if(count($argv)==1) {
echo <<< EOT
Usagae; {$_SERVER['PHP_SELF']} {filename} {from} {to} {showUpper}
Filename defaults to cdrs.csv
From defaults to today
To defaults to From plus 1 year
ShowUpper only shows top X callers (defaults to 25)
Example; {$_SERVER['PHP_SELF']} cdrs.csv 01-01-2014 01-07-2014
View .zshrc
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Themes; look in ~/.oh-my-zsh/themes/
# Oh my ZSH
source $ZSH/
. ~/.rupa-z/
peterjaap / createGmailFiltersCodebase.php
Last active Aug 29, 2015
Create Gmail forwarders for Codebase tickets
View createGmailFiltersCodebase.php
This little script creates an XML file for you to import in your Gmail account.
It creates forwarders to automatically create tickets in Codebase with an
easy to remember emailformat like tickets-<projectname>
For more information see
peterjaap / ActiveAnts patch.patch
Created Dec 2, 2014
ActiveAnts patch images over HTTP or HTTPS
View ActiveAnts patch.patch
From 3d350f20228960007ac1c38a59fc9734c4b8643d Mon Sep 17 00:00:00 2001
From: Peter Jaap Blaakmeer <>
Date: Tue, 2 Dec 2014 11:23:15 +0100
Subject: [PATCH 1/2] Set secure true to check for is true or not
.../base/default/template/activeants/checkout/cart/shipping.phtml | 2 +-
.../activeants/checkout/onepage/shipping_method/available.phtml | 4 ++--
.../activeants/checkout/onestepcheckout/shipping_method.phtml | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
peterjaap / ghostinspector.rb
Last active Aug 29, 2015
Capistrano Ghostinspector function
View ghostinspector.rb
require 'json'
require 'rubygems'
require 'curb'
namespace :ghostinspector do
desc 'Run Ghostinspector test suite'
task :testsuite do
version = "v1"
You can’t perform that action at this time.