Database Schema
This site shows details of the Magento database schema for differing versions - it shows foreign key relationships in a nice drag-and-drop interface
Related cards:
Fetching All Attributes For An Entity From The DB In One Query
Using the database to inspect EAV-based entity types can be a real pain in the ass, so here are a bunch of queries that let you inspect some popular EAV entity types easily. This practice can be applied to any EAV entity type, however as there are...
Stock Availability on Credit Note, Cancellation and Payment Deny
In summary - making a credit memo can increase the stock quantity but will never set the "Stock Availability" of the product to "In Stock", whereas a config option can control whether an order cancellation sets "In Stock" automatically. Denying a ...
Formatting A Price For The Current Locale
$price = 500;
$formattedPrice = Mage::helper('core')->currency($price, true, false);
Getting A Products URL
Potentially confusing due to the 3 methods you could use, all of which are in Mage_Catalog_Model_Product
:
public function getUrlPath($category=null)
public function getUrlInStore($params = array())
public function getProductUrl($use...
Add A Tab To The Admin Product Screen
Declare an admin layout XML file for your module in your config.xml
:
<config>
<adminhtml>
<layout>
<updates>
<your_module>
<file>your-module.xml</file>
...
Messages and Global Messages Blocks
Both use the same block, as we can see in page.xml
:
<block type="core/messages" name="global_messages" as="global_messages"/>
<block type="core/messages" name="messages" as="messages"/>
When you add a message, you add it to the session...
Magento Version History
Here is a table showing major changes over the Magento version history:
| CE | PE | EE | Year | Major Changes ...
Get Methods of Class
Yes, very dirty, but it works a treat! Save this file in your Magento root directory, then fire up a command line and run whatever.php Mage_Core_Model_App
(or some other class) and you should see the output.
Output looks like below:
$ ./cl...
Creating a Datetime attribute that stores time
Magento has a Datetime backend model but formats a Zend_Date
object without the time. So if you want to store datetime (actually with time) you will need to setup your own backend model.
Here is how i've done it:
class Namespace_Module_Mod...
Limiting The Number of Autocomplete Results
SweetTooth details how to limit the number of autocomplete entries, as by default this list is not limited whatsoever, not good on a store with lots of products!
![](http://mikewhitby.co.uk/makandra-track.gif?a=limiting-the-number-of-autocomplete...