mag1cs7ar LiteCart Fan Nuo Bulgaria Narys nuo bal. 2022 mag1cs7ar 12 vas. 2023 20:13 Hello. I am updating a shipping module, and in the module I have also added a tracking URL, default for the specific Module. My question is: How to automatically add a tracking URL to the database after a user makes an order. Now the addition is done only from the Admin panel, I want to make it take information from the Delivery Module, and automatically add it to the database, depending on which module the customer has chosen. I will explain it clearly with pictures In the module I have added to enter URL and output via: $options[] = [ 'id' => 'zone_'.$i, ............... [b] 'tracking_url' => $this->settings['tracking_url'],[/b] 'tax_class_id' => $this->settings['tax_class_id'], .................... ]; [b][i][u]Picture 1[/u][/i][/b] When a customer places an order and completes it from [b][i][u]Picture 2[/u][/i][/b], should the tracking URL information be sent and saved to the database? [b][i][u]Picture 3[/u][/i][/b]
mag1cs7ar LiteCart Fan Nuo Bulgaria Narys nuo bal. 2022 mag1cs7ar 12 vas. 2023 22:11 It is about this module. You can browse and get more information. https://www.litecart.net/en/addons/498/delivery-with-econt
tim Founder Nuo Sweden Narys nuo geg. 2013 tim 13 vas. 2023 13:45 As of LiteCart 2.5.2 shipping modules have after_process(): $order->data['shipping_tracking_url'] = ...; $order->save(); }```
mag1cs7ar LiteCart Fan Nuo Bulgaria Narys nuo bal. 2022 mag1cs7ar 13 vas. 2023 15:15 Thank you! I do it!
s22_tech Moderator Nuo United States Narys nuo spal. 2019 s22_tech 18 vas. 2023 17:32 @tim Are you saying that this: database::query( 'UPDATE '.DB_TABLE_ORDERS." SET `shipping_account_num` = '". database::input($this->userdata['shipping_account_num']) ."', `shipping_method_ux` = '". database::input($this->userdata['shipping_method_ux']) ."' WHERE `id` = '". (int)$order->data['id'] ."' LIMIT 1;" ); }``` can now be replaced with this? ```function after_process($order) { $order->data['shipping_account_num'] = database::input($this->userdata['shipping_account_num']); $order->data['shipping_method_ux'] = database::input($this->userdata['shipping_method_ux']); $order->save(); }```
tim Founder Nuo Sweden Narys nuo geg. 2013 tim 19 vas. 2023 21:29 I forgot to mention you will have to modify ent_order.inc.php to handle these custom fields. But once you do, that approach should work.
s22_tech Moderator Nuo United States Narys nuo spal. 2019 s22_tech 19 vas. 2023 21:50 That adds an extra level of complexity in my situation. I think I'll stick with going directly to the db, since I hate having code spread across multiple files, if there's a way to avoid it. Too bad there's not a way to have the shipping module automatically input custom fields for you. Hint, hint. : )
tim Founder Nuo Sweden Narys nuo geg. 2013 tim 20 vas. 2023 10:01 [quote]if there's a way to avoid it.[/quote] That would be a vmod patch. [quote]Too bad there's not a way to have the shipping module automatically input custom fields for you. Hint, hint. : )[/quote] If you have a concept that solves this, I'm all ears.