/** * Makes a payment note for the order * * @param $success * @param null $payment_response * * @return string */ protected function make_payment_note($success, $payment_response = null) { return WC_LUUP_Base_Helper::render_view('order' . DS . 'payment-note', array('success' => $success, 'payment_response' => $payment_response)); }
/** * Shows the postsale offer on thank you page * * @param $order_id * * @return bool */ public function show_postsale_offer($order_id) { $order = wc_get_order($order_id); if (!$this->can_postsale($order_id)) { return false; } $postsale_order_failed = false; $show_offer = true; if ($_POST) { $postsale_order = $this->create_registration_payment($order_id); if ($postsale_order instanceof WC_Order) { $item = null; $orderItems = $postsale_order->get_items(); foreach ($orderItems as $order_item_id => $orderItem) { if ($orderItem['type'] == 'line_item') { $item = $orderItem; break; } } $args = array('order' => $postsale_order, 'postsale_item_ordered' => $item); $show_offer = false; echo WC_LUUP_Base_Helper::render_view('postsale/offer-success', $args); } else { $postsale_order_failed = true; } } if ($show_offer) { $postsale_product = $this->get_postsale_item(); if (!$postsale_product->exists()) { return false; } $return_url = $this->get_return_url($order); $product_data = array('id' => $postsale_product->id, 'title' => $postsale_product->get_title(), 'image' => wp_get_attachment_image_src(get_post_thumbnail_id($postsale_product->get_post_data()->ID))[0], 'order_url' => $return_url); if (get_option('wc_settings_tab_luup_price') != '') { $product_data['regular_price'] = WC_LUUP_Base_Helper::format_price(get_option('wc_settings_tab_luup_price'), $postsale_product); $product_data['price'] = WC_LUUP_Base_Helper::format_price($postsale_product->get_display_price($postsale_product->get_regular_price()), $postsale_product); } else { $product_data['regular_price'] = WC_LUUP_Base_Helper::format_price($postsale_product->get_display_price($postsale_product->get_regular_price()), $postsale_product); $product_data['price'] = WC_LUUP_Base_Helper::format_price($postsale_product->get_display_price(), $postsale_product); } $args = array('product' => $product_data, 'upsell_text' => get_option('wc_settings_tab_luup_text'), 'postsale_order_failed' => $postsale_order_failed); echo WC_LUUP_Base_Helper::render_view('postsale/offer', $args); } }