Remove custom category attribute Magento
<?php
$this->startSetup();
$this->removeAttribute('catalog_category', 'show_line_name');
$this->endSetup();
?>
How to enable flat catalog categories
Edit getShippingDescription() Magento
1) Change the directory to magento installation
2) cd app/code/core/Mage/Sales/Model/Quote/Address/Total
3) vi Shipping.php
Edit the code at the line number 168
Create Custom Category Attribute Dropdown Magento
1)Change the directory to the root of magento installation
2) vi app/etc/modules/Pcode_Attribute.xml and paste the below given content
<config>
<modules>
<Pcode_Attribute>
<active>true</active>
<codePool>local</codePool>
</Pcode_Attribute>
</modules>
</config>
3) mkdir app//code/local/
4) mkdir app//code/local/Pcode
5 )mkdir app//code/local/Pcode/Attribute
6) mkdir app//code/local/Pcode/Attribute/etc
7) mkdir app//code/local/Pcode/Attribute/sql
8) mkdir app/code/local/Pcode/Attribute/sql/categoryattribute_setup
9) vi app/code/local/Pcode/Attribute/sql/categoryattribute_setup/mysql4-install-0.1.0.php and paste the below given code
<?php
$this->startSetup();
$this->addAttribute('catalog_category', 'show_line_name', array(
'group' => 'General Information',
'input' => 'select',
'type' => 'int',
'label' => 'Show Line Name',
'backend' => '',
'visible' => true,
'required' => false,
'wysiwyg_enabled' => true,
'visible_on_front' => true,
'source' => 'eav/entity_attribute_source_boolean',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
$this->endSetup();
?>
10) vi app//code/local/Pcode/Attribute/etc/config.xm and paste the below code
<?xml version="1.0"?>
<config>
<modules>
<Pcode_Attribute>
<version>0.1.0</version>
</Pcode_Attribute>
</modules>
<global>
<resources>
<categoryattribute_setup>
<setup>
<module>Pcode_Attribute</module>
<class>Mage_Eav_Model_Entity_Setup</class>
</setup>
<connection>
<use>default_setup</use>
</connection>
</categoryattribute_setup>
</resources>
</global>
</config>
Show category name along with product name on listing page Magento
<?php
$cat = $_product->getCategoryIds();
echo Mage::getModel("catalog/category")->load($cat[0])->getName();
?>
Remove wishlist link Magento
Comment the below given line in enterprise_wishlist.xml
<!--action method="addLinkBlock"><blockName>wishlist_link</blockName></action-->
Disable Magento Compiler
You can disable the compiler in two ways
1) Go to System > Tools > Compilation page and click on Disable button
2) Change directory to the magento installation location .then type the below given commands
php -f shell/compiler.php -- disable
php -f shell/compiler.php -- clear
How to read the current logged in admin details - Magento
<?php
Mage::getSingleton('core/session', array('name' => 'adminhtml'));
$session = Mage::getSingleton('admin/session');
if ( $session->isLoggedIn() ){
echo "Admin is logged in";
}
?> Event and Observer in Magento
Magento has been programmed to use Event-Observer methodology and can raise events in crucial areas of the flow.
Observer is the event handler and it allows us to add our own logic in adition to the core logic without modifying the core code .
Event: An Event is something that occurs in a certain place during a particular sequence flow.
Observer : An Observer is an event handler. It listens to any event it is attached to and accordingly reacts to the event.

