Skip to content

Instantly share code, notes, and snippets.

View pkdavies's full-sized avatar

Peter Davies pkdavies

View GitHub Profile
diff --git app/code/core/Mage/Paypal/Model/Ipn.php app/code/core/Mage/Paypal/Model/Ipn.php
index 730d09b..eb5f0e0 100644
--- app/code/core/Mage/Paypal/Model/Ipn.php
+++ app/code/core/Mage/Paypal/Model/Ipn.php
@@ -139,8 +139,20 @@ class Mage_Paypal_Model_Ipn
$this->_debugData['postback'] = $sReq;
$this->_debugData['postback_to'] = $this->_config->getPaypalUrl();
+ /**
+ * Array of http headers required by PayPal
@pkdavies
pkdavies / SUPEE-662_EE_1.12.0.2_v2.patch
Created December 18, 2012 12:49
Magento rounding issue patch file
diff --git app/code/core/Mage/Core/Model/Store.php app/code/core/Mage/Core/Model/Store.php
index 66a94f5..1a146a5 100644
--- app/code/core/Mage/Core/Model/Store.php
+++ app/code/core/Mage/Core/Model/Store.php
@@ -106,6 +106,12 @@ class Mage_Core_Model_Store extends Mage_Core_Model_Abstract
*/
const MEDIA_REWRITE_SCRIPT = 'get.php/';
+
+ /**
@pkdavies
pkdavies / metafix.php
Created December 5, 2012 15:09
META data updater for Mageworx SEO Ultimate
<?php
/**
* Magento META data populator for us with Mageworx SEO Suite Ultimate.
* Copyright Juicy Media Ltd
*
* Features:
* -> wipes META description and title
* -> updates META keywords based on product description
*
* Usage:
@pkdavies
pkdavies / newsletter-import.php
Created July 11, 2012 10:41
Magento newsletter mass import script
<?php
ini_set('memory_limit', '3048M');
ini_set('post_max_size', '32M');
ini_set('max_input_time', 999);
ini_set('max_execution_time',999);
ini_set('display_errors',1);
set_time_limit(0);
error_reporting(E_ALL);
// magento specific connection info
@pkdavies
pkdavies / gist:3060960
Created July 6, 2012 15:40
PHP based high resolution image combiner
<?php
$oldpath = "./in/";
$newpath = "./out/";
$dir_iterator = new RecursiveDirectoryIterator($oldpath);
$iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST);
$files_all = $files_copied = $files_replaced = 0;
@pkdavies
pkdavies / apcfrag.php
Created June 8, 2012 12:31
APC cache fragmentation only value for monitoring service
<?php
ini_set('display_errors',1);
ini_set('error_reporting', E_ALL);
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// default display mode
//$display_mode='formatted';
@pkdavies
pkdavies / download.php
Last active September 27, 2015 01:17
Correct cross-browser force CSV
<?php
$filename = "my-csv-file-".date("Y-m-d").".csv";
ob_start( ini_get('zlib.output_compression')? 'ob_gzhandler' : '' );
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: public");
header("Cache-Control: max-age=0");
@pkdavies
pkdavies / gist:1080324
Created July 13, 2011 13:50
Apache optimisation for Magento
FileETag none
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
ExpiresByType text/html "access"
ExpiresByType text/xml "access plus 60 minutes"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/plain "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
@pkdavies
pkdavies / gist:1071669
Created July 8, 2011 11:51
fgetcsv to mysql insert statements
<pre>
<?php
$row = 0;
if (($handle = fopen("data.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
$model_id = $data[1];
for ($c=2; $c < $num; $c++) {
if (!empty($data[$c])){
@pkdavies
pkdavies / gist:1037940
Created June 21, 2011 14:13
Combine multiple text files
#!/bin/bash
for file in `ls ./*.txt`
do
cat $file >> all.files
done