jamie Developer Fra Hungary Medlem siden jul. 2017 jamie okt. 4 2021 12:15 p.m. Hello! The code below is on the wiki page. return array( 'title' => $this->name, 'options' => array( array( 'id' => 'option_1', 'icon' => $this->settings['icon'], 'name' => 'Option 1', 'description' => 'This is the description for option 1', 'fields' => '<input type="text" name="foo" value="'. @$this->userdata['foo'] .'" />' . PHP_EOL . '<input type="text" name="bar" value="'. @$this->userdata['bar'] .'" />', 'cost' => $this->settings['fee_1'], 'tax_class_id' => $this->settings['tax_class_id'], 'exclude_cheapest' => false, ), ), ); }``` The custom field appears on the checkout page and can be filled out. But how do I see this on the orders page? How can I record this so I can see it when editing my order?
tim Founder Fra Sweden Medlem siden mai 2013 tim okt. 4 2021 02:40 p.m. The next version 3.0 will save the shipping user data to the order. But for 2.x you would need to process this data yourself in the module. You should be able to access the data using $_POST['myvar'] in select() and after_process().
jamie Developer Fra Hungary Medlem siden jul. 2017 jamie okt. 4 2021 02:52 p.m. Thanks Tim! Not showing the current version 3.0 yet? I do not see the completed field when ordering.
tim Founder Fra Sweden Medlem siden mai 2013 tim okt. 5 2021 02:38 a.m. I am working hard to get a public beta out for 3.0. Maybe within weeks. Did you try something like this? $order->data['comments'][] = [ 'text' => 'Value of myvar:' . $_POST['myvar'], ]; $order->save(); }
jamie Developer Fra Hungary Medlem siden jul. 2017 jamie okt. 5 2021 12:50 p.m. Yes I tried and this too but it doesn't go through. database::query( 'UPDATE '.DB_TABLE_ORDERS." SET `foo` = '". database::input($this->userdata['foo']) ."', `bar` = '". database::input($this->userdata['bar']) ."' WHERE id = '". (int)$order->data['id'] ."' LIMIT 1;" ); }```
tim Founder Fra Sweden Medlem siden mai 2013 tim okt. 9 2021 06:10 p.m. Did you get an error or did it just simply not set any data? What does this show?: var_dump($this->userdata); exit;
jamie Developer Fra Hungary Medlem siden jul. 2017 jamie okt. 11 2021 08:43 a.m. So far nothing has been shown, now there is an error message: Fatal error: 1054 - Unknown column 'foo' in 'field list' UPDATE lite4.lc_orders SET foo = 'test1', bar = 'test2' WHERE id = '6' LIMIT 1; in ~/includes/library/lib_database.inc.php (Line 260)
tim Founder Fra Sweden Medlem siden mai 2013 tim okt. 11 2021 11:46 p.m. Oh wait.. you can't actually input 'foo' and 'bar' as column names. That's a dummy example 😆. Create the column and put the real name in.