Skip to content

Instantly share code, notes, and snippets.

View upandfine's full-sized avatar

Samuel Sommer upandfine

View GitHub Profile
<?php
/**
* Class Extra_Static_Model_Observer
*
* @category Model
* @package Extra_Static
* @author AOE Magento Team <team-magento@aoe.com>
* @license none none
* @link www.aoe.com

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
<?php
/**
* Generate modman file from Magento Connect 2.0 package.xml
*
* Usage:
*
* php package2modman.php path/to/package.xml > path/to/modman
*
*/
require_once(__DIR__ . "/../www/app/Mage.php");
@upandfine
upandfine / customer_export.php
Created December 15, 2016 17:31 — forked from nhp/customer_export.php
Magento customer migration from one instance to another even with version changes (max tested difference: mageCE 1.5 > 1.9)
<?php
set_time_limit(0);
$pathTo = '../../';
$magentoFilename = $pathTo . 'app/Mage.php';
require_once $magentoFilename;
umask(0);
@upandfine
upandfine / local.xml
Created December 15, 2016 17:31 — forked from nhp/local.xml
Webfont in magento local.xml layout einbinden
default>
<reference name="root">
<reference name="head">
<action method="addCss"><stylesheet>css/custom.css</stylesheet></action>
<block type="core/text" name="google.font.oswald">
<action method="setText">
<text><![CDATA[<link href='http://fonts.googleapis.com/css?family=Oswald:400,700,300' rel='stylesheet' type='text/css'>]]></text>
</action>
</block>
</reference>
@upandfine
upandfine / shell_delete_unused_images
Created December 15, 2016 17:32 — forked from aleron75/shell_delete_unused_images
Delete no more used Product Images on Magento
<?php
require_once 'abstract.php';
class Mage_Shell_CheckImages extends Mage_Shell_Abstract
{
const CATALOG_PRODUCT = '/catalog/product';
const CACHE = '/cache/';
protected function _glob_recursive($pattern, $flags = 0)
@upandfine
upandfine / import.php
Created December 15, 2016 17:32 — forked from nhp/import.php
Script for usage of avs_fastsimpleimport and configurable products
<?php
/**
* Created by JetBrains PhpStorm.
* User: npreuss
* Date: 3/25/13
* Time: 12:53 PM
* To change this template use File | Settings | File Templates.
*/
require_once 'app/Mage.php';
umask( 0 );
$this->db_access->write("DB_NAME", "UPDATE `cataloginventory_stock_item` SET `qty` = '".$qty."', `is_in_stock` = '".$is_in_stock."' WHERE `product_id` = '".$product_id."'");
$this->db_access->write("DB_NAME", "UPDATE `cataloginventory_stock_status` SET `qty` = '".$qty."',`stock_status` = '".$is_in_stock."' WHERE `product_id` = '".$product_id."'");
get_id_by_sku: $id = $this->db_access->read("DB_NAME", "SELECT `entity_id` FROM `catalog_product_entity` WHERE
`sku` = '".$sku."' LIMIT 1");
@upandfine
upandfine / composer.json
Created December 15, 2016 17:33 — forked from nhp/composer.json
composer.json
{
"require": {
"connect20/dsdata_nostate": "*",
"therouv/debitpayment": "*",
"connect20/bankpayment": "*",
"connect20/locale_mage_community_de_de": "*",
"magento-hackathon/magento-composer-installer": "*",
"colinmollenhour/cache-backend-redis": "*",
"colinmollenhour/redis-session": "*",
"firegento/germansetup": "*",
SQL
mysql -u <dbuser> -p
update core_config_data set value = 'http://mydomain/' where path = 'web/unsecure/base_url';
update core_config_data set value = 'http://mydomain/' where path = 'web/secure/base_url';