Skip to content

Instantly share code, notes, and snippets.

@schmengler
schmengler / PATCH_SUPEE-5994_EE_1.14.1.0_v1-2015-05-14-05-05-02-without-downloader.sh
Created May 15, 2015 09:11
Magento Security Patch SUPEE-5994 (Magento CE 1.6 - 1.9 / EE 1.11 - 1.14) WITHOUT DOWNLOADER PATCHES
#!/bin/bash
# Patch apllying tool template
# v0.1.2
# (c) Copyright 2013. Magento Inc.
#
# DO NOT CHANGE ANY LINE IN THIS FILE.
# 1. Check required system tools
_check_installed_tools() {
local missed=""
@schmengler
schmengler / Request.php
Created June 20, 2015 09:41
Example: Use the Builder pattern to build immutable objects (usage see below in example.php)
<?php
namespace Example\Http;
use Psr\Http\Message\UriInterface;
use Psr\Http\Message\StreamInterface;
use Symfony\Component\HttpFoundation\HeaderBag;
/**
* Immutable request object
*/
@schmengler
schmengler / bookmarklets.md
Created July 9, 2015 12:45
Magento Admin Bookmarklets

Select all attributes to "Skip" in product export

javascript:$$('input[name="skip_attr[]"]').each(function(el) {el.checked=true;});
@schmengler
schmengler / 01_README.md
Last active December 17, 2015 05:48
Meet Magento 2013 - Herausforderungen bei Konzeption und Test von Magento-Modulen

In diesem Gist sind weiterführende Informationen zum Vortrag "Herausforderungen bei Konzeption und Test von Magento-Modulen" und der zugrundeliegenden Forschungsarbeit gesammelt.

@schmengler
schmengler / Stock.php
Created November 21, 2016 10:30
Magento1 Stock Model Rewrite to add events
<?php
/**
* Add events to observe stock qty change
*
* @author Fabian Schmengler
*
*/
class SGH_ShippingExpress_Model_CatalogInventory_Stock
extends Mage_CatalogInventory_Model_Stock
{
@schmengler
schmengler / README.md
Last active April 17, 2019 08:56
Domain Objects from Magento Configuration

Domain Objects from Magento Configuration

A pattern suggestion to integrate framework independent domain models into Magento.

Problem:

We want to instantiate a domain model based on Magento configuration.

Implementation:

@schmengler
schmengler / SSE_FormFiller Bookmarklets.md
Last active June 27, 2019 11:47
Bookmarklets: Fill Magento forms with data powered by Faker.js

These bookmarklets allow you to use the scripts of SSE_FormFiller in any Magento installation without having to install the extension.

  1. Load FormFiller:

     javascript:(function%20(){document.getElementsByTagName('head')[0].appendChild(document.createElement('script')).src='https://cdnjs.cloudflare.com/ajax/libs/Faker/0.7.2/MinFaker.js';document.getElementsByTagName('head')[0].appendChild(document.createElement('script')).src='https://rawgit.com/schmengler/FormFiller/master/js/sse/formfiller.js';}());
    
  2. Fill billing form:

     javascript:formFiller.fill(billingForm.form)
    
@schmengler
schmengler / OnepageController.php
Created January 18, 2012 12:09
Magento Checkout Integration Test
<?php
/**
* Integration test for OnePageCheckout
*
* @author Fabian Schmengler <fschmengler@sgh-it.eu>
* @copyright SGH informationstechnologie UGmbH 2012
* @package SGH\Common
* @subpackage Test
*
*/
@schmengler
schmengler / array-random-benchmark.php
Last active April 6, 2021 07:15
Draw Elements From Large PHP Array: Benchmark Script
<?php
require 'Timer.php';
$testData = array(
// $k | count($a)
// -------+---------
array( 10, 1000),
array( 10, 10000),
array( 10, 100000),
array( 10, 1000000),
@schmengler
schmengler / add-checkout-form-key.sh
Last active September 2, 2022 16:23
Magento SUPEE-9767 Checkout Form Key Theme Patch
find -L app/design/frontend -regex '.*\(shipping\|billing\|shipping_method\|payment\).phtml' -exec grep -L formkey {} \; \
| xargs sed -i 's/<\/form>/<?php echo $this->getBlockHtml("formkey") ?><\/form>/g'
find -L skin/frontend -name 'opcheckout.js' -exec grep -L form_key {} \; \
| xargs sed -i 's/if (elements\[i\].name=='\''payment\[method\]'\'') {/if (elements[i].name=='\''payment[method]'\'' || elements[i].name == '\''form_key'\'') {/g'