I have shipping tracking number that belongs to orders. I don’t want to insert these tracking numbers manually. I want to save theseautomatically by using correct function. Which function should I use to insert tracking numbers and send it to customer as emails?
What is the correct method to save this data?
Not: my codes is in [color=#282828][font=arial, verdana, tahoma, sans-serif]app/addons/MY_ADDON/controllers/frontend/[/font][/color][color=#282828][font=arial, verdana, tahoma, sans-serif]shipping_statuses.php[/font][/color]
[color=#282828][font=arial, verdana, tahoma, sans-serif]I think I should use fn_update_shipment() [/font][/color]function. BUt I don’t know how to use this function.
I found that problem is about fn_check_shipped_products() function. This function is used in fn_update_shipment() function. Because I cannot execute this fn_check_shipped_products() function data cannot be saved in DB.
I found that problem is about “amount field”. When I remove fn_check_shipped_products() checking from fn_update_shipment() function in fn.cart.php the data is saved into the DB. But after saving I checked “cscart_shipment_items” table and I saww that “amount” column is “0”. That's why while fn_check_shipped_products() function checks amounts fn_update_shipment() doesn't save data to DB.
Below is fn_check_shipped_products function in fn.cart.php
I found that problem is not about fn_check_shipped_products() function. I found that problem is about “$all_products = false” parameter in fn_update_shipment function or about “$use_shipments” variable.
if (!$use_shipments && $all_products) {
foreach ($order_info['product_groups'] as $group) {
foreach ($group['products'] as $item_key => $product) {
if (!empty($product['extra']['group_key'])) {
if ($group_key == $product['extra']['group_key']) {
$shipment_data['products'][$item_key] = $product['amount'];
}
} elseif ($group_key == 0) {
$shipment_data['products'][$item_key] = $product['amount'];
}
}
}
}
When I remove “if (!$use_shipments && $all_products) {” everything works correctly. [color=#282828][font=arial, verdana, tahoma, sans-serif]I checked “cscart_shipment_items” table. Values in “amount” are correct, not “0”.[/font][/color]
[color=#282828][font=arial, verdana, tahoma, sans-serif]So I need to understand what is “[/font][/color]$all_products”. What is the job of [color=#282828][font=arial, verdana, tahoma, sans-serif]“[/font][/color]$all_products”? What should I do?