A pattern suggestion to integrate framework independent domain models into Magento.
We want to instantiate a domain model based on Magento configuration.
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' |
<?php | |
/** | |
* Add events to observe stock qty change | |
* | |
* @author Fabian Schmengler | |
* | |
*/ | |
class SGH_ShippingExpress_Model_CatalogInventory_Stock | |
extends Mage_CatalogInventory_Model_Stock | |
{ |
<?php | |
trait Memoize | |
{ | |
/** | |
* @var array [method][parameters] | |
*/ | |
private $memoizedResults = []; | |
protected function memoizedCall($methodName, $args) | |
{ |
<?php | |
// PoC for collection pipeleines with improved memory footprint | |
// requires php 5.5 >= 5.5.24 | |
// or php 5.6 >= 5.6.8 | |
// or php 7 | |
// | |
// see: https://bugs.php.net/bug.php?id=69221 | |
class Collection extends \IteratorIterator { |
<?php | |
require 'Timer.php'; | |
$testData = array( | |
// $k | count($a) | |
// -------+--------- | |
array( 10, 1000), | |
array( 10, 10000), | |
array( 10, 100000), | |
array( 10, 1000000), |
<?php | |
namespace Example\Http; | |
use Psr\Http\Message\UriInterface; | |
use Psr\Http\Message\StreamInterface; | |
use Symfony\Component\HttpFoundation\HeaderBag; | |
/** | |
* Immutable request object | |
*/ |
#!/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="" |
<?php | |
/** | |
* Generate modman file from Magento Connect 2.0 package.xml | |
* | |
* Usage: | |
* | |
* php package2modman.php path/to/package.xml > path/to/modman | |
* | |
*/ | |
require_once(__DIR__ . "/../www/app/Mage.php"); |