ed0522 Posted August 3, 2015 Share Posted August 3, 2015 (edited) <?php class AuthController extends AuthControllerCore { protected function processSubmitCreate() { $customer = new Customer(); $customer->nickname =Tools::getValue('nickname'); parent::processSubmitCreate(); } } I wrote codes like this, but I don't know how to save the value in to the object model. I tried to load the Customer.php use require(), but it showed faults. Could somebody help me? I'm still confusing how the object model works here. I know how to build object model in a module. But here seems different. Image 001.bmp Edited August 4, 2015 by ed0522 (see edit history) Link to comment Share on other sites More sharing options...
presta.show Posted August 7, 2015 Share Posted August 7, 2015 Hi, You have to modify class Customer to add new public var like name your input, and add item in array definition like below public $newItemName; public static $definition = array( 'table' => 'customer', 'primary' => 'id_customer', 'fields' => array( ... 'newItemName' =>array('type' => self::TYPE_STRING), ), ); Next you have to modify table customer to add new column in your database. Then you can add Code to save or update everywhere you want with code like bellow: $customer = new Customer(); $customer->newItemName=Tools::getValue('newItemName'); $customer->save(); Link to comment Share on other sites More sharing options...
ed0522 Posted August 7, 2015 Author Share Posted August 7, 2015 I added public var and filed in customer class. This is my codes. <?php class AuthController extends AuthControllerCore { protected function processSubmitCreate() { $customer = new Customer(); $customer->nickname=Tools::getValue('nickname'); $customer->save(); } } but it shows mistake like this: TECHNICAL ERROR: unable to load form. Details: Error thrown: [object Object] Text status: error Link to comment Share on other sites More sharing options...
presta.show Posted August 7, 2015 Share Posted August 7, 2015 But object customer require set more params of columns, Look at defined array and required value, or structure table in database. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now