magento - a zend framework application
DESCRIPTION
Talk by Dmitriy Soroka at ZendCon 2009TRANSCRIPT
Apr 11, 2023 | 1 |
ZendCon 2009
Magento – a Zend Framework application
By Dmitriy SorokaSystem Architect at Varien
Apr 11, 2023 | 2 |
Magento
Apr 11, 2023 | 3 |
Magento today
• 1,000,000+ downloads • ~70 core modules in Community Edition and ~20 in Enterprise Edition
• Magento Core Team• Magento community• Magento connect
Apr 11, 2023 | 4 |
Magento under the hood
• PHP 5• OOP (MVC)• Zend Framework• Modular Architecture
Apr 11, 2023 | 5 |
Select Magento Platform
Frameworks CMS/CMF Systems E-Commerce
• Zend Framework• CakePHP• CodeIgniter• Symfony• etc.
• Joomla• Drupal• EZ Publisher• Mambo• etc.
• osCommerce• VirtueMart• Zen-Cart• xCart• etc.
Apr 11, 2023 | 6 |
Going with the Zend Framework
• MVC architecture• Good documentation• Robust functionality• Comunity• Zend - the PHP company• Fast growth• PHP applications standard ZF based application provides clear
understanding for PHP developers
• Clear development process and ability to contribute custom components
Apr 11, 2023 | 7 |
Zend Framework Functionality
• Application Level ComponentsZend_Controller, Zend_View, Zend_Layout, Zend_Form etc.
• Localization/Internationalization Level ComponentsZend_Locale, Zend_Date, Zend_Currency, Zend_ Measure, Zend_Translate
• Data Level ComponentsZend_Db, Zend_Dom, Zend_Feed, Zend_Search etc.
• ServicesZend_Gdata, Zend_Services, Zend_Soap etc.
• Zend_Controller
• Zend_View
• Zend_Config
• Zend_Application (since 1.8.0!)
Apr 11, 2023 | 8 |
ZF components currently not used in Magento
Apr 11, 2023 | 9 |
Magento Controller
• Support multiple module routing
• Internal URL rewrite logichttp://domain.com/product.html => catalog/product/view/id/1
• Additional entry points Magento events
Apr 11, 2023 | 10 |
View level: Page Layout
Apr 11, 2023 | 11 |
View level: Blocks page structure
Apr 11, 2023 | 12 |
View level: Multiple themes support
Apr 11, 2023 | 13 |
ZF components used in Magento
• About 15 ZF components are currently used
• We plan to use ~10 more components
• Goal – to use as many native ZF components as possible
Apr 11, 2023 | 14 |
Zend_Acl
Apr 11, 2023 | 15 |
Zend_Cache: backend models
• Files• APC (shared memory)• Memcached
• eAccelerator
• Xcache• ZendPlatform• ZendServer
Apr 11, 2023 | 16 |
Zend_Cache: single server installation
Apr 11, 2023 | 17 |
Zend_Cache: multiple frontends
Apr 11, 2023 | 18 |
Zend_Db
• Zend_Db_AdapterAllows for integrating with different DB storage
Simplifies data managing operations
• Zend_Db_Select
Apr 11, 2023 | 19 |
Zend_Locale, Zend_Date, Zend_Currency
Apr 11, 2023 | 20 |
Multiple locales support
Apr 11, 2023 | 21 |
Other ZF components in Magento
• Zend_Pdf• Zend_Feed• Zend_Mail• Zend_Validate• Zend_Filter
Apr 11, 2023 | 22 |
Coming Soon
• Zend_Application• Zend_Crypt• Zend_Form• Zend_Layout• Zend_Measure• Zend_Navigation• Zend_Paginator• Zend_Tag• …
Apr 11, 2023 | 23 |
Zend_Form
• Customer attributes as form fields • Form validation and filtering is easy• Integration with display logic
Apr 11, 2023 | 24 |
ZF application and Magento Application
ZF Application Magento Applicationapplication/ configs/ controllers/ layouts/ models/ modules/ services/ views/ Bootstrap.phpdata/ locales/ uploads/library/public/ css/ images/ js/ .htaccess index.phpscripts/ jobs/ build/temp/tests/
app/ code/ community/ core/ Mage/ .. modules local/ design/ adminhtml/ frontend/ install/ etc/ locale/js/lib/ Varien/ Zend/media/skin/ adminhtml/ frontend/ install/var /
Apr 11, 2023 | 25 |
ZF Module and Magento module structure
ZF Module Magento Module<modulename> configs/ controllers/ forms/ layouts/ filters/ helpers/ scripts/ models/ services/ views/ filters/ helpers/ scripts/ Bootstrap.php
<modulename> Block/ controllers/ etc/ Helper/ Model/ Sql/
Apr 11, 2023 | 26 |
Module Dependency
Apr 11, 2023 | 27 |
Module Dependency
• Dependency is specified in module declaration (app/etc/modules/*.xml)
• Dependency determines the order in which the database is built/updated
Example: <config> <modules> <Mage_Bundle> <active>true</active> <codePool>core</codePool> <depends> <Mage_Catalog /> </depends> </Mage_Bundle> </modules></config>
Apr 11, 2023 | 28 |
Module Installation and Upgrade
• Code Pools
/app/code/core/community/local/
• Configurationmodels, blocks, helpers
Apr 11, 2023 | 29 |
Overwriting Magento
Class overwriting (Model Example)• Create new module
(Ex: local/MyProject/MyModule)
• Create class for your model customization (Ex: MyProject_MyModule_Model_Customer extends
Mage_Customer_Model_Customer)
• Add overwriting instructions to config.xml <config>
<global> <models> <customer> <rewrite> <customer>MyProject_MyModule_Model_Customer</customer> </rewrite>
• Overwrite needed methods in your class• Now Mage::getModel('customer/customer') => new MyProject_MyModule_Model_Customer
Apr 11, 2023 | 30 |
Overwriting Core Model
Apr 11, 2023 | 31 |
http://www.magentocommerce.com