function fn_order_shipping_cost($order_info) { $cost = floatval($order_info['shipping_cost']) ? $order_info['shipping_cost'] : 0; if (floatval($order_info['shipping_cost']) && Registry::get('settings.General.tax_calculation') != 'unit_price') { $cost += fn_order_shipping_taxes_cost($order_info); } return $cost ? fn_format_price($cost) : 0; }
if ($mode == 'export_profiles') { header('Content-type: text/csv'); header('Content-disposition: attachment; filename=shop-customers' . date('Ymd') . '.txt'); foreach ($_REQUEST['user_ids'] as $k => $v) { $users[$k] = fn_get_user_info($v); } Tygh::$app['view']->assign('users', $users); Tygh::$app['view']->display('addons/myob/views/users/components/export_to_myob.tpl'); exit; } if ($mode == 'export_orders') { header('Content-type: text/csv'); header('Content-disposition: attachment; filename=shop-orders' . date('Ymd') . '.txt'); foreach ($_REQUEST['order_ids'] as $k => $v) { $orders[$k] = fn_get_order_info($v); $orders[$k]['shipping_tax'] = fn_order_shipping_taxes_cost($orders[$k]); $orders[$k]['order_date'] = date('j/n/Y', $orders[$k]['timestamp']); $orders[$k]['paid_amount'] = 0; //TODO: Update this! foreach ($orders[$k]['products'] as $ik => $iv) { $option_desc = ""; $desc_count = 0; if (!empty($orders[$k]['products'][$ik]['product_options'])) { foreach ($orders[$k]['products'][$ik]['product_options'] as $option_key => $option_value) { if ($desc_count > 0) { $option_desc .= ", "; } else { $option_desc = ' ('; } $option_desc .= $option_value['option_name'] . ' = ' . $option_value['variant_name']; $desc_count++;
$post_data['quantity'][] = 1; } } // Payment surcharge if (floatval($order_info['payment_surcharge'])) { $post_data['sku'][] = 'SURCHARGE'; $post_data['price'][] = $order_info['payment_surcharge']; $post_data['tax_amount'][] = 0; $post_data['description'][] = __('surcharge'); $post_data['quantity'][] = 1; } //Shipping cost if (fn_order_shipping_cost($order_info)) { $post_data['sku'][] = 'SHIPPING'; $post_data['price'][] = !empty($order_info['shipping_cost']) ? floatval($order_info['shipping_cost']) : 0; $post_data['tax_amount'][] = fn_order_shipping_taxes_cost($order_info); $post_data['description'][] = __('shipping_cost'); $post_data['quantity'][] = 1; } } else { $post_data['sku'][] = 'TOTAL'; $post_data['price'][] = $order_info['total']; $post_data['tax_amount'][] = 0; $post_data['description'][] = __('total_product_cost'); $post_data['quantity'][] = 1; } $result = Http::post($post_url, $post_data); // try another e-mail if you receive the FP_EXISTING_INVALID_CUSTOMER_STATUS error if (strpos($result, 'FP_') === false) { if ($processor_data['processor_params']['mode'] == 'T') { $script_url = 'https://demo.futurepay.com/remote/cart-integration/' . $result;