Exemple #1
0
 public function __construct(Wordpress $wp, Options $options, TaxServiceInterface $taxService, Messages $messages)
 {
     $this->options = $options->get(self::SLUG);
     $this->taxService = $taxService;
     $options = $this->options;
     $wp->addAction('admin_enqueue_scripts', function () use($options) {
         if (!isset($_GET['tab']) || $_GET['tab'] != TaxesTab::SLUG) {
             return;
         }
         $classes = array();
         foreach ($options['classes'] as $class) {
             $classes[$class['class']] = $class['label'];
         }
         $states = array();
         foreach (Country::getAllStates() as $country => $stateList) {
             $states[$country] = array(array('id' => '', 'text' => _x('All states', 'admin_taxing', 'jigoshop')));
             foreach ($stateList as $code => $state) {
                 $states[$country][] = array('id' => $code, 'text' => $state);
             }
         }
         $countries = array_merge(array('' => __('All countries', 'jigoshop')), Country::getAll());
         Scripts::add('jigoshop.admin.settings.taxes', \JigoshopInit::getUrl() . '/assets/js/admin/settings/taxes.js', array('jquery'), array('page' => 'jigoshop_page_jigoshop_settings'));
         Scripts::localize('jigoshop.admin.settings.taxes', 'jigoshop_admin_taxes', array('new_class' => Render::get('admin/settings/tax/class', array('class' => array('label' => '', 'class' => ''))), 'new_rule' => Render::get('admin/settings/tax/rule', array('rule' => array('id' => '', 'label' => '', 'class' => '', 'is_compound' => false, 'rate' => '', 'country' => '', 'states' => array(), 'postcodes' => array()), 'classes' => $classes, 'countries' => $countries)), 'states' => $states));
     });
 }
Exemple #2
0
 public function __construct(Wordpress $wp, Options $options, Messages $messages, CartServiceInterface $cartService, CustomerServiceInterface $customerService, ShippingServiceInterface $shippingService, PaymentServiceInterface $paymentService, OrderServiceInterface $orderService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->messages = $messages;
     $this->cartService = $cartService;
     $this->customerService = $customerService;
     $this->shippingService = $shippingService;
     $this->paymentService = $paymentService;
     $this->orderService = $orderService;
     Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css');
     Styles::add('jigoshop.checkout', \JigoshopInit::getUrl() . '/assets/css/shop/checkout.css', array('jigoshop.shop', 'jigoshop.vendors.select2'));
     Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jquery'));
     Scripts::add('jigoshop.vendors.bs_tab_trans_tooltip_collapse', \JigoshopInit::getUrl() . '/assets/js/vendors/bs_tab_trans_tooltip_collapse.js', array('jquery'));
     Scripts::add('jigoshop.checkout', \JigoshopInit::getUrl() . '/assets/js/shop/checkout.js', array('jquery', 'jquery-blockui', 'jigoshop.helpers', 'jigoshop.vendors.select2', 'jigoshop.vendors.bs_tab_trans_tooltip_collapse'));
     Scripts::localize('jigoshop.checkout', 'jigoshop_checkout', array('assets' => \JigoshopInit::getUrl() . '/assets', 'i18n' => array('loading' => __('Loading...', 'jigoshop'))));
     if (!$wp->isSsl() && $options->get('shopping.force_ssl')) {
         $wp->addAction('template_redirect', array($this, 'redirectToSsl'), 100, 0);
     }
     $wp->addAction('wp_ajax_jigoshop_checkout_change_country', array($this, 'ajaxChangeCountry'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_checkout_change_country', array($this, 'ajaxChangeCountry'));
     $wp->addAction('wp_ajax_jigoshop_checkout_change_state', array($this, 'ajaxChangeState'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_checkout_change_state', array($this, 'ajaxChangeState'));
     $wp->addAction('wp_ajax_jigoshop_checkout_change_postcode', array($this, 'ajaxChangePostcode'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_checkout_change_postcode', array($this, 'ajaxChangePostcode'));
 }
Exemple #3
0
 public function __construct(Wordpress $wp, Options $options, Messages $messages, CartServiceInterface $cartService, ProductServiceInterface $productService, CustomerServiceInterface $customerService, OrderServiceInterface $orderService, ShippingServiceInterface $shippingService, CouponServiceInterface $couponService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->messages = $messages;
     $this->cartService = $cartService;
     $this->productService = $productService;
     $this->customerService = $customerService;
     $this->shippingService = $shippingService;
     $this->orderService = $orderService;
     $this->couponService = $couponService;
     Styles::add('jigoshop.shop.cart', \JigoshopInit::getUrl() . '/assets/css/shop/cart.css', array('jigoshop.shop'));
     Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.shop'));
     Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jquery'));
     Scripts::add('jigoshop.vendors.bs_tab_trans_tooltip_collapse', \JigoshopInit::getUrl() . '/assets/js/vendors/bs_tab_trans_tooltip_collapse.js', array('jquery'));
     Scripts::add('jigoshop.shop.cart', \JigoshopInit::getUrl() . '/assets/js/shop/cart.js', array('jquery', 'jquery-blockui', 'jigoshop.shop', 'jigoshop.helpers', 'jigoshop.vendors.select2', 'jigoshop.vendors.bs_tab_trans_tooltip_collapse'));
     Scripts::localize('jigoshop.shop.cart', 'jigoshop_cart', array('assets' => \JigoshopInit::getUrl() . '/assets', 'i18n' => array('loading' => __('Loading...', 'jigoshop'))));
     $wp->addAction('wp_ajax_jigoshop_cart_update_item', array($this, 'ajaxUpdateItem'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_cart_update_item', array($this, 'ajaxUpdateItem'));
     $wp->addAction('wp_ajax_jigoshop_cart_select_shipping', array($this, 'ajaxSelectShipping'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_cart_select_shipping', array($this, 'ajaxSelectShipping'));
     $wp->addAction('wp_ajax_jigoshop_cart_update_discounts', array($this, 'ajaxUpdateDiscounts'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_cart_update_discounts', array($this, 'ajaxUpdateDiscounts'));
     $wp->addAction('wp_ajax_jigoshop_cart_change_country', array($this, 'ajaxChangeCountry'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_cart_change_country', array($this, 'ajaxChangeCountry'));
     $wp->addAction('wp_ajax_jigoshop_cart_change_state', array($this, 'ajaxChangeState'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_cart_change_state', array($this, 'ajaxChangeState'));
     $wp->addAction('wp_ajax_jigoshop_cart_change_postcode', array($this, 'ajaxChangePostcode'));
     $wp->addAction('wp_ajax_nopriv_jigoshop_cart_change_postcode', array($this, 'ajaxChangePostcode'));
 }
Exemple #4
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);
 }
Exemple #5
0
 public function __construct(Wordpress $wp, Options $options, $currentRange)
 {
     parent::__construct($wp, $options, $currentRange);
     if (isset($_GET['product_ids']) && is_array($_GET['product_ids'])) {
         $this->productIds = array_filter(array_map('absint', $_GET['product_ids']));
     } elseif (isset($_GET['product_ids'])) {
         $this->productIds = explode(',', $_GET['product_ids']);
         $this->productIds = array_filter(array_map('absint', $this->productIds));
     }
     // Prepare data for report
     $this->calculateCurrentRange();
     $this->getReportData();
     $this->getChartColours();
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if ($screen->base != 'jigoshop_page_' . Reports::NAME) {
             return;
         }
         Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.admin'));
         Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jigoshop.admin'), array('in_footer' => true));
         Scripts::add('jigoshop.admin.reports.widget.product_search', \JigoshopInit::getUrl() . '/assets/js/admin/reports/widget/product_search.js', array('jquery', 'jigoshop.vendors.select2', 'jigoshop.helpers.ajax_search'), array('in_footer' => true));
         Scripts::localize('jigoshop.reports.chart', 'chart_data', $this->getMainChart());
     });
 }
Exemple #6
0
 /**
  * @param Wordpress $wp
  * @param Options   $options
  * @param string    $currentRange
  */
 public function __construct(Wordpress $wp, Options $options, $currentRange)
 {
     parent::__construct($wp, $options, $currentRange);
     if (isset($_GET['show_categories'])) {
         if (in_array(-1, $_GET['show_categories'])) {
             $allCategories = get_terms('product_category', array('orderby' => 'name', 'hide_empty' => false));
             $this->showCategories = array_map(function ($category) {
                 return $category->term_id;
             }, $allCategories);
         } else {
             $this->showCategories = is_array($_GET['show_categories']) ? array_map('absint', $_GET['show_categories']) : array(absint($_GET['show_categories']));
         }
     } else {
         $this->showCategories = $this->getLastCategoryID();
     }
     $this->calculateCurrentRange();
     $this->getReportData();
     $this->getChartColours();
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if ($screen->base != 'jigoshop_page_' . Reports::NAME) {
             return;
         }
         Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.admin.reports'));
         Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jigoshop.admin.reports'), array('in_footer' => true));
         Scripts::localize('jigoshop.reports.chart', 'chart_data', $this->getMainChart());
     });
 }
 public function __construct(Wordpress $wp)
 {
     $this->wp = $wp;
     $wp->addAction(sprintf('%s_add_form_fields', Types::PRODUCT_CATEGORY), array($this, 'showThumbnail'));
     $wp->addAction(sprintf('%s_edit_form_fields', Types::PRODUCT_CATEGORY), array($this, 'showThumbnail'));
     $wp->addAction('created_term', array($this, 'saveThumbnail'), 10, 3);
     $wp->addAction('edit_term', array($this, 'saveThumbnail'), 10, 3);
     $wp->addAction(sprintf('delete_%s', Types::PRODUCT_CATEGORY), array($this, 'delete'));
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         $wp->wpEnqueueMedia();
         Scripts::add('jigoshop.admin.product_categories', \JigoshopInit::getUrl() . '/assets/js/admin/product_categories.js', array('jquery', 'jigoshop.media'));
         Scripts::localize('jigoshop.admin.product_categories', 'jigoshop_admin_product_categories', array('category_name' => Types::PRODUCT_CATEGORY, 'placeholder' => \JigoshopInit::getUrl() . '/assets/images/placeholder.png'));
         $wp->doAction('jigoshop\\admin\\product_categories\\assets', $wp);
     });
 }
Exemple #8
0
 public function __construct(Wordpress $wp, Options $options, Messages $messages)
 {
     $this->options = $options->get(self::SLUG);
     $this->messages = $messages;
     $wp->addAction('admin_enqueue_scripts', function () {
         if (!isset($_GET['tab']) || $_GET['tab'] != GeneralTab::SLUG) {
             return;
         }
         $states = array();
         foreach (Country::getAllStates() as $country => $stateList) {
             foreach ($stateList as $code => $state) {
                 $states[$country][] = array('id' => $code, 'text' => $state);
             }
         }
         Scripts::add('jigoshop.admin.settings.general', \JigoshopInit::getUrl() . '/assets/js/admin/settings/general.js', array('jquery'), array('page' => 'jigoshop_page_jigoshop_settings'));
         Scripts::localize('jigoshop.admin.settings.general', 'jigoshop_admin_general', array('states' => $states));
     });
 }
 public function __construct(Wordpress $wp, Options $options, $currentRange)
 {
     parent::__construct($wp, $options, $currentRange);
     $this->calculateCurrentRange();
     $this->getReportData();
     $this->getChartColours();
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if ($screen->base != 'jigoshop_page_' . Reports::NAME) {
             return;
         }
         Scripts::localize('jigoshop.reports.chart', 'chart_data', $this->getMainChart());
     });
 }
 public function __construct(Wordpress $wp, Options $options)
 {
     $this->wp = $wp;
     $this->options = $options;
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php'))) {
             return;
         }
         if (isset($_REQUEST['tab']) && $_REQUEST['tab'] != self::SLUG) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if (!in_array($screen->base, array('jigoshop_page_' . SystemInfo::NAME))) {
             return;
         }
         Scripts::add('jigoshop.admin.system_info.system_status', \JigoshopInit::getUrl() . '/assets/js/admin/system_info/system_status.js', array('jquery'));
         Scripts::localize('jigoshop.admin.system_info.system_status', 'system_data', $this->getSystemData());
     });
 }
Exemple #11
0
 public function __construct(Wordpress $wp, Options $options, Messages $messages)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->messages = $messages;
     $wp->addAction('current_screen', array($this, 'action'));
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if ($screen->base != 'jigoshop_page_' . Migration::NAME) {
             return;
         }
         Styles::add('jigoshop.admin.migration', \JigoshopInit::getUrl() . '/assets/css/admin/migration.css');
         Scripts::add('jigoshop.admin.migration', \JigoshopInit::getUrl() . '/assets/js/admin/migration.js');
         $migration_title = __('Jigoshop » Migration Tool » ', 'jigoshop');
         Scripts::localize('jigoshop.admin.migration', 'jigoshop_admin_migration', array('i18n' => array('migration_complete' => __('migration complete', 'jigoshop'), 'migration_error' => __('migration error', 'jigoshop'), 'alert_msg' => __('A communication error has occured, please reload the page and continue with the migration.', 'jigoshop'), 'processing' => __('Processing...', 'jigoshop'), 'jigoshop.admin.migration.products' => $migration_title . __('Products', 'jigoshop'), 'jigoshop.admin.migration.coupons' => $migration_title . __('Coupons', 'jigoshop'), 'jigoshop.admin.migration.emails' => $migration_title . __('Emails', 'jigoshop'), 'jigoshop.admin.migration.options' => $migration_title . __('Options', 'jigoshop'), 'jigoshop.admin.migration.orders' => $migration_title . __('Orders', 'jigoshop'))));
     });
 }
Exemple #12
0
 public function __construct(Wordpress $wp, Options $options, $currentRange)
 {
     parent::__construct($wp, $options, $currentRange);
     // Prepare data for report
     $this->calculateCurrentRange();
     $this->getReportData();
     $this->getChartColours();
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('admin.php', 'options.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if ($screen->base != 'jigoshop_page_' . Reports::NAME) {
             return;
         }
         Styles::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/css/vendors/select2.css', array('jigoshop.admin.reports'));
         Scripts::add('jigoshop.vendors.select2', \JigoshopInit::getUrl() . '/assets/js/vendors/select2.js', array('jigoshop.admin.reports'), array('in_footer' => true));
         Scripts::localize('jigoshop.reports.chart', 'chart_data', $this->getMainChart());
     });
 }
Exemple #13
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');
     });
 }
Exemple #14
0
 public function __construct(Wordpress $wp, Options $options, Messages $messages, Template $template, $widgets = array())
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->messages = $messages;
     $this->template = $template;
     $this->widgets = $widgets;
     // Register main Jigoshop scripts
     $wp->wpEnqueueScript('jquery');
     Styles::register('jigoshop.shop', \JigoshopInit::getUrl() . '/assets/css/shop.css');
     Styles::register('prettyphoto', \JigoshopInit::getUrl() . '/assets/css/prettyPhoto.css');
     Styles::register('tokenfield', \JigoshopInit::getUrl() . '/assets/css/vendors/tokenfield.css');
     Scripts::register('jigoshop.helpers', \JigoshopInit::getUrl() . '/assets/js/helpers.js', array('jquery'));
     Scripts::register('jigoshop.helpers.ajax_search', \JigoshopInit::getUrl() . '/assets/js/helpers/ajax_search.js', array('jigoshop.helpers'));
     Scripts::register('jigoshop.helpers.payment', \JigoshopInit::getUrl() . '/assets/js/helpers/payment.js', array('jigoshop.helpers', 'jquery-blockui'));
     Scripts::register('jigoshop.api', \JigoshopInit::getUrl() . '/assets/js/api.js', array('jigoshop.helpers'));
     Scripts::register('jigoshop.media', \JigoshopInit::getUrl() . '/assets/js/media.js', array('jquery'));
     Scripts::register('jigoshop.shop', \JigoshopInit::getUrl() . '/assets/js/shop.js', array('jquery', 'jigoshop.helpers'));
     Scripts::register('jquery-blockui', '//cdnjs.cloudflare.com/ajax/libs/jquery.blockUI/2.66.0-2013.10.09/jquery.blockUI.min.js', array('jquery'));
     Scripts::register('prettyphoto', \JigoshopInit::getUrl() . '/assets/js/jquery.prettyPhoto.js');
     Scripts::register('tokenfield', \JigoshopInit::getUrl() . '/assets/js/vendors/tokenfield.js', array('jquery'));
     Scripts::localize('jigoshop.helpers', 'jigoshop_helpers', array('assets' => \JigoshopInit::getUrl() . '/assets', 'ajaxUrl' => admin_url('admin-ajax.php')));
 }
