110 likes | 304 Views
Magento. How to tutorial for Magento. Outline. How to setup sample data How to create new template How to create new module How to override default module controller How to do something after did something How to do cronjob How to deploy
E N D
Magento How to tutorial for Magento
Outline • How to setup sample data • How to create new template • How to create new module • How to override default module controller • How to do something after did something • How to do cronjob • How to deploy • How to create new attribute/attribute set for product • How to debug
Setup sample data • Sample data can be download from homepage • Must install sample first, then after that is Magento
Create new template • Clone • From “app\design\frontend\base\default” • To “app\design\frontend\default\<name>” • Clone • From “skin\frontend\base\default” • To “skin\frontend\default\<name>”
Create new module • http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/custom_module_with_custom_database_table • Template should be in “base/default” • Do not use __FILE__ • Use • MAGENTO_ROOT • Mage::getBaseDir($type = 'base')
Override default module controller • <config> • <frontend> • <checkout> • <args> • <module_controller_path before=“checkout”>module_controller_path</module_controller_path> • </args> • </checkout> • </frontend> • </config>
Do something after did something • Magento - Wiki - Customize Magento using Event/Observer • Observer class should be at Namespace_Module_Model_Observer • Some popular • Save after • Save before
Do cronjob • Namespace_Model_Model_Cronjob • Magento - Wiki - How to Set Up a Cron Job • Custom built for cronjob
Deploy • Clone git to a totally new folder “release-2.1.1” • Create new tag: for example “v.2.1.1” • Clone current database into new dump-database • Copy basic magento files into “release-2.1.1” • Copy local.xml from “live” to “release-2.1.1” • Change database name in local.xml from “release-2.1.1” • Test it • If success, change database name back to live • Link the “public_html” to “release-2.1.1”
create new attribute/attribute set for product • New attribute must be created via code (setup_script) • Attribute must be placed in attribute set • Product attribute’s attribute meanning
Debug • Enable log • Disable cached • Mage::log( $message, $level = null, $file = '', $forceLog = false) • Mage::logException($e) • Enable error view