Posts

Magento Customer Address Entity

The Magento customer address entity is found in the database as a customer_address entity type found in the eav_entity_type table.
Similar to how customer attributes are created, we can use setup scripts from a custom module to add, modify or remove customer address attributes from the database.
First, the module’s declaration file needs to be ...

Magento Shopping Cart Price Rules

The functionality behind Magento shopping cart price rules is within the Mage_SalesRule module.
Shopping cart price rules can be configured within Magento in the admin under Promotions -> Shopping Cart Price Rules. These rules differ from the catalog rules as they apply to the quote, whereas catalog rules apply to the catalog information about the ...

Magento Quotes

A quote in Magento is effectively the contents of a customer’s cart before it is converted into an order.
The quote model class used for Magento quotes is the Mage_Sales_Model_Quote class.
Quotes are saved in Magento in the sales_flat_quote table and are first saved when the customer adds their first product to the cart.

Magento Admin Order Creation

As well as customers placing an order and going through the checkout, the Magento merchant has the ability to create orders in the admin area in the Sales -> Orders section.
You are then presented with a screen to choose a customer to associate the order to. The next step is then to specify the ...

Magento Price Generation

When viewing a product page in Magento, its price is rendered by a method in its view.phtml template.
The getPriceHtml() method belongs in the Mage_Catalog_Block_Product_Abstract class and contains the following.
The _preparePriceRenderer() method returns us the product block type and the block template.
The _getPriceBlock() method is as follows.
And the _getPriceBlockTemplate() method can be ...

Magento Catalog Price Rules

You may be familiar with setting up Magento Catalog Price Rules in the admin area. But how does Magento save this information behind the scenes? And how does it check to see if a rule is applied and therefore calculate the discount?
There a few tables Magento uses to save rule information.


catalogrule ...

Magento Category Structure

Within Magento, a merchant has the ability to configure multiple root categories within the admin and add subsequent subcategories beneath these.

If we take a look at these records in the database, we can see that there are actually 5 rows instead of 4 that we would expect.

The first entity ID seems ...

Magento Collection Manipulation

We can load Magento collections a couple of ways. As an example, if we take a look at the loading the catalog product collection, the following two lines would bring back the collection.
Collection classes inherit from Mage_Core_Model_Resource_Db_Collection_Abstract that in turn inherits from Varien_Data_Collection_Db that inherits from Varien_Data_Collection
The Varien_Data_Collection_Db class contains some useful methods.

Magento Data Scripts

Magento data scripts that are located within the modules’ data directory were introduced in Magento Community/Open Source version 1.6.
The naming convention for the data script files have a similar naming convention to setup scripts that are found within the modules’ sql directory.
The data file names themselves are proceeded with a data- prefix.

Magento Create Widget

Widgets are found within the admin when you first go to add a widget instance under CMS -> Widgets. The default widget types for Magento Community/Open Source Edition can be seen below.

CMS Page Link
CMS Static Block
Catalog Category Link
Catalog New Products List
Catalog Product Link
Orders and Returns
Recently Compared Products