I have wasted my lot of time while developing on magento. its only because i was not following some basic things needed before you start development on magento. In my opinion if you follow these 4 tips you should be okay![break][/break]
1.) DISABLE CACHE : This is the first requirement before you start development on magento. I have seen many people struggling and wondering why their changes are not visible. I also read somewhere that on an average a new developer spends around 2 hours on magento platform wondering why his changes are not visible.
To disable cache
- Go to System > Cache Management
- Click on Select All(on left).
- Select disable from Action dropdown(on right).
- And Click on Submit.
2.) Enable Logging:
You might need this, as often which writing php code if you miss some braces or use a function which does not exist you will get error something like this:-
There has been an error processing your request Exception printing is disabled by default for security reasons. Error log record number: XXXXXXXXXXXXXXX
In this case you might want to check the DB for error log number, but best thing is to enable exception prininting
To enable exception printing
- Go to <magento-installation-dir>/errors folder
- rename local.xml.sample file local.xml
3.) PHP Methods:
Once in a while you might come across an object and you might want to know what all functions exists for that object, one way is to go to the file(you might know where that file is) or the second easier option is to print all the methods in that object. Just add this code in your php file
1 2 3 4 5
<?php echo ‘<pre>’; print_r(get_class_methods($collection)); echo ‘</pre>’; ?>
4.) Printing whole object:
You might want to know what values exist in that object then you can use one of the below
<?php print_r($obj); OR print_r($obj->toArray()); ?>
If you think that this post helped you in any way, please do write a review or link to this page. Thanks!