示例#1
0
 public function request($vars)
 {
     if ($this->wp->getPostType() === Types::ORDER) {
         if (!isset($vars['post_status'])) {
             $vars['post_status'] = array_keys(Entity\Status::getStatuses());
         }
     }
     return $vars;
 }
示例#2
0
 public function updateMessages($messages)
 {
     if ($this->wp->getPostType() === self::NAME) {
         $messages['post'][1] = __('Order updated.', 'jigoshop');
         $messages['post'][4] = __('Order updated.', 'jigoshop');
         $messages['post'][6] = __('Order updated.', 'jigoshop');
         $messages['post'][8] = __('Order submitted.', 'jigoshop');
         $messages['post'][10] = __('Order draft updated.', 'jigoshop');
     }
     return $messages;
 }
示例#3
0
 public function __construct(Wordpress $wp, Options $options, Types\Product $type, ProductServiceInterface $productService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->productService = $productService;
     $this->type = $type;
     $wp->addAction('wp_ajax_jigoshop.admin.product.find', array($this, 'ajaxFindProduct'), 10, 0);
     $wp->addAction('wp_ajax_jigoshop.admin.product.save_attribute', array($this, 'ajaxSaveAttribute'), 10, 0);
     $wp->addAction('wp_ajax_jigoshop.admin.product.remove_attribute', array($this, 'ajaxRemoveAttribute'), 10, 0);
     $that = $this;
     $wp->addAction('add_meta_boxes_' . Types::PRODUCT, function () use($wp, $that) {
         $wp->addMetaBox('jigoshop-product-data', __('Product Data', 'jigoshop'), array($that, 'box'), Types::PRODUCT, 'normal', 'high');
         $wp->addMetaBox('jigoshop-product-attachments', __('Attachments', 'jigoshop'), array($that, 'attachmentsBox'), Types::PRODUCT, 'side', 'low');
         $wp->removeMetaBox('commentstatusdiv', null, 'normal');
     });
     $this->menu = $menu = $this->wp->applyFilters('jigoshop\\admin\\product\\menu', array('general' => array('label' => __('General', 'jigoshop'), 'visible' => true), 'advanced' => array('label' => __('Advanced', 'jigoshop'), 'visible' => array(Simple::TYPE, Virtual::TYPE)), 'attributes' => array('label' => __('Attributes', 'jigoshop'), 'visible' => true), 'stock' => array('label' => __('Stock', 'jigoshop'), 'visible' => array(Simple::TYPE, Virtual::TYPE)), 'sales' => array('label' => __('Sales', 'jigoshop'), 'visible' => array(Simple::TYPE, Virtual::TYPE))));
     $wp->addAction('admin_enqueue_scripts', function () use($wp, $menu, $that) {
         if ($wp->getPostType() == Types::PRODUCT) {
             Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.admin.product'));
             Styles::add('jigoshop.vendors.datepicker', \JigoshopInit::getUrl() . '/assets/css/vendors/datepicker.css', array('jigoshop.admin.product'));
             Styles::add('jigoshop.admin.product', \JigoshopInit::getUrl() . '/assets/css/admin/product.css');
             Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jquery', 'jigoshop.admin.product'));
             Scripts::add('jigoshop.vendors.bs_tab_trans_tooltip_collapse', \JigoshopInit::getUrl() . '/assets/js/vendors/bs_tab_trans_tooltip_collapse.js', array('jquery', 'jigoshop.admin.product'));
             Scripts::add('jigoshop.vendors.datepicker', \JigoshopInit::getUrl() . '/assets/js/vendors/datepicker.js', array('jquery', 'jigoshop.admin.product'));
             Scripts::add('jigoshop.admin.product', \JigoshopInit::getUrl() . '/assets/js/admin/product.js', array('jquery', 'jigoshop.helpers', 'jquery-ui-sortable'));
             Scripts::localize('jigoshop.admin.product', 'jigoshop_admin_product', array('i18n' => array('saved' => __('Changes saved.', 'jigoshop'), 'attribute_removed' => __('Attribute successfully removed.', 'jigoshop'), 'confirm_remove' => __('Are you sure?', 'jigoshop'), 'invalid_attribute' => __('Invalid attribute, please select another one.', 'jigoshop'), 'attribute_without_label' => __('Please provide attribute label.', 'jigoshop')), 'menu' => array_map(function ($item) {
                 return $item['visible'];
             }, $menu), 'attachments' => $that->getAttachments()));
             $wp->doAction('jigoshop\\admin\\product\\assets', $wp);
         }
     }, 5);
 }
示例#4
0
 public function __construct(Wordpress $wp, Options $options, CouponServiceInterface $couponService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->couponService = $couponService;
     $wp->addFilter(sprintf('manage_edit-%s_columns', Types::COUPON), array($this, 'columns'));
     $wp->addAction(sprintf('manage_%s_posts_custom_column', Types::COUPON), array($this, 'displayColumn'), 2);
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         if ($wp->getPostType() == Types::COUPON) {
             $wp->doAction('jigoshop\\admin\\coupons\\assets', $wp);
         }
     });
 }
示例#5
0
 public function __construct(Wordpress $wp, Options $options, Service $emailService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->emailService = $emailService;
     add_action('wp_ajax_jigoshop.admin.email.update_variable_list', array($this, 'ajaxVariables'));
     $that = $this;
     $wp->addAction('add_meta_boxes_' . Types::EMAIL, function () use($wp, $that) {
         $wp->addMetaBox('jigoshop-email-data', __('Email Data', 'jigoshop'), array($that, 'box'), Types::EMAIL, 'normal', 'default');
         $wp->addMetaBox('jigoshop-email-variable', __('Email Variables', 'jigoshop'), array($that, 'variablesBox'), Types::EMAIL, 'normal', 'default');
     });
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         if ($wp->getPostType() == Types::EMAIL) {
             Scripts::add('jigoshop.admin.email', \JigoshopInit::getUrl() . '/assets/js/admin/email.js', array('jquery', 'jigoshop.helpers'));
             $wp->doAction('jigoshop\\admin\\email\\assets', $wp);
         }
     });
 }
示例#6
0
 public function __construct(Wordpress $wp, Options $options, Types\Product $type, ProductServiceInterface $productService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->productService = $productService;
     $this->type = $type;
     $wp->addFilter(sprintf('manage_edit-%s_columns', Types::PRODUCT), array($this, 'columns'));
     $wp->addAction(sprintf('manage_%s_posts_custom_column', Types::PRODUCT), array($this, 'displayColumn'), 2);
     $wp->addAction('restrict_manage_posts', array($this, 'categoryFilter'));
     $wp->addAction('restrict_manage_posts', array($this, 'typeFilter'));
     $wp->addAction('pre_get_posts', array($this, 'setTypeFilter'));
     $wp->addAction('wp_ajax_jigoshop.admin.products.feature_product', array($this, 'ajaxFeatureProduct'));
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         if ($wp->getPostType() == Types::PRODUCT) {
             Scripts::add('jigoshop.admin.products', \JigoshopInit::getUrl() . '/assets/js/admin/products.js', array('jquery', 'jigoshop.helpers'));
             Styles::add('jigoshop.admin.products_list', \JigoshopInit::getUrl() . '/assets/css/admin/products_list.css', array('jigoshop.admin'));
             $wp->doAction('jigoshop\\admin\\products\\assets', $wp);
         }
     });
 }
示例#7
0
 public function __construct(Wordpress $wp, Options $options, OrderServiceInterface $orderService, ProductServiceInterface $productService, CustomerServiceInterface $customerService, ShippingServiceInterface $shippingService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->orderService = $orderService;
     $this->productService = $productService;
     $this->customerService = $customerService;
     $this->shippingService = $shippingService;
     $wp->addAction('admin_enqueue_scripts', function () use($wp, $options) {
         if ($wp->getPostType() == Types::ORDER) {
             Styles::add('jigoshop.admin.order', \JigoshopInit::getUrl() . '/assets/css/admin/order.css');
             Scripts::add('jigoshop.admin.order', \JigoshopInit::getUrl() . '/assets/js/admin/order.js', array('jquery', 'jigoshop.helpers'));
             Styles::add('jigoshop.vendors.datetimepicker', \JigoshopInit::getUrl() . '/assets/css/vendors/datetimepicker.css');
             Scripts::add('jigoshop.vendors.datetimepicker', \JigoshopInit::getUrl() . '/assets/js/vendors/datetimepicker.js');
             Scripts::localize('jigoshop.admin.order', 'jigoshop_admin_order', array('tax_shipping' => $options->get('tax.shipping'), 'ship_to_billing' => $options->get('shipping.only_to_billing')));
         }
     });
     $wp->addAction('wp_ajax_jigoshop.admin.order.add_product', array($this, 'ajaxAddProduct'), 10, 0);
     $wp->addAction('wp_ajax_jigoshop.admin.order.update_product', array($this, 'ajaxUpdateProduct'), 10, 0);
     $wp->addAction('wp_ajax_jigoshop.admin.order.remove_product', array($this, 'ajaxRemoveProduct'), 10, 0);
     $wp->addAction('wp_ajax_jigoshop.admin.order.change_country', array($this, 'ajaxChangeCountry'), 10, 0);
     $wp->addAction('wp_ajax_jigoshop.admin.order.change_state', array($this, 'ajaxChangeState'), 10, 0);
     $wp->addAction('wp_ajax_jigoshop.admin.order.change_postcode', array($this, 'ajaxChangePostcode'), 10, 0);
     $wp->addAction('wp_ajax_jigoshop.admin.order.change_shipping_method', array($this, 'ajaxChangeShippingMethod'), 10, 0);
     $that = $this;
     $wp->addAction('add_meta_boxes_' . Types::ORDER, function () use($wp, $orderService, $that) {
         $post = $wp->getGlobalPost();
         /** @var \Jigoshop\Entity\Order $order */
         $order = $orderService->findForPost($post);
         $wp->addMetaBox('jigoshop-order-data', $order->getTitle(), array($that, 'dataBox'), Types::ORDER, 'normal', 'high');
         $wp->addMetaBox('jigoshop-order-items', __('Order Items', 'jigoshop'), array($that, 'itemsBox'), Types::ORDER, 'normal', 'high');
         $wp->addMetaBox('jigoshop-order-totals', __('Order Totals', 'jigoshop'), array($that, 'totalsBox'), Types::ORDER, 'normal', 'high');
         $wp->removeMetaBox('commentstatusdiv', null, 'normal');
         $wp->removeMetaBox('submitdiv', Types::ORDER, 'side');
         $wp->addMetaBox('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core');
         $wp->addMetaBox('submitdiv', __('Order Actions', 'jigoshop'), array($that, 'actionsBox'), Types::ORDER, 'side', 'default');
     });
 }
示例#8
0
 public function __construct(Wordpress $wp, Options $options, Service $couponService, PaymentServiceInterface $paymentService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->couponService = $couponService;
     $this->paymentService = $paymentService;
     $that = $this;
     $wp->addAction('wp_ajax_jigoshop.admin.coupon.find_category', array($this, 'ajaxFindCategory'), 10, 0);
     $wp->addAction('add_meta_boxes_' . Types::COUPON, function () use($wp, $that) {
         $wp->addMetaBox('jigoshop-coupon-data', __('Coupon Data', 'jigoshop'), array($that, 'box'), Types::COUPON, 'normal', 'default');
     });
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         if ($wp->getPostType() == Types::COUPON) {
             Styles::add('jigoshop.admin.coupon', \JigoshopInit::getUrl() . '/assets/css/admin/coupon.css', array('jigoshop.admin'));
             Scripts::add('jigoshop.admin.coupon', \JigoshopInit::getUrl() . '/assets/js/admin/coupon.js', array('jquery', 'jigoshop.admin', 'jigoshop.helpers.ajax_search'));
             Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.admin.coupon'));
             Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jigoshop.admin.coupon'), array('in_footer' => true));
             Styles::add('jigoshop.vendors.datepicker', \JigoshopInit::getUrl() . '/assets/css/vendors/datepicker.css', array('jigoshop.admin.coupon'));
             Scripts::add('jigoshop.vendors.datepicker', \JigoshopInit::getUrl() . '/assets/js/vendors/datepicker.js', array('jquery', 'jigoshop.admin.coupon'));
             $wp->doAction('jigoshop\\admin\\coupon\\assets', $wp);
         }
     });
 }