Skip to content
vsushkov edited this page Feb 3, 2011 · 19 revisions

quick install

linux

  1. Download ZF (minimal package)
  2. Extract ZF archive somewhere like /home/username/lib/ZendFramework
  3. Create symbolic link to ZF: ln -s /home/username/lib/ZendFramework/bin/zf.sh /usr/local/bin/zf
  4. Execute zf --help and ensure it works
  5. Download mage tool archive
  6. Extract it to the library directory /home/username/lib/MTool
  7. On this step lib directory will contain ZendFramework and MTool
  8. Under the home directory create file ~/.zf
  9. Paste the following 2 lines inside:
    php.include_path=".:/home/username/lib/MTool:~/lib/ZendFramework/library:/usr/bin/pear" basicloader.classes.1 = "MtoolManifest"
  10. Execute zf info mtool to ensure it’s working
  11. Browse to the magento project root and then execute tool commands

windows

I did not have any luck installing zend tool on Windows.


module tools

create module

Syntax:
zf create mage-module
Will ask for:
company name: Company
module name: Mymodule

One line syntax:
zf create mage-module company/module

Will create: Folder app/code/local/Company/Mymodule/etc File config.xml with default content File app/etc/modules/Company_Mymodule.xml with default content

install module

Syntax: zf install mage-module Will ask for:

target module: mycompany/mymodule initial module version: 1.0.0

Oneline syntax: zf install mage-module mycompany/mymodule 1.0.0

Will create: Folder app/code/local/Company/Mymodule/sql/mycompany_mymodule_setup File mysql4-install-1.0.0.php with default content Entry with initial version in module config.xml file Entry with setup resource in config.xml file

upgrade module

Syntax: zf upgrade mage-module Will ask for:

target module: mycompany/mymodule how to upgrade (exact version r increment): ”to” or “inc” -- in case of “to” module version: 1.0.0 -- in case of “inc” increment version mask: ..1 - will increment to 1 in 3rd segment

Oneline syntax: zf upgrade mage-module mycompany/mymodule to 1.0.0 or zf upgrade mage-module mycompany/mymodule inc ..1

Will create: File mysql4-upgrade-x.x.x-y.y.y.php with default content Entry with new version in module config.xml file


entities tools

add model block helper

add model

Syntax: zf add mage-model Will ask for:

model path: mymodule/trololo_upyachka Oneline syntax: zf add mage-model mymodule/trololo_upyachka

Mage tool will try to automatically find local module with models namespace defined in the argument (mymodule). If such namespace will not be found in any local module mage tool will ask for the exact module and will create the namespace there. Will create: Folder app/code/local/Company/Mymodule/Model if not exist File app/code/local/Company/Mymodule/Model/Trololo/Upyachka.php with class content

add block

Syntax: zf add mage-block Will ask for:

block path: mymodule/trololo_upyachka Oneline syntax: zf add mage-block mymodule/trololo_upyachka

Mage tool will try to automatically find local module with blocks namespace defined in the argument (mymodule). If such namespace will not be found in any local module mage tool will ask for the exact module and will create the namespace there. Will create: Folder app/code/local/Company/Mymodule/Block if not exist File app/code/local/Company/Mymodule/Block/Trololo/Upyachka.php with class content

add helper

Syntax: zf add mage-helper Will ask for:

helper path: mymodule/trololo_upyachka Oneline syntax: zf add mage-helper mymodule/trololo_upyachka

Mage tool will try to automatically find local module with helpers namespace defined in the argument (mymodule). If such namespace will not be found in any local module mage tool will ask for the exact module and will create the namespace there. Will create: Folder app/code/local/Company/Mymodule/Helper if not exist File app/code/local/Company/Mymodule/Helper/Trololo/Upyachka.php with class content rewrite model block helper resource model action - coming soon


rewrite model

Syntax: zf rewrite mage-model Will ask for:

module: Company/Mymodule rewrite model path: catalog/product your model path (without namespace): catalog_product

Oneline syntax: zf rewrite mage-model company/mymodule catalog/product catalog_product

Will create: Folder app/code/local/Company/Mymodule/Model if not exist File app/code/local/Company/Mymodule/Model/Catalog/Product.php with class content Rewrite rules in the module config.xml

rewrite block

Syntax: zf rewrite mage-block Will ask for:

module: Company/Mymodule rewrite block path: catalog/product_view your block path (without namespace): catalog_product_view

Oneline syntax: zf rewrite mage-block company/mymodule catalog/product_view catalog_product_view

Will create: Folder app/code/local/Company/Mymodule/Block if not exist File app/code/local/Company/Mymodule/Block/Catalog/Product/View.php with class content Rewrite rules in the module config.xml

rewrite helper

Syntax: zf rewrite mage-helper Will ask for:

module: Company/Mymodule rewrite helper path: customer/data your helper path (without namespace): customer_data

Oneline syntax: zf rewrite mage-helper company/mymodule customer/data customer_data

Will create: Folder app/code/local/Company/Mymodule/Helper if not exist File app/code/local/Company/Mymodule/Helper/Customer/Data.php with class content Rewrite rules in the module config.xml

rewrite resource model

Syntax: zf rewrite mage-rmodel Will ask for:

module: Company/Mymodule rewrite model path: catalog/product_collection your model path (without namespace): catalog_product_collection

Oneline syntax: zf rewrite mage-rmodel company/mymodule catalog/product_collection catalog_product_collection

Will create: Folder app/code/local/Company/Mymodule/Model if not exist File app/code/local/Company/Mymodule/Model/Catalog/Product/Collection.php with class content Rewrite rules in the module config.xml


create (it’s just a bit more strict form of add) model block helper action - coming soon

create model

Syntax: zf create mage-model Will ask for:

module: Company/Mymodule model path: mymodule/trololo_upyachka

Oneline syntax: zf create mage-model company/mymodule mymodule/trololo_upyachka

Will create: Folder app/code/local/Company/Mymodule/Model if not exist File app/code/local/Company/Mymodule/Model/Trololo/Upyachka.php with class content Models namespace mymodule in the module config.xml if not exists

create block

Syntax: zf create mage-block

Will ask for:

module: Company/Mymodule block path: mymodule/trololo_upyachka

Oneline syntax: zf create mage-block company/mymodule mymodule/trololo_upyachka

Will create: Folder app/code/local/Company/Mymodule/Block if not exist File app/code/local/Company/Mymodule/Block/Trololo/Upyachka.php with class content Blocks namespace mymodule in the module config.xml if not exists

create helper

Syntax: zf create mage-helper Will ask for:

module: Company/Mymodule helper path: mymodule/trololo_upyachka

Oneline syntax: zf create mage-helper company/mymodule mymodule/trololo_upyachka

Will create: Folder app/code/local/Company/Mymodule/Helper if not exist File app/code/local/Company/Mymodule/Helper/Trololo/Upyachka.php with class content Helpers namespace mymodule in the module config.xml if not exists

Clone this wiki locally