function fn_gift_certificates_paypal_express_get_order_data(&$data, &$order_data, &$product_index) { if (!empty($data['gift_certificates'])) { foreach ($data['gift_certificates'] as $cart_id => $gift_certificate) { if (!empty($gift_certificate['extra']) && isset($gift_certificate['extra']['exclude_from_calculate']) && $gift_certificate['extra']['exclude_from_calculate'] == 'PR') { //Gift certificate was added as bonus with promotion continue; } $order_data['L_PAYMENTREQUEST_0_NAME' . $product_index] = __('gift_certificate'); $order_data['L_PAYMENTREQUEST_0_NUMBER' . $product_index] = $cart_id; $order_data['L_PAYMENTREQUEST_0_DESC' . $product_index] = fn_paypal_substr(fn_paypal_express_get_certificate_data($gift_certificate)); $order_data['L_PAYMENTREQUEST_0_QTY' . $product_index] = 1; $order_data['L_PAYMENTREQUEST_0_AMT' . $product_index] = $gift_certificate['amount']; $product_index++; } } }
function fn_paypal_get_order_data($data) { $order_data = array(); $product_index = 0; foreach ($data['products'] as $product) { if ($product['price'] != 0) { $order_data['L_PAYMENTREQUEST_0_NAME' . $product_index] = $product['product']; $order_data['L_PAYMENTREQUEST_0_NUMBER' . $product_index] = $product['product_code']; $order_data['L_PAYMENTREQUEST_0_DESC' . $product_index] = fn_paypal_substr(fn_paypal_get_product_option($product)); $order_data['L_PAYMENTREQUEST_0_QTY' . $product_index] = $product['amount']; $order_data['L_PAYMENTREQUEST_0_AMT' . $product_index] = $product['price']; $product_index++; } } $sum_taxes = fn_paypal_sum_taxes($data); $order_data['PAYMENTREQUEST_0_ITEMAMT'] = empty($data['subtotal_discount']) ? $data['subtotal'] : $data['subtotal'] - $data['subtotal_discount']; $order_data['PAYMENTREQUEST_0_TAXAMT'] = array_sum($sum_taxes); $order_data['PAYMENTREQUEST_0_SHIPPINGAMT'] = $data['shipping_cost']; $order_data['PAYMENTREQUEST_0_AMT'] = $data['total']; fn_paypal_apply_discount($data, $order_data, $product_index); fn_set_hook('paypal_express_get_order_data', $data, $order_data, $product_index); return $order_data; }