Skip to content

Instantly share code, notes, and snippets.

src/app/code/community/Vendor/* app/code/community/Vendor/
src/app/etc/modules/* app/etc/modules/
@avoelkl
avoelkl / composer.json
Created August 12, 2016 12:34
Sample composer.json file
{
"name": "vendor/modulename",
"type": "magento-module",
"license":"OSL-3.0",
"description":"Helps you doing cool stuff",
"authors":[
{
"name":"Firstname Lastname",
"email":"firstname.lastname@awesomecompany.com"
}
@avoelkl
avoelkl / loadcustomer.php
Last active August 17, 2016 11:54
Testing efficient way of loading customer data
<?php
require_once '../app/Mage.php';
Mage::app();
umask(0);
$customerId = 575420;
$start = microtime();
$memory1 = memory_get_usage();
$customer = Mage::getModel('customer/customer')->load($customerId);
$firstname = $customer->getFirstname();
@avoelkl
avoelkl / gist:0cacdb354c7c45c6157be44676e825aa
Last active September 7, 2016 14:51
addGroupPriceData() is missing in Mage_Catalog_Model_Resource_Product_Collection
<?php
/**
* Created by PhpStorm.
* User: Anna Völkl <a.voelkl@limesoda.com>
* Date: 07.09.2016
* Time: 16:01
add this to config.xml
<models>
<catalog_resource>
@avoelkl
avoelkl / de_DE.csv
Last active February 22, 2018 12:23 — forked from peterjaap/de_DE.csv
Algolia
label Bezeichnung
Base Image Basisbild
Small Image Kleines Bild
Thumbnail Miniaturansicht
None Keine
AllOptional Alle optional
LastWords letztes Wort
FirstWords erstes Wort
Search for products, categories Suche nach Produkten, Kategorien
Search Suche
@avoelkl
avoelkl / TransportBuilder.php
Last active December 16, 2019 09:02
TransportBuilder
<?php
/**
* Mail Template Transport Builder
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\Framework\Mail\Template;
@avoelkl
avoelkl / gist:49563c516d6cb318eb34
Last active November 17, 2020 07:41
Non-blocking and quick database dumps for large databases

How-to

Add --single-transaction and --quick to your mysqldump command.

--single-transaction

sets the isolation mode to REPEATABLE READ and starts a transaction before dumping data. useful for InnoDB tables, dumps the consistent state without blocking any applications.

--quick

<?php
/**
* A simple fix for a shell execution on preg_match('/[0-9]\.[0-9]+\.[0-9]+/', shell_exec('mysql -V'), $version);
* The only edit that was done is that shell_exec('mysql -V') was changed to mysql_get_server_info() because not all
* systems have shell access. XAMPP, WAMP, or any Windows system might not have this type of access. mysql_get_server_info()
* is easier to use because it pulls the MySQL version from phpinfo() and is compatible with all Operating Systems.
* @link http://www.magentocommerce.com/knowledge-base/entry/how-do-i-know-if-my-server-is-compatible-with-magento
* @author Magento Inc.
*/