Skip to content

Instantly share code, notes, and snippets.

View fhferreira's full-sized avatar
🏠
Home-Office since 2005

Flávio H. Ferreira fhferreira

🏠
Home-Office since 2005
View GitHub Profile
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
ini_set('max_execution_time', 300);
ini_set('memory_limit', '1024M');
define('MAGENTO_ROOT', getcwd());
require_once(MAGENTO_ROOT . '/app/Mage.php');
Mage::setIsDeveloperMode(true);
@fhferreira
fhferreira / 1.markdown
Last active August 29, 2015 14:08 — forked from pinedamg/1.markdown

My Magento Snippets

Checkout virtual - downloadable product

<?php

require_once '../app/Mage.php';
 
Varien_Profiler::enable();
<!-- Add to the package layout (via local.xml or however you prefer) -->
<!-- Also, best to remove before deployment, as some users report -->
<!-- it makes IE 7 crash -->
<default>
<reference name="content">
<block type="core/text" name="fix.console" as="fix.console">
<action method="setText">
<text><![CDATA[<script type="text/javascript">
iframe = document.createElement('iframe');
iframe.style.display = 'none';

Magento SSH

Reset permissions

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod -R o+w media var
chmod o+w app/etc
<?php
define( 'USERNAME', 'new.user' );
define( 'PASSWORD', 'password' );
define( 'FIRSTNAME', 'Excited' );
define( 'LASTNAME', 'Croc' );
define( 'EMAIL', '[email protected]' );
include_once( 'app/Mage.php' );
Mage::app( 'admin' );
try {

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

@fhferreira
fhferreira / 1.markdown
Last active August 29, 2015 14:08 — forked from pinedamg/1.markdown

My Magento Snippets

Checkout virtual - downloadable product

<?php

require_once '../app/Mage.php';
 
Varien_Profiler::enable();
@fhferreira
fhferreira / config.xml
Last active August 29, 2015 14:08 — forked from ashfame/config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Anattadesign_Adminoverrider>
<version>1.0.0</version>
</Anattadesign_Adminoverrider>
</modules>
<global>
<layout>
<adminhtml_sales_order_create_index>
<?php
require_once ("app/Mage.php");
umask(0);
Mage::app("default");
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*');
foreach ($collection as $customer) {