Categories
Programming

How to add custom filed to customers table in OpenCart – Admin panel

How to add custom filed to customers table in OpenCart?

OpenCart has many flaws, at least in version <2. Unlike WordPress for example there is no easy way to change core functionality with custom plugin without changing the source code. There is no pub/sub architecture for interrupting system events…

But if you need to add custom fields to custumer, here is code simple example for that in five simple steps.

Step 1

Add form html in admin panel :


// admin/view/template/sale/customer_form.tpl
// find <input name="firstname" type="text" value="<?php echo $firstname; ?>" />
// and add before :
<input name="#field_name#" type="text" value="<?php echo #field_name#; ?>" />