2. Me
• Jira ICT
– Training in Magento, Joomla! & Drupal
– Consult regarding implementation, security, architecture, etc
– Some other things like open source
• Jisse Reitsma (me)
– PHP programming (Magento, Joomla! & Drupal)
– System administrator
– Security consultant
– Writer of “Joomla!-templates ontwerpen”-book
Jisse Reitsma (www.jira.nl) @Dutch Magento Day 2
3. Steps
• Rename “PayPal” to “123betaal”
– Package name “Jira”
– Module name “123Betaal”
– Total name “Jira_123Betaal”
• Debug everything that does not work
• Re-check functionality
Jisse Reitsma (www.jira.nl) @Dutch Magento Day 3
4. Debugging
In general
Read before you start
White Screen Of Death
PHP Fatal Errors
Regular PHP debugging
Specific problems
Garbled output because of XML syntax
Legal but non-usable XML caused the buffer to go crazy
The “Comment Everything” strategy
Model-class not found
Using a different name-base then Mage_*
Opening up the Magento source
Jisse Reitsma (www.jira.nl) @Dutch Magento Day 4
5. php|architects Guido to Prog. with Magento
• A very small book for a very complex application
• Requires a good understanding of Object-Oriented Programming
Jisse Reitsma (www.jira.nl) @Dutch Magento Day 5
6. White Screen Of Death
• ... or read the PHP Fatal Error from the screen
• ... or read the Apache error-log
• Check the syntax of your PHP-code
• Check the syntax of your Magento-specific code
• RTFM (“Read The Fine Manual”)
Jisse Reitsma (www.jira.nl) @Dutch Magento Day 6
7. Garbled output because of XML syntax
Problem: When going to the “Settings” screen, instead of HTML
something half compressed(?) is shown, but no error is logged.
• Conclusion 1: The problem lies in a XML error.
• Debug method: Comment everything but X
• Conclusion 2: <123betaal> is causing the problem, because the
variable $123betaal can not exit
• Solution: Rename “123betaal” to “betaal123”
Jisse Reitsma (www.jira.nl) @Dutch Magento Day 7
8. Model “Mage_Jira_Betaal123” not found (1)
Problem: XML in “system.xml” contains a <source_model>-tag defining
“betaal123/source_paymentAction” as PHP-class to fill the parameter
in question with options. The final PHP-class that should be called is
“[local]Jira_Betaal123_Model_Source_PaymentAction” but instead
Magento tries to call “[*]Mage_Jira_Model_123Betaal” which does not
exist.
• Debug method: Read all the PHP source-code involved
Jisse Reitsma (www.jira.nl) @Dutch Magento Day 8
9. Model “Mage_Jira_Betaal123” not found (2)
• Mage_Adminhtml_Block_System_Config_Form::initFields()
• Mage::getSingleton()
• Mage::getModel()
• Mage_Core_Model_Config::getModelInstance()
• Mage_Core_Model_Config::getModelClassName()
• Mage_Core_Model_Config::getGroupedClassName()
• PROBLEM FOUND!
Cause: <source_model> can never refer to a base-name other than
Mage_* (for instance Jira_Betaal123)
Solution: Rename “Jira_Betaal123” to “Mage_Betaal123”
Jisse Reitsma (www.jira.nl) @Dutch Magento Day 9
10. Copying module from server1 to server2
• Copy all files through a ZIP-patch
• Refresh “Admin” page
• Huh, nothing happens?
• Disable Cache
• Refresh “Admin” page
• (no database action needed!)
• It works
Jisse Reitsma (www.jira.nl) @Dutch Magento Day 10
11. Conclusions
• Debugging requires a solid understanding of Object-Oriented PHP
• Debugging takes more time because of the complex object-hierarchy
within the Magento core
• Third party packages can still cause (wierd) problems
Jisse Reitsma (www.jira.nl) @Dutch Magento Day 11