Skip to content

Instantly share code, notes, and snippets.

View keuzenkamp's full-sized avatar

Pieter Keuzenkamp keuzenkamp

View GitHub Profile

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

find . -name "*.phtml" -print | xargs grep --color=auto -iRnH "Mage::getModel("
find . -name "*.phtml" -print | xargs grep --color=auto -iRnH "Mage::getResourceModel("
find . -name "*.phtml" -print | xargs grep --color=auto -iRnH "Mage::getSingleton("
find . -name "*.phtml" -print | xargs grep --color=auto -iRnH "SELECT.*FROM.*;[\"\']"
find . -name "*.php" -print | xargs grep --color=auto -iRnH "htmlEscape("
find ./app/code/local -name "*.php" -print | xargs grep --color=auto -iRnH "htmlEscape("
find ./app/code/local -name "*/Block/*.phtml" -print | xargs grep --color=auto -iRnH "SELECT.*FROM.*;[\"\']"
find ./app/code/local -name "*.php" -print | xargs grep --color=auto -iRnH "\$_[GET|REQUEST|SERVER|POST]"
find ./app/code/local -name "*.php" -print | xargs grep --color=auto -iRnH "public _construct"
find . -name "*.php" -print | xargs grep --color=auto -iRnH "public _construct"
/**
* Magento EAV Entity Inspection
* Inspect Category
*/
SET @entityid = '3';
SELECT ea.attribute_id, ea.attribute_code, eav.value AS 'value', 'varchar' AS 'type'
FROM catalog_category_entity e
JOIN catalog_category_entity_varchar eav
ON e.entity_id = eav.entity_id
<% if @params[:ssl] %>
<VirtualHost <%= node[:ipaddress] %>:443>
ServerName <% if node[:magento][:server][:secure_domain] %><%= node[:magento][:server][:secure_domain] %><% else %><%= @params[:server_name] %><% end %>
SSLEngine on
SSLCertificateKeyFile ssl/<%= @params[:server_name] %>.pem
SSLCertificateFile ssl/<%= @params[:server_name] %>.pem
SSLProtocol all
SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
<% else %>
<?php
// cleanup.php?clean=var
// cleanup.php?clean=log
$xml = simplexml_load_file('./app/etc/local.xml', NULL, LIBXML_NOCDATA);
$db['host'] = $xml->global->resources->default_setup->connection->host;
$db['name'] = $xml->global->resources->default_setup->connection->dbname;
$db['user'] = $xml->global->resources->default_setup->connection->username;
find . -type d -exec chmod 775 {} \;
find . -type f -exec chmod 664 {} \;
chmod 775 -R var/ app/etc/ media/

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

@keuzenkamp
keuzenkamp / gist:7505018
Created November 16, 2013 20:41
magento cache clearing
Cache Clearing And General Information
Clean everything (use either):
Mage::app()->getCacheInstance()->flush();
Mage::app()->getCache()->clean();
Clean specific types:
Mage::app()->getCacheInstance()->cleanType('config');
Mage::app()->getCacheInstance()->cleanType('layout');
@keuzenkamp
keuzenkamp / email.sh
Last active December 27, 2015 06:59 — forked from yevgenko/email.sh
#!/bin/sh
phone='+31 (0)13 785 24 47'
email='info@pieterkeuzenkamp.nl'
basedir='app/design/frontend/pkw_responsive/default'
find $basedir/locale/en_US/template/email/sales -type f -exec sed -i 's/alt="Magento"/alt="{{var order.getStoreGroupName()}}"/g' '{}' \;
find $basedir/locale/en_US/template/email/sales -type f -exec sed -i 's/Magento Demo Store/{{var order.getStoreGroupName()}} /g' '{}' \;
find $basedir/locale/en_US/template/email/sales -type f -exec sed -i 's/Demo Store/{{var order.getStoreGroupName()}} /g' '{}' \;
find $basedir/locale/en_US/template/email/sales -type f -exec sed -i "s/mailto:magento@varien.com/mailto:$email/g" '{}' \;
find $basedir/locale/en_US/template/email/sales -type f -exec sed -i "s/dummyemail@magentocommerce.com/$email/g" '{}' \;
[mysql]
port = 3306
socket = /usr/local/var/run/mysql.sock
[mysqld]
#user = mysql
default_storage_engine = InnoDB
socket = /usr/local/var/run/mysql.sock
pid_file = /usr/local/var/run/mysql.pid