/** * Enqueue scripts * * Enqueue JavaScript used by the meta panels. * * @since 1.0 */ function jigoshop_write_panel_scripts() { $post_type = jigoshop_get_current_post_type(); if( $post_type !== 'product' && $post_type !== 'shop_order' ) return; wp_register_script('jigoshop-date', jigoshop::plugin_url() . '/assets/js/date.js'); wp_register_script('jigoshop-datepicker', jigoshop::plugin_url() . '/assets/js/datepicker.js', array('jquery', 'jigoshop-date')); wp_enqueue_script('jigoshop-datepicker'); wp_register_script('jigoshop-writepanel', jigoshop::plugin_url() . '/assets/js/write-panels.js', array('jquery')); wp_enqueue_script('jigoshop-writepanel'); wp_register_script( 'medialibrary-uploader', jigoshop::plugin_url() . '/assets/js/medialibrary-uploader.js', array( 'jquery', 'thickbox' ) ); wp_enqueue_script( 'medialibrary-uploader' ); wp_enqueue_script( 'media-upload' ); $data = array( 'remove_item_notice' => __("Remove this item? If you have previously reduced this item's stock, or this order was submitted by a customer, will need to manually restore the item's stock.", 'jigoshop'), 'cart_total' => __("Calc totals based on order items, discount amount, and shipping?", 'jigoshop'), 'copy_billing' => __("Copy billing information to shipping information? This will remove any currently entered shipping information.", 'jigoshop'), 'prices_include_tax' => get_option('jigoshop_prices_include_tax'), 'ID' => __('ID', 'jigoshop'), 'item_name' => __('Item Name', 'jigoshop'), 'quantity' => __('Quantity e.g. 2', 'jigoshop'), 'cost_unit' => __('Cost per unit e.g. 2.99', 'jigoshop'), 'tax_rate' => __('Tax Rate e.g. 20.0000', 'jigoshop'), ); wp_localize_script( 'jigoshop-writepanel', 'jigoshop_wp', $data ); }
/** * Enqueue scripts * Enqueue JavaScript used by the meta panels. * * @since 1.0 */ function jigoshop_write_panel_scripts() { $options = Jigoshop_Base::get_options(); $post_type = jigoshop_get_current_post_type(); if ($post_type !== 'product' && $post_type !== 'shop_order' && $post_type !== 'shop_coupon' && $post_type !== 'shop_email') { return; } wp_enqueue_script('jquery-ui-datepicker'); jrto_enqueue_script('admin', 'jigoshop_datetimepicker', JIGOSHOP_URL . '/assets/js/jquery-ui-timepicker-addon.min.js', array('jquery', 'jquery-ui-datepicker')); jrto_enqueue_script('admin', 'jigoshop-select2', JIGOSHOP_URL . '/assets/js/select2.min.js', array('jquery')); jrto_enqueue_script('admin', 'jigoshop-writepanel', JIGOSHOP_URL . '/assets/js/write-panels.js', array('jquery', 'jigoshop-select2')); jrto_enqueue_script('admin', 'jigoshop-bootstrap-tooltip', JIGOSHOP_URL . '/assets/js/bootstrap-tooltip.min.js', array('jquery'), array('version' => '2.0.3')); wp_enqueue_script('media-upload'); wp_enqueue_script('thickbox'); wp_enqueue_style('thickbox'); $params = array('remove_item_notice' => __("Remove this item? If you have previously reduced this item's stock, or this order was submitted by a customer, will need to manually restore the item's stock.", 'jigoshop'), 'cart_total' => __('Calc totals based on order items and taxes?', 'jigoshop'), 'copy_billing' => __('Copy billing information to shipping information? This will remove any currently entered shipping information.', 'jigoshop'), 'prices_include_tax' => $options->get('jigoshop_prices_include_tax'), 'ID' => __('ID', 'jigoshop'), 'item_name' => __('Item Name', 'jigoshop'), 'quantity' => __('Quantity e.g. 2', 'jigoshop'), 'cost_unit' => __('Cost per unit e.g. 2.99', 'jigoshop'), 'tax_rate' => __('Tax Rate e.g. 20.0000', 'jigoshop'), 'meta_name' => __('Meta Name', 'jigoshop'), 'meta_value' => __('Meta Value', 'jigoshop'), 'custom_attr_heading' => __('Custom Attribute', 'jigoshop'), 'display_attr_label' => __('Display on product page', 'jigoshop'), 'variation_attr_label' => __('Is for variations', 'jigoshop'), 'confirm_remove_attr' => __('Remove this attribute?', 'jigoshop'), 'assets_url' => JIGOSHOP_URL, 'ajax_url' => admin_url('admin-ajax.php'), 'add_order_item_nonce' => wp_create_nonce('add-order-item')); jrto_localize_script('jigoshop-writepanel', 'jigoshop_params', $params); }