Wednesday, October 05, 2016

PrestaShop: Adding Fields to Admin Area Lists

When clients (or accountants ;->) call with questions about a particular order, they don't always have the order id or order reference numbers. In these cases, it's handy to be able to search by other fields.

The PrestaShop override mechanism make it easy to add fields to admin area lists without changing the core code. For example, to add lookup by Invoice #, Phone Number, and Postal Code to the orders list in the PresaShop Admin area, I only had to create the following file: /override/controllers/admin/AdminOrdersController.php

NOTE: Be sure to delete /cache/class_index.php after adding your new class!

class AdminOrdersController extends AdminOrdersControllerCore
    public function __construct()

        $this->fields_list['invoice_number'] = array(
            'title' => $this->l('Invoice #'),
            'align' => 'text-center',
            'class' => 'fixed-width-xs'
        $this->fields_list['phone_mobile'] = array(
            'title' => $this->l('Phone Number')
        $this->fields_list['postcode'] = array(
            'title' => $this->l('Zip/Postal code')

No comments: