Example #1
0
 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)));
 }
Example #2
0
 public function render()
 {
     if (!$this->wp->isUserLoggedIn()) {
         return Render::get('user/login', array());
     }
     $order = $this->wp->getQueryParameter('orders');
     $accountUrl = $this->wp->getPermalink($this->options->getPageId(Pages::ACCOUNT));
     if (!empty($order) && is_numeric($order)) {
         $order = $this->orderService->find($order);
         /** @var Entity $order */
         return Render::get('user/account/orders/single', array('messages' => $this->messages, 'order' => $order, 'myAccountUrl' => $accountUrl, 'listUrl' => Api::getEndpointUrl('orders', '', $accountUrl), 'showWithTax' => $this->options->get('tax.price_tax') == 'with_tax', 'getTaxLabel' => function ($taxClass) use($order) {
             return Tax::getLabel($taxClass, $order);
         }));
     }
     $customer = $this->customerService->getCurrent();
     $orders = $this->orderService->findForUser($customer->getId());
     return Render::get('user/account/orders', array('messages' => $this->messages, 'customer' => $customer, 'orders' => $orders, 'myAccountUrl' => $accountUrl));
 }
Example #3
0
 /**
  * Display the widget in the sidebar.
  *
  * @param array $args     Sidebar arguments.
  * @param array $instance The instance.
  *
  * @return bool|void
  */
 public function widget($args, $instance)
 {
     $accountUrl = get_permalink(self::$options->getPageId(Pages::ACCOUNT));
     if (is_user_logged_in()) {
         global $current_user;
         $title = !empty($instance['title_user']) ? $instance['title_user'] : __('Hey %s!', 'jigoshop');
         $links = apply_filters('jigoshop_widget_logout_user_links', array(__('My Account', 'jigoshop') => $accountUrl, __('My Orders', 'jigoshop') => Api::getEndpointUrl('orders', '', $accountUrl), __('Change Password', 'jigoshop') => Api::getEndpointUrl('change-password', '', $accountUrl), __('Logout', 'jigoshop') => wp_logout_url(home_url())));
         /** @noinspection PhpUndefinedFieldInspection */
         Render::output('widget/user_login/logged_in', array_merge($args, array('title' => sprintf($title, ucwords($current_user->display_name)), 'links' => $links)));
     } else {
         // Print title
         $title = $instance['title_guest'] ? $instance['title_guest'] : __('Login', 'jigoshop');
         $links = apply_filters('jigoshop_widget_login_user_links', array());
         $url = apply_filters('jigoshop_widget_login_redirect', $accountUrl);
         $loginUrl = wp_login_url($url);
         $passwordUrl = wp_lostpassword_url($url);
         // TODO: Support for other widgets
         //			$fields = array();
         //			// Support for other plugins which uses GET parameters
         //			$fields = apply_filters('jigoshop_get_hidden_fields', $fields);
         Render::output('widget/user_login/log_in', array_merge($args, array('title' => $title, 'links' => $links, 'loginUrl' => $loginUrl, 'passwordUrl' => $passwordUrl)));
     }
 }
Example #4
0
 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);
     }));
 }
Example #5
0
    ?>
					<?php 
    if ($unpaid) {
        ?>
						<a href="<?php 
        echo Order::getPayLink($order);
        ?>
" class="btn btn-success pull-right"><?php 
        _e('Pay', 'jigoshop');
        ?>
</a>
					<?php 
    }
    ?>
					<a href="<?php 
    echo Api::getEndpointUrl('orders', $order->getId());
    ?>
" class="btn btn-primary pull-right"><?php 
    _e('View', 'jigoshop');
    ?>
</span></a>
				</h4>
				<dl class="dl-horizontal list-group-item-text">
					<dt><?php 
    _e('Date', 'jigoshop');
    ?>
</dt>
					<dd><?php 
    echo $order->getCreatedAt()->format(_x('d.m.Y, H:i', 'account', 'jigoshop'));
    ?>
</dd>
Example #6
0
 /**
  * @param $order \Jigoshop\Entity\Order Order to generate link for.
  *
  * @return string Payment link.
  */
 public static function getPayLink($order)
 {
     $args = array('key' => $order->getKey());
     $url = add_query_arg($args, Api::getEndpointUrl('pay', $order->getId(), get_permalink(self::$options->getPageId(Pages::CHECKOUT))));
     return apply_filters('jigoshop\\helper\\order\\pay_url', $url);
 }