mag1cs7ar LiteCart Fan Fra Bulgaria Medlem siden apr. 2022 mag1cs7ar feb. 12 2023 08:13 p.m. 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 Fra Bulgaria Medlem siden apr. 2022 mag1cs7ar feb. 12 2023 10:11 p.m. It is about this module. You can browse and get more information. https://www.litecart.net/en/addons/498/delivery-with-econt
tim Founder Fra Sweden Medlem siden mai 2013 tim feb. 13 2023 01:45 p.m. As of LiteCart 2.5.2 shipping modules have after_process(): $order->data['shipping_tracking_url'] = ...; $order->save(); }```
mag1cs7ar LiteCart Fan Fra Bulgaria Medlem siden apr. 2022 mag1cs7ar feb. 13 2023 03:15 p.m. Thank you! I do it!
s22_tech Moderator Fra United States Medlem siden okt. 2019 s22_tech feb. 18 2023 05:32 p.m. @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 Fra Sweden Medlem siden mai 2013 tim feb. 19 2023 09:29 p.m. 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 Fra United States Medlem siden okt. 2019 s22_tech feb. 19 2023 09:50 p.m. 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 Fra Sweden Medlem siden mai 2013 tim feb. 20 2023 10:01 a.m. [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.