Exemple #15
0
 public function __construct(Wordpress $wp, Messages $messages, ProductServiceInterface $productService)
 {
     $this->wp = $wp;
     $this->messages = $messages;
     $this->productService = $productService;
     $wp->addAction('admin_enqueue_scripts', function () use($wp) {
         // Weed out all admin pages except the Jigoshop Settings page hits
         if (!in_array($wp->getPageNow(), array('edit.php'))) {
             return;
         }
         $screen = $wp->getCurrentScreen();
         if (!in_array($screen->base, array('product_page_' . Attributes::NAME))) {
             return;
         }
         Styles::add('jigoshop.admin.product_attributes', \JigoshopInit::getUrl() . '/assets/css/admin/product_attributes.css');
         Scripts::add('jigoshop.admin.product_attributes', \JigoshopInit::getUrl() . '/assets/js/admin/product_attributes.js', array('jquery', 'jigoshop.helpers'));
         Scripts::localize('jigoshop.admin.product_attributes', 'jigoshop_admin_product_attributes', array('i18n' => array('saved' => __('Changes saved.', 'jigoshop'), 'removed' => __('Attribute has been successfully removed.', 'jigoshop'), 'option_removed' => __('Attribute option has been successfully removed.', 'jigoshop'), 'confirm_remove' => __('Are you sure?', 'jigoshop'))));
     });
     $wp->addAction('wp_ajax_jigoshop.admin.product_attributes.save', array($this, 'ajaxSaveAttribute'));
     $wp->addAction('wp_ajax_jigoshop.admin.product_attributes.remove', array($this, 'ajaxRemoveAttribute'));
     $wp->addAction('wp_ajax_jigoshop.admin.product_attributes.save_option', array($this, 'ajaxSaveAttributeOption'));
     $wp->addAction('wp_ajax_jigoshop.admin.product_attributes.remove_option', array($this, 'ajaxRemoveAttributeOption'));
 }
Exemple #16
0
 /**
  * @param Wordpress $wp
  */
 public function addFrontendAssets(Wordpress $wp)
 {
     $post = $wp->getGlobalPost();
     $product = $this->productService->findForPost($post);
     if ($product instanceof Product\Variable) {
         $variations = array();
         foreach ($product->getVariations() as $variation) {
             /** @var $variation Product\Variable\Variation */
             $variations[$variation->getId()] = array('price' => $variation->getProduct()->getPrice(), 'html' => array('price' => \Jigoshop\Helper\Product::formatPrice($variation->getProduct()->getPrice())), 'attributes' => array());
             foreach ($variation->getAttributes() as $attribute) {
                 /** @var $attribute Product\Variable\Attribute */
                 $variations[$variation->getId()]['attributes'][$attribute->getAttribute()->getId()] = $attribute->getValue();
             }
         }
         Styles::add('jigoshop.product.variable', \JigoshopInit::getUrl() . '/assets/css/shop/product/variable.css');
         Scripts::add('jigoshop.product.variable', \JigoshopInit::getUrl() . '/assets/js/shop/product/variable.js', array('jquery'));
         Scripts::localize('jigoshop.product.variable', 'jigoshop_product_variable', array('variations' => $variations));
     }
 }