/** * Renders page template. * * @return string Page template. */ public function render() { $content = $this->wp->getPostField('post_content', $this->options->getPageId(Pages::CHECKOUT)); $content = do_shortcode($content); $cart = $this->cartService->getCurrent(); $billingFields = $this->getBillingFields($cart->getCustomer()->getBillingAddress()); $shippingFields = $this->getShippingFields($cart->getCustomer()->getShippingAddress()); $termsUrl = ''; $termsPage = $this->options->get('advanced.pages.terms'); if ($termsPage > 0) { $termsUrl = $this->wp->getPageLink($termsPage); } $verificationMessage = $this->options->get('shopping.enable_verification_message') ? $this->options->get('shopping.verification_message') : ''; return Render::get('shop/checkout', array('cartUrl' => $this->wp->getPermalink($this->options->getPageId(Pages::CART)), 'content' => $content, 'cart' => $cart, 'messages' => $this->messages, 'shippingMethods' => $this->shippingService->getEnabled(), 'paymentMethods' => $this->paymentService->getEnabled(), 'billingFields' => $billingFields, 'shippingFields' => $shippingFields, 'showWithTax' => $this->options->get('tax.price_tax') == 'with_tax', 'showLoginForm' => $this->options->get('shopping.show_login_form') && !$this->wp->isUserLoggedIn(), 'allowRegistration' => $this->options->get('shopping.allow_registration') && !$this->wp->isUserLoggedIn(), 'showRegistrationForm' => $this->options->get('shopping.allow_registration') && !$this->options->get('shopping.guest_purchases') && !$this->wp->isUserLoggedIn(), 'alwaysShowShipping' => $this->options->get('shipping.always_show_shipping'), 'verificationMessage' => $verificationMessage, 'differentShipping' => isset($_POST['jigoshop_order']) ? $_POST['jigoshop_order']['different_shipping_address'] == 'on' : false, 'termsUrl' => $termsUrl, 'defaultGateway' => $this->options->get('payment.default_gateway'))); }
public function render() { /** @var Order $order */ $order = $this->orderService->find((int) $this->wp->getQueryParameter('pay')); $render = $this->wp->applyFilters('jigoshop\\pay\\render', '', $order); if (!empty($render)) { return Render::get('shop/checkout/payment', array('messages' => $this->messages, 'content' => $render, 'order' => $order)); } $termsUrl = ''; $termsPage = $this->options->get('advanced.pages.terms'); if ($termsPage > 0) { $termsUrl = $this->wp->getPageLink($termsPage); } $accountUrl = $this->wp->getPermalink($this->options->getPageId(Pages::ACCOUNT)); return Render::get('shop/checkout/pay', array('messages' => $this->messages, 'order' => $order, 'showWithTax' => $this->options->get('tax.price_tax') == 'with_tax', 'termsUrl' => $termsUrl, 'myAccountUrl' => $accountUrl, 'myOrdersUrl' => Api::getEndpointUrl('orders', '', $accountUrl), 'paymentMethods' => $this->paymentService->getEnabled(), 'getTaxLabel' => function ($taxClass) use($order) { return Tax::getLabel($taxClass, $order); })); }