Skip to content

Instantly share code, notes, and snippets.

View cmtickle's full-sized avatar

Colin Tickle cmtickle

View GitHub Profile
@cmtickle
cmtickle / NotTriggeredByPluginsObserver.php
Last active May 4, 2023 10:13
My Magento 2 Observer was called multiple times due to Plugins/Interceptors. This Observer will not be triggered by Plugins.
<?php
namespace Cmtickle\Sample\Observer;
use Magento\Framework\Event\Observer;
class NotTriggeredByPluginsObserver implements \Magento\Framework\Event\ObserverInterface
{
const INTERCEPTOR_FUNCTION = 'Magento\Framework\Interception\{closure}';
@cmtickle
cmtickle / magento2-removed-payment-stub.md
Last active January 28, 2020 09:22
Magento 2 - Enable viewing of orders which contain a removed payment method.

Magento 2

Unable to view historical orders if a payment method is removed.

If you remove a payment method in Magento 2 you will be unable to view orders which have been placed using that payment method in the admin and customer dashboard.

The error logs will show a message similar to the below:

[2020-01-23 10:27:34] main.CRITICAL: Class Magenest\Stripe\Model\StripePaymentMethod does not exist {"exception":"[object] (ReflectionException(code: -1): Class Magenest\\Stripe\\Model
StripePaymentMethod does not exist at /var/www/vhosts/some_customer/vendor/magento/framework/Code/Reader/ClassReader.php:19
@cmtickle
cmtickle / patching_magento2_app_code.md
Last active May 10, 2024 12:04
Patching Magento 2 Code

To patch code in Composer modules

  1. composer require cweagans/composer-patches
  2. Create your patch file as normal (referencing the paths to file in /vendor) and put it in a '.patches' folder at the top level of your code base.
  3. Edit composer.json to apply the patch(es) as below (this goes at the first level of composer.json) :
    "extra": {
        "magento-force": "override",
        "enable-patching": true,
        "patches-file": "composer.patches.json"
 },
@cmtickle
cmtickle / gist:6d064c9d229105a3f942194f084183d7
Last active December 3, 2019 02:41
Connect Raspberry Pi 3B (Raspbian) to Cisco Meraki PEAP EAP network
  1. Due to a TLS issue in release Buster it is easier to get this working in Raspbian Stretch, get it from here.
https://downloads.raspberrypi.org/raspbian/images/raspbian-2019-04-09/2019-04-08-raspbian-stretch.zip
  1. Image it to SD as per Raspbian instructions

  2. Add the following in the root of your 'boot' drive (SD card) as wpa_supplicant.conf (replacing the relevant country, SSID, identity and password details.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
@cmtickle
cmtickle / unbuffered_shell_example.php
Created January 31, 2018 14:55
Use unbuffered SQL queries with Magento to reduce memory usage on large data sets.
<?php
require_once 'abstract.php';
class Cmtickle_Demo_Shell_Tool extends Mage_Shell_Abstract
{
private $_readConnection = null;
protected function _getReadConnection()
{
@cmtickle
cmtickle / gist:477aba06d8d6a69148de542bfb56ed45
Last active June 8, 2017 07:26
SUPEE-9767 : EE FPC add to cart patch
app/code/core/Enterprise/PageCache/Model/Cookie.php | 1 +
app/code/core/Enterprise/PageCache/Model/Observer.php | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/code/core/Enterprise/PageCache/Model/Cookie.php b/app/code/core/Enterprise/PageCache/Model/Cookie.php
index 8d6ef605c5..9979b763f3 100644
--- a/app/code/core/Enterprise/PageCache/Model/Cookie.php
+++ b/app/code/core/Enterprise/PageCache/Model/Cookie.php
@@ -258,6 +258,7 @@ public static function getCategoryViewedCookieValue($id)
public static function setFormKeyCookieValue($formKey)