Skip to content

Instantly share code, notes, and snippets.

@xcommerce-gists
xcommerce-gists / adminhtml.xml
Created January 24, 2014 18:38
Portion of Magento adminhtml.xml showing how to configure menus and ACL
<!-- Only lines 26 through 44 are shown -->
<news translate="title" module="magentostudy_news">
<title>News</title>
<sort_order>65</sort_order>
<children>
<manage translate="title">
<title>Manage News</title>
<sort_order>0</sort_order>
<children>
<save translate="title">
@xcommerce-gists
xcommerce-gists / system.xml
Last active January 4, 2016 09:29
Sample Magento system.xml, which defines System > Configuration options
<?xml version="1.0"?>
<!--
/**
* Magento admin configiguration section config
*
* @author Magento
*/
-->
<config>
<sections>
@xcommerce-gists
xcommerce-gists / adminhtml.xml
Last active January 4, 2016 09:28
Sample Magento adminhtml.xml to define the Admin Panel menu structure and to provide ACL to access it
<?xml version="1.0"?>
<!--
/**
* Magento admin config
*
* @author Magento
*/
-->
<config>
<menu>
@xcommerce-gists
xcommerce-gists / Observer.php
Created January 21, 2014 21:40
Sample Magento observer
<?php
/**
* News module observer
*
* @author Magento
*/
class Magentostudy_News_Model_Observer
{
/**
* Event before show news item on frontend
@xcommerce-gists
xcommerce-gists / IndexController.php
Last active January 4, 2016 01:29
Portion of Magento IndexController.php that shows how to fire an event
<?php
/**
* Lines 62 to 75 of IndexController.php that
* show how to fire an event
*
* Other code is removed for brevity
*
* @author Magento
*/
@xcommerce-gists
xcommerce-gists / Image.php
Created January 21, 2014 20:53
Sample Magento image helper class
<?php
/**
* News Image Helper
*
* @author Magento
*/
class Magentostudy_News_Helper_Image extends Mage_Core_Helper_Abstract
{
/**
* Media path to extension imahes
@xcommerce-gists
xcommerce-gists / Data.php
Created January 21, 2014 20:51
Sample Magento data helper class
<?php
/**
* News Data helper
*
* @author Magento
*/
class Magentostudy_News_Helper_Data extends Mage_Core_Helper_Data
{
/**
* Path to store config if front-end output is enabled
@xcommerce-gists
xcommerce-gists / config.xml
Created January 21, 2014 20:35
Sample Magento config.xml showing blocks and layouts in context
<?xml version="1.0"?>
<!--
/**
* Module configuration
*
* @author Magento
*/
-->
<config>
<modules>
@xcommerce-gists
xcommerce-gists / item.phtml
Created January 21, 2014 19:17
Sample Magento template to display an individual news article
<?php
/**
* News template for separate item
*
* @author Magento
*/
/**
* @var $this Magentostudy_News_Block_Item
* @see Magentostudy_News_Block_Item
@xcommerce-gists
xcommerce-gists / list.phtml
Created January 21, 2014 19:16
Sample Magento template for the news article list view
<?php
/**
* News template for items list
*
* @author Magento
*/
/**
* @var $this Magentostudy_News_Block_List
* @see Magentostudy_News_Block_List