kalenjordan / custom-reports

Custom Magento reports using SQL
http://magemail.co/free-custom-reports-module-for-magento/
Other
143 stars 65 forks source link

Order in which columns are displayed on the grid is not the same as in the SQL statement #64

Open AlBalz opened 8 years ago

AlBalz commented 8 years ago

For example: SELECT catalog_product_entity.sku as 'SKU', Substring(catalog_product_entity_varchar.value,1,200) as "Product Name", Format(catalog_product_entity_decimal.value,2) as 'Cost Each', Format(cataloginventory_stock_item.qty,0) as 'Qty.', Format((catalog_product_entity_decimal.value * cataloginventory_stock_item.qty),2) as "Total Cost" FROM catalog_product_entity LEFT JOIN catalog_product_entity_decimal
ON catalog_product_entity.entity_id = catalog_product_entity_decimal.entity_id LEFT JOIN cataloginventory_stock_item ON catalog_product_entity.entity_id = cataloginventory_stock_item.product_id LEFT JOIN catalog_product_entity_varchar ON catalog_product_entity.entity_id = catalog_product_entity_varchar.entity_id WHERE catalog_product_entity_decimal.attributeid = 79 /* 79 = Cost / AND catalog_product_entity_varchar.attributeid = 71 / 71 = Name */ AND cataloginventory_stock_item.qty > 0 AND catalog_product_entity_decimal.store_id = 0 AND catalog_product_entity_varchar.store_id = 0 ORDER BY SKU

According to this query, the columns should be ordered as follows: SKU, Product Name, Cost Each, Qty and Total Cost. However, they (usually) come up ordered as SKU, Cost Each, Qty, Total Cost and Product Name. I say "usually" because sometimes they come up with a different order too, no matter how you change the order of the columns in the query.

So, my question is: How to control the order in which the columns are actually displayed on the grid?

uncenteredDiv commented 8 years ago

Same Problem here.

dtamajon commented 7 years ago

It can happen if you have BL_CustomGrid module. Check #68.