Skip to content

Instantly share code, notes, and snippets.

Avatar

Achim Rosenhagen arosenhagen

View GitHub Profile
@arosenhagen
arosenhagen / local.xml
Created Apr 15, 2012
[magento] - magento 1.6.2.0 combined local.xml bootstrap template
View local.xml
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<block type="page/html" name="root" output="toHtml" template="page/3columns.phtml">
<block type="page/html_head" name="head" as="head">
<action method="addJs"><script>prototype/prototype.js</script></action>
<action method="addJs"><script>lib/ccard.js</script></action>
<action method="addJs"><script>prototype/validation.js</script></action>
<action method="addJs"><script>scriptaculous/builder.js</script></action>
<action method="addJs"><script>scriptaculous/effects.js</script></action>
@arosenhagen
arosenhagen / magento-code-snippets.md
Last active Apr 10, 2021
[magento] - code snippets
View magento-code-snippets.md

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
@arosenhagen
arosenhagen / gist:2489863
Created Apr 25, 2012
[magento] - show related products even if the product is in the cart
View gist:2489863

show related products even if the product is in the cart

copy file from core to local

mkdir -p app/code/local/Mage/Catalog/Block/Product/List
cp app/code/core/Mage/Catalog/Block/Product/List/Related.php app/code/local/Mage/Catalog/Block/Product/List

comment line 58 - 60 (magento ce 1.6.2.0)

@arosenhagen
arosenhagen / gist:2499920
Created Apr 26, 2012
[magento] - getCategory in search list
View gist:2499920

getCategory in search list

load only one category

<?php         
    $ids = $_product->getCategoryIds(); 
    $cat = Mage::getModel('catalog/category')->load($ids[0]);
    echo $cat->getUrl();
?>
@arosenhagen
arosenhagen / gist:2576110
Created May 2, 2012
[magento] - add order-id to transactional emails for payment_method bankpayment
View gist:2576110

add order-id to transactional emails for payment_method bankpayment

E-Mail Template

In your email template (app/locale/de_DE/order_new.phtml / order_new_guest.phtml) add:

{{layout handle="sales_email_order_payment_message" order=$order}}
@arosenhagen
arosenhagen / gist:2585229
Created May 3, 2012
[magento] - notification messages as overlays
View gist:2585229

notification messages as overlays

Install jQuery noty

refer to https://github.com/needim/noty for options and further information

copy jquery-1.7.1-no-conflict.js (vanilla jquery file with appended "jQuery.noConflict();") to js/ copy jquery.noty.js to skin/frontend///js/ copy jquery.noty.css and noty_theme_twitter.css to skin/frontend///css/

@arosenhagen
arosenhagen / gist:2621618
Created May 6, 2012 — forked from astorm/gist:992233
[magento] - fix console.log
View gist:2621618

fix console.log

Information

Remember to remove before deployment, as some users report it makes IE 7 crash

Layout.xml

@arosenhagen
arosenhagen / magento-delete-unused-product-images.md
Created Oct 2, 2012
[magento] - delete unused product images
View magento-delete-unused-product-images.md

magento delete unused product images

Script which uses gallery table from db

run script from magento root directory.

#!/bin/bash

LOG=var/log/del_unused_img.log
@arosenhagen
arosenhagen / magento-troubleshoot-configurables-stock-status.md
Created Oct 6, 2012
[magento] - list all configurable products, whose stock status is wrong according to its associated simple products
View magento-troubleshoot-configurables-stock-status.md

magento troubleshoot: list all configurable products, whose stock status is wrong according to its associated simple products

This script lists all configurable products, which are "Out of Stock" and where at least one associated simple product is in stock. Additionally it lists configurable products, where the configurable product is set to "in stock" but none of the associated simple products are "in stock". When catalog is setup correctly, this script should return nothing.

<?php
require_once('app/Mage.php'); //Path to Magento
@arosenhagen
arosenhagen / gist:5055828
Last active Dec 14, 2015
3 letter country codes of european countries excl. swiss (e.g. for use in magento tablerates)
View gist:5055828
DEU
BEL
BGR
DNK
EST
FIN
FRA
GRC
IRL
ITA