public function render() { if (!$this->wp->isUserLoggedIn()) { return Render::get('user/login', array()); } $content = $this->wp->getPostField('post_content', $this->options->getPageId(Pages::ACCOUNT)); $content = do_shortcode($content); $customer = $this->customerService->getCurrent(); $query = new \WP_Query(array('post_type' => Types::ORDER, 'post_status' => array(Status::PENDING, Status::ON_HOLD), 'posts_per_page' => $this->options->get('shopping.unpaid_orders_number'), 'meta_query' => array(array('key' => 'customer_id', 'value' => $this->wp->getCurrentUserId(), 'compare' => '=')))); $orders = $this->orderService->findByQuery($query); $permalink = get_permalink(); return Render::get('user/account', array('content' => $content, 'messages' => $this->messages, 'customer' => $customer, 'unpaidOrders' => $orders, 'editBillingAddressUrl' => Api::getEndpointUrl('edit-address', 'billing', $permalink), 'editShippingAddressUrl' => Api::getEndpointUrl('edit-address', 'shipping', $permalink), 'changePasswordUrl' => Api::getEndpointUrl('change-password', '', $permalink), 'myOrdersUrl' => Api::getEndpointUrl('orders', '', $permalink))); }
public function render() { $cart = $this->cartService->getCurrent(); $content = $this->wp->getPostField('post_content', $this->options->getPageId(Pages::CART)); $content = do_shortcode($content); $termsUrl = ''; $termsPage = $this->options->get('advanced.pages.terms'); if ($termsPage > 0) { $termsUrl = $this->wp->getPermalink($termsPage); } return Render::get('shop/cart', array('content' => $content, 'cart' => $cart, 'messages' => $this->messages, 'productService' => $this->productService, 'customer' => $this->customerService->getCurrent(), 'shippingMethods' => $this->shippingService->getEnabled(), 'shopUrl' => $this->wp->getPermalink($this->options->getPageId(Pages::SHOP)), 'showWithTax' => $this->options->get('tax.price_tax') == 'with_tax', 'showShippingCalculator' => $this->options->get('shipping.calculator'), 'termsUrl' => $termsUrl)); }
public function render() { $content = $this->wp->getPostField('post_content', $this->options->getPageId(Pages::THANK_YOU)); /** @var Order $order */ $order = $this->orderService->find((int) $_REQUEST['order']); if ($order->getKey() != $_REQUEST['key']) { $this->messages->addError(__('Invalid security key. The order was processed.', 'jigoshop')); $this->wp->redirectTo($this->options->getPageId(Pages::SHOP)); } return Render::get('shop/checkout/thanks', array('content' => $content, 'messages' => $this->messages, 'order' => $order, 'showWithTax' => $this->options->get('tax.price_tax') == 'with_tax', 'shopUrl' => $this->wp->getPermalink($this->options->getPageId(Pages::SHOP)), 'cancelUrl' => \Jigoshop\Helper\Order::getCancelLink($order), 'getTaxLabel' => function ($taxClass) use($order) { return Tax::getLabel($taxClass, $order); })); }
/** * 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'))); }