Magento themes and extensions

How to show additional fields in magento abandoned carts grid

Share

Magento Abandoned carts report gives the list of customers who have added products to the shopping cart and logged out without placing orders, the products they placed will still be in their cart. Abandoned carts report will be shown as a grid in admin panel. This report notifies the store owner about the customers who have abandoned their carts, later the store admin can inform to the respective customer and make them clear their cart.
Recently I got a client requirement to show the customer telephone field in the abondoned cart grid. As it will be useful for the admin to call customers and alert them to complete their orders.

To add additional field to abandoned carts

Step 1: Copy the file app\code\core\Mage\Adminhtml\Block\Report\Shopcart\Abandoned\Grid.php to the local directory app\code\local\Mage\Adminhtml\Block\Report\Shopcart\Abandoned\Grid.php. Whenever a Core file is copied to the local directory structure, the file included in the local directory will get preference and it will be taken.

Step 2: Now in the _prepareCollection method we need to join our additional field to the existing collection. A collection is an array of model class objects.

First we join our existing collection to customer entity int table to check if the customer has the default billing address and then we join our collection to the customer_address_entity_varchar table which contains the telephone field. Here the attribute id of telephone is 30 it is specified in the join condition, the condition will compare entity id of customer in main table and our alias table.
Step 3: Now we need to add our telphone field entry in our _preparecolumns method as shown below

Finally we get our output as shown below

Leave a Reply

You must be logged in to post a comment.