public function render()
 {
     if (!$this->wp->isUserLoggedIn()) {
         return Render::get('user/login', array());
     }
     $customer = $this->customerService->getCurrent();
     return Render::get('user/account/change_password', array('messages' => $this->messages, 'customer' => $customer, 'myAccountUrl' => $this->wp->getPermalink($this->options->getPageId(Pages::ACCOUNT))));
 }
Exemple #2
0
 /**
  * Executes actions associated with selected page.
  */
 public function action()
 {
     if (isset($_POST['action']) && $_POST['action'] == 'add-to-cart') {
         /** @var \Jigoshop\Entity\Product $product */
         $product = $this->productService->find($_POST['item']);
         try {
             /** @var Item $item */
             $item = $this->wp->applyFilters('jigoshop\\cart\\add', null, $product);
             if ($item === null) {
                 throw new Exception(__('Unable to add product to the cart.', 'jigoshop'));
             }
             if (isset($_POST['quantity'])) {
                 $item->setQuantity($_POST['quantity']);
             }
             /** @var Cart $cart */
             $cart = $this->cartService->get($this->cartService->getCartIdForCurrentUser());
             $cart->addItem($item);
             $this->cartService->save($cart);
             $url = false;
             $button = '';
             switch ($this->options->get('shopping.redirect_add_to_cart')) {
                 case 'cart':
                     $url = $this->wp->getPermalink($this->options->getPageId(Pages::CART));
                     break;
                 case 'checkout':
                     $url = $this->wp->getPermalink($this->options->getPageId(Pages::CHECKOUT));
                     break;
                     /** @noinspection PhpMissingBreakStatementInspection */
                 /** @noinspection PhpMissingBreakStatementInspection */
                 case 'product_list':
                     $url = $this->wp->getPermalink($this->options->getPageId(Pages::SHOP));
                 case 'product':
                 case 'same_page':
                 default:
                     $button = sprintf('<a href="%s" class="btn btn-warning pull-right">%s</a>', $this->wp->getPermalink($this->options->getPageId(Pages::CART)), __('View cart', 'jigoshop'));
             }
             $this->messages->addNotice(sprintf(__('%s successfully added to your cart. %s', 'jigoshop'), $product->getName(), $button));
             if ($url !== false) {
                 $this->messages->preserveMessages();
                 $this->wp->wpRedirect($url);
             }
         } catch (NotEnoughStockException $e) {
             if ($e->getStock() == 0) {
                 $message = sprintf(__('Sorry, we do not have "%s" in stock.', 'jigoshop'), $product->getName());
             } else {
                 if ($this->options->get('products.show_stock')) {
                     $message = sprintf(__('Sorry, we do not have enough "%s" in stock to fulfill your order. We only have %d available at this time. Please edit your cart and try again. We apologize for any inconvenience caused.', 'jigoshop'), $product->getName(), $e->getStock());
                 } else {
                     $message = sprintf(__('Sorry, we do not have enough "%s" in stock to fulfill your order. Please edit your cart and try again. We apologize for any inconvenience caused.', 'jigoshop'), $product->getName());
                 }
             }
             $this->messages->addError($message);
         } catch (Exception $e) {
             $this->messages->addError(sprintf(__('A problem ocurred when adding to cart: %s', 'jigoshop'), $e->getMessage()));
         }
     }
 }
Exemple #3
0
 /**
  * Display the widget in the sidebar.
  *
  * @param array $args     Sidebar arguments.
  * @param array $instance Instance.
  */
 public function widget($args, $instance)
 {
     // Hide widget if page is the cart or checkout
     if (Pages::isCart() || Pages::isCheckout()) {
         return;
     }
     // Set the widget title
     $title = apply_filters('widget_title', $instance['title'] ? $instance['title'] : __('Cart', 'jigoshop'), $instance, $this->id_base);
     Render::output('widget/cart/widget', array_merge($args, array('title' => $title, 'cart' => self::$cart->getCurrent(), 'cart_url' => get_permalink(self::$options->getPageId(\Jigoshop\Frontend\Pages::CART)), 'checkout_url' => get_permalink(self::$options->getPageId(\Jigoshop\Frontend\Pages::CHECKOUT)))));
 }
Exemple #4
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)));
 }
Exemple #5
0
 /**
  * Updates menu items to enable "Shop" item when necessary.
  *
  * @param $items array Menu items.
  *
  * @return array Updated menu items.
  */
 public function menu($items)
 {
     if ($this->wp->getQueryParameter('post_type', false) == Types::PRODUCT) {
         foreach ($items as $item) {
             /** @var $item \WP_Post */
             /** @noinspection PhpUndefinedFieldInspection */
             if ($item->object_id == $this->options->getPageId(Pages::SHOP)) {
                 /** @noinspection PhpUndefinedFieldInspection */
                 $item->classes[] = 'current-menu-item';
             }
         }
     }
     return $items;
 }
Exemple #6
0
 /**
  * Save the settings
  */
 private function save()
 {
     // We need to save the options ourselves; settings api does not trigger save for the permalinks page
     if (isset($_POST['permalink_structure']) || isset($_POST['category_base']) && isset($_POST['product_permalink'])) {
         // Cat and tag bases
         $categorySlug = trim(strip_tags($_POST['jigoshop_product_category_slug']));
         $tagSlug = trim(strip_tags($_POST['jigoshop_product_tag_slug']));
         $permalinks = $this->options->get('permalinks');
         $helpers = $this->wp->getHelpers();
         $permalinks['category'] = $helpers->untrailingslashit($categorySlug);
         $permalinks['tag'] = $helpers->untrailingslashit($tagSlug);
         // Product base
         $product_permalink = trim(strip_tags($_POST['product_permalink']));
         if ($product_permalink == 'custom') {
             // Get permalink without slashes
             $product_permalink = trim(strip_tags($_POST['product_permalink_structure']), '/');
             // This is an invalid base structure and breaks pages
             if ('%' . Types::PRODUCT_CATEGORY . '%' == $product_permalink) {
                 $product_permalink = _x('product', 'slug', 'jigoshop') . '/' . $product_permalink;
             }
         } elseif (empty($product_permalink)) {
             $product_permalink = false;
         }
         $permalinks['product'] = $helpers->untrailingslashit($product_permalink);
         // Shop base may require verbose page rules if nesting pages
         $shopPageId = $this->options->getPageId(FrontendPages::SHOP);
         $shop_permalink = urldecode($shopPageId > 0 && $this->wp->getPost($shopPageId) ? $this->wp->getPageUri($shopPageId) : _x('shop', 'default-slug', 'jigoshop'));
         if ($shopPageId && trim($permalinks['product'], '/') === $shop_permalink) {
             $permalinks['verbose'] = true;
         }
         $this->options->update('permalinks', $permalinks);
         $this->options->saveOptions();
         $this->wp->getRewrite()->flush_rules();
     }
 }
Exemple #7
0
 /**
  * Evaluates to true only on the Order Tracking page
  *
  * @return bool
  * @since 2.0
  */
 public static function isOrderTracker()
 {
     if (!isset(self::$cache[self::ORDER_TRACKING])) {
         $page = self::$options->getPageId(self::ORDER_TRACKING);
         self::$cache[self::ORDER_TRACKING] = $page !== false && is_page($page);
     }
     return self::$cache[self::ORDER_TRACKING];
 }
Exemple #8
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));
 }
 /**
  * Displays the widget in the sidebar.
  *
  * @param array $args     Sidebar arguments.
  * @param array $instance The instance.
  *
  * @return bool|void
  */
 public function widget($args, $instance)
 {
     // Get the best selling products from the transient
     $cache = get_transient(Core::WIDGET_CACHE);
     // If cached get from the cache
     if (isset($cache[$args['widget_id']])) {
         echo $cache[$args['widget_id']];
         return;
     }
     // Otherwise Start buffering and output the Widget
     ob_start();
     // Set the widget title
     $title = apply_filters('widget_title', $instance['title'] ? $instance['title'] : __('Product Categories', 'jigoshop'), $instance, $this->id_base);
     // Get options
     $count = isset($instance['count']) ? $instance['count'] : false;
     $is_hierarchical = isset($instance['hierarchical']) ? $instance['hierarchical'] : false;
     $is_dropdown = isset($instance['dropdown']) ? $instance['dropdown'] : false;
     $query = array('orderby' => 'name', 'show_count' => $count, 'hierarchical' => $is_hierarchical, 'taxonomy' => Core\Types::PRODUCT_CATEGORY, 'title_li' => null);
     if (Pages::isProduct()) {
         global $post;
         $categories = get_the_terms($post->ID, Core\Types::PRODUCT_CATEGORY);
         if (!empty($categories)) {
             $category = reset($categories);
             $query['current_category'] = apply_filters('jigoshop_product_cat_widget_terms', $category->term_id, $categories);
         }
     }
     if ($is_dropdown) {
         global $wp_query;
         $query = array('pad_counts' => 1, 'hierarchical' => $is_hierarchical, 'hide_empty' => true, 'show_count' => $count, 'selected' => isset($wp_query->query[Core\Types::PRODUCT_CATEGORY]) ? $wp_query->query[Core\Types::PRODUCT_CATEGORY] : '');
         $terms = get_terms(Core\Types::PRODUCT_CATEGORY, $query);
         if (!$terms) {
             return;
         }
         $walker = new CategoryWalker(self::$wp, 'widget/product_categories/item');
         Render::output('widget/product_categories/dropdown', array_merge($args, array('title' => $title, 'query' => $query, 'walker' => $walker, 'terms' => $terms, 'value' => $query['selected'], 'shopUrl' => get_permalink(self::$options->getPageId(Pages::SHOP)))));
     } else {
         Render::output('widget/product_categories/list', array_merge($args, array('title' => $title, 'args' => $query)));
     }
     // Flush output buffer and save to transient cache
     $cache[$args['widget_id']] = ob_get_flush();
     set_transient(Core::WIDGET_CACHE, $cache, 3600 * 3);
     // 3 hours ahead
 }
Exemple #10
0
 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));
 }
Exemple #11
0
 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);
     }));
 }
Exemple #12
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)));
     }
 }
Exemple #13
0
 /**
  * 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')));
 }
Exemple #14
0
 public function render()
 {
     if (!$this->wp->isUserLoggedIn()) {
         return Render::get('user/login', array());
     }
     $customer = $this->customerService->getCurrent();
     switch ($this->wp->getQueryParameter('edit-address')) {
         case 'shipping':
             $address = $customer->getShippingAddress();
             break;
         case 'billing':
         default:
             $address = $customer->getBillingAddress();
             break;
     }
     return Render::get('user/account/edit_address', array('messages' => $this->messages, 'customer' => $customer, 'address' => $address, 'myAccountUrl' => $this->wp->getPermalink($this->options->getPageId(Pages::ACCOUNT))));
 }
Exemple #15
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);
     }));
 }
Exemple #16
0
 public function processResponse()
 {
     if (isset($_GET['file'])) {
         try {
             $data = explode('.', $_GET['file']);
             if (count($data) != 3) {
                 throw new Exception(__('Invalid download key. Unable to download file.', 'jigoshop'));
             }
             list($key, $id, $itemKey) = $data;
             $order = $this->orderService->find((int) $id);
             /** @var $order Order */
             if ($order->getKey() !== $key) {
                 throw new Exception(__('Invalid security key. Unable to download file.', 'jigoshop'));
             }
             if (!in_array($order->getStatus(), array(Order\Status::COMPLETED, Order\Status::PROCESSING))) {
                 throw new Exception(__('Invalid order.', 'jigoshop'));
             }
             $item = $order->getItem($itemKey);
             if ($item === null) {
                 throw new Exception(__('Product not found.', 'jigoshop'));
             }
             if ($item->getType() !== Downloadable::TYPE) {
                 throw new Exception(__('Invalid file to download.', 'jigoshop'));
             }
             $downloads = $item->getMeta('downloads')->getValue();
             if (!empty($downloads) && $downloads == 0) {
                 throw new Exception(__('Sorry, you have reached your download limit for this file.', 'jigoshop'));
             }
             if ($this->options->get('shopping.login_for_downloads')) {
                 if (!$this->wp->isUserLoggedIn()) {
                     throw new Exception(__('You have to log in before you can download a file.', 'jigoshop'));
                 } else {
                     if ($order->getCustomer()->getId() != $this->wp->getCurrentUserId()) {
                         throw new Exception(__('This is not your download link.', 'jigoshop'));
                     }
                 }
             }
             $file = $item->getMeta('file')->getValue();
             if (!$file) {
                 throw new Exception(__('File not found.', 'jigoshop'));
             }
             if (!empty($downloads)) {
                 $item->getMeta('downloads')->setValue($downloads - 1);
                 $this->orderService->saveItemMeta($item, $item->getMeta('downloads'));
             }
             if (!$this->wp->isMultisite()) {
                 $site_url = $this->wp->siteUrl();
                 $site_url = str_replace('https:', 'http:', $site_url);
                 $file = str_replace($this->wp->getHelpers()->trailingslashit($site_url), ABSPATH, $file);
             } else {
                 $network_url = $this->wp->networkAdminUrl();
                 $network_url = str_replace('https:', 'http:', $network_url);
                 $upload_dir = $this->wp->wpUploadDir();
                 // Try to replace network url
                 $file = str_replace($this->wp->getHelpers()->trailingslashit($network_url), ABSPATH, $file);
                 // Now try to replace upload URL
                 $file = str_replace($upload_dir['baseurl'], $upload_dir['basedir'], $file);
             }
             $file = $this->wp->applyFilters('jigoshop\\downloadable\\file_path', $file, $itemKey, $order);
             // See if its local or remote
             if (strstr($file, 'http:') || strstr($file, 'https:') || strstr($file, 'ftp:')) {
                 $isRemote = true;
             } else {
                 $isRemote = false;
                 $file = realpath($file);
             }
             // Download the file
             $extension = strtolower(substr(strrchr($file, '.'), 1));
             switch ($extension) {
                 case 'pdf':
                     $type = 'application/pdf';
                     break;
                 case 'exe':
                     $type = 'application/octet-stream';
                     break;
                 case 'zip':
                     $type = 'application/zip';
                     break;
                 case 'doc':
                     $type = 'application/msword';
                     break;
                 case 'xls':
                     $type = 'application/vnd.ms-excel';
                     break;
                 case 'ppt':
                     $type = 'application/vnd.ms-powerpoint';
                     break;
                 case 'gif':
                     $type = 'image/gif';
                     break;
                 case 'png':
                     $type = 'image/png';
                     break;
                 case 'jpe':
                 case 'jpeg':
                 case 'jpg':
                     $type = 'image/jpg';
                     break;
                 default:
                     $type = 'application/force-download';
             }
             $this->wp->doAction('jigoshop\\downloadable\\before_download', $file, $order);
             @session_write_close();
             @set_time_limit(0);
             @ob_end_clean();
             // required for IE, otherwise Content-Disposition may be ignored
             if (ini_get('zlib.output_compression')) {
                 ini_set('zlib.output_compression', 'Off');
             }
             header('Pragma: no-cache');
             header('Expires: 0');
             header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
             header('Robots: none');
             header('Content-Type: ' . $type);
             header('Content-Description: File Transfer');
             header('Content-Transfer-Encoding: binary');
             if (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
                 // workaround for IE filename bug with multiple periods / multiple dots in filename
                 header('Content-Disposition: attachment; filename="' . preg_replace('/\\./', '%2e', basename($file), substr_count(basename($file), '.') - 1) . '";');
             } else {
                 header('Content-Disposition: attachment; filename="' . basename($file) . '";');
             }
             if ($isRemote) {
                 header('Location: ' . $file);
             } else {
                 if (file_exists($file)) {
                     header('Content-Length: ' . filesize($file));
                     readfile($file);
                 } else {
                     throw new Exception(__('File not found.', 'jigoshop'));
                 }
             }
         } catch (Exception $e) {
             $this->messages->addError($e->getMessage());
             $this->wp->redirectTo($this->options->getPageId(Pages::SHOP));
         }
         exit;
     }
 }
Exemple #17
0
 /**
  * @param $order \Jigoshop\Entity\Order Order to generate link for.
  *
  * @return string Payment link.
  */
 public static function getThankYouLink($order)
 {
     $args = array('order' => $order->getId(), 'key' => $order->getKey());
     $url = add_query_arg($args, get_permalink(self::$options->getPageId(Pages::THANK_YOU)));
     return apply_filters('jigoshop\\helper\\order\\thank_you_url', $url);
 }