Ejemplo n.º 1
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);
 }
Ejemplo n.º 2
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);
         }
     });
 }
Ejemplo n.º 3
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');
     });
 }
Ejemplo n.º 4
0
 /** Displays the page. */
 public function display()
 {
     $this->wp->wpEnqueueScript('common');
     $this->wp->wpEnqueueScript('wp-lists');
     $this->wp->wpEnqueueScript('postbox');
     Styles::add('wp-jquery-ui');
     $this->wp->addMetaBox('jigoshop_dashboard_right_now', __('<span>Shop</span> Content', 'jigoshop'), array($this, 'rightNow'), 'jigoshop', 'side', 'core');
     $this->wp->addMetaBox('jigoshop_dashboard_recent_orders', __('<span>Recent</span> Orders', 'jigoshop'), array($this, 'recentOrders'), 'jigoshop', 'side', 'core');
     if ($this->options->get('products.manage_stock')) {
         $this->wp->addMetaBox('jigoshop_dashboard_stock_report', __('<span>Stock</span> Report', 'jigoshop'), array($this, 'stockReport'), 'jigoshop', 'side', 'core');
     }
     $this->wp->addMetaBox('jigoshop_dashboard_monthly_report', __('<span>Monthly</span> Report', 'jigoshop'), array($this, 'monthlyReport'), 'jigoshop', 'normal', 'core');
     $this->wp->addMetaBox('jigoshop_dashboard_recent_reviews', __('<span>Recent</span> Reviews', 'jigoshop'), array($this, 'recentReviews'), 'jigoshop', 'normal', 'core');
     $this->wp->addMetaBox('jigoshop_dashboard_latest_news', __('<span>Latest</span> News', 'jigoshop'), array($this, 'latestNews'), 'jigoshop', 'normal', 'core');
     $this->wp->addMetaBox('jigoshop_dashboard_useful_links', __('<span>Useful</span> Links', 'jigoshop'), array($this, 'usefulLinks'), 'jigoshop', 'normal', 'core');
     $submenu = $this->wp->getSubmenu();
     Render::output('admin/dashboard', array('submenu' => $submenu));
 }
Ejemplo n.º 5
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);
         }
     });
 }