Question

When you guys are doing mysql joins on product and category collections how do you plan/deal with the differences in eav and flat collection?

The main thing i see is that eav using 'e' for the column name whereas flat uses main_table.

Am i correct in stating that to have a single join work in both situations I must check first if flat is enabled in order to provide the correct collumn name?

Or am i not understanding something correctly?

Was it helpful?

Solution

Alan does a good job explaining this:

Be careful if you are including EAV data into your flat collection as you'll notice a performance drop. It is best to include the data you are needing as apart of the flat catalog indexing.

In short, checking the helpers before hand and conditioning your collections then.

Categories

 if (Mage::helper('catalog/category_flat')->isEnabled()) {

Products

if (Mage::helper('catalog/product_flat')->isEnabled()) {
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top