Skip to content

Instantly share code, notes, and snippets.

View sreichel's full-sized avatar

Sven Reichel sreichel

View GitHub Profile
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
@sreichel
sreichel / zf1f-require_once.patch
Created July 25, 2024 08:14
Patch to replace require_once in ZF1F
This file has been truncated, but you can view the full file.
--- /dev/null
+++ ../library/Zend/Acl/Exception.php
@@ -23,7 +23,7 @@
/**
* @see Zend_Exception
*/
-require_once 'Zend/Exception.php';
+#require_once 'Zend/Exception.php';
@sreichel
sreichel / getData.md
Last active May 11, 2023 13:55
Test getData()
We couldn’t find that file to show.
@sreichel
sreichel / compare.md
Created April 20, 2023 23:17
Compare Zend_Validate to laminas-validate
$string = '';

if (!Zend_Validate::is($string, 'NotEmpty')) {
    echo 'error';
}

$validator = new \Laminas\Validator\NotEmpty();
if (!$validator->isValid($string)) {
 echo 'error';
@sreichel
sreichel / gist:6165e02827af30c027e6b8a83dc622df
Created February 27, 2021 20:34
OpenMage: Amasty FPC 1.8.23 patch
diff --git a/app/code/local/Amasty/Fpc/Model/Fpc.php b/app/code/local/Amasty/Fpc/Model/Fpc.php
index c2ce1cf..0ca387a 100755
--- a/app/code/local/Amasty/Fpc/Model/Fpc.php
+++ b/app/code/local/Amasty/Fpc/Model/Fpc.php
@@ -257,7 +257,9 @@ class Amasty_Fpc_Model_Fpc extends Mage_Core_Model_Cache
'size' => strlen($data),
'type' => 'page',
'customer_group' => Mage::getSingleton('amfpc/fpc_front')->getCustomerGroupId(),
- 'session' => $_COOKIE['frontend']
+ 'session' => isset($_COOKIE[Mage_Core_Controller_Front_Action::SESSION_NAMESPACE])
@sreichel
sreichel / clean-entity-tables.php
Last active July 9, 2018 17:21
Delete orphan product data
<?php
require_once('../app/Mage.php');
Mage::app('admin');
$entityType = Mage::getModel('catalog/product')->getResource()->getTypeId();
$attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection')
->setEntityTypeFilter($entityType);
$count = 0;
<?php
class Amasty_Finder_Block_Product extends Mage_Core_Block_Template
{
public function getProdctfinderCollection()
{
return Mage::helper('amfinder/product')->getProductfinderCollection($this->getFinderId(), $this->getProductId());
}
public function getProductId()
{
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Remove Magento's orphan images web console</title>
<link href='https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Inconsolata:400,700&subset=latin,latin-ext' rel='stylesheet'
type='text/css'>
<style type="text/css">
@sreichel
sreichel / pre-commit
Created July 19, 2017 11:39
Pre-commit hook for git with phpcs and phpcbf (auto-correct obvious violations)
#!/bin/sh
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
# Determine if a file list is passed
if [ "$#" -eq 1 ]
then
oIFS=$IFS
IFS='
<events>
<m2epro_insert_attributes_pattern>
<observers>
<sr_m2epro_insert_attributes_pattern>
<type>singleton</type>
<class>my_m2e_addon/observer</class>
<method>modifyAttributeSearchPattern</method>
</sr_m2epro_insert_attributes_pattern>
</observers>
</m2epro_insert_attributes_pattern>