/** * @return array List of items to display. */ public function getSections() { if (empty($this->sections)) { $this->sections = array(array('title' => __('Get System Information', 'jigoshop'), 'id' => 'get-system-information', 'description' => __('Please copy and paste this information in your ticket when contacting support', 'jigoshop'), 'fields' => array(array('id' => 'debug_report', 'title' => '', 'generate_button_id' => 'generate-report', 'debug_textarea_id' => 'report-for-support', 'generate_button_label' => __('Generate Report', 'jigoshop'), 'type' => 'user_defined', 'display' => function ($field) { return Render::output('admin/system_info/debug_report', $field); }))), array('title' => __('WordPress Environment', 'jigoshop'), 'id' => 'wordpress-environment', 'fields' => array(array('id' => 'home-url', 'name' => 'home-url', 'title' => __('Home URL', 'jigoshop'), 'tip' => __('The URL of your site\'s homepage.', 'jigoshop'), 'type' => 'constant', 'value' => home_url()), array('id' => 'site-url', 'name' => 'site-url', 'title' => __('Site URL', 'jigoshop'), 'tip' => __('The root URL of your site.', 'jigoshop'), 'type' => 'constant', 'value' => site_url()), array('id' => 'jigoshop-version', 'name' => 'jigoshop-version', 'title' => __('Jigoshop Version', 'jigoshop'), 'tip' => __('The version of Jigoshop installed on your site.', 'jigoshop'), 'type' => 'constant', 'value' => Core::VERSION), array('id' => 'jigoshop-database-version', 'name' => 'jigoshop-database-version', 'title' => __('Jigoshop Database Version', 'jigoshop'), 'tip' => __('The version of jigoshop that the database is formatted for. This should be the same as your jigoshop Version.', 'jigoshop'), 'type' => 'constant', 'value' => $this->wp->getOption('jigoshop-database-version')), array('id' => 'log-directory-writable', 'name' => 'log-directory-writable', 'title' => __('Log Directory Writable', 'jigoshop'), 'tip' => __('Several Jigoshop extensions can write logs which makes debugging problems easier. The directory must be writable for this to happen.', 'jigoshop'), 'description' => sprintf(__('To allow logging, make <code>%s</code> writable or define a custom <code>JIGOSHOP_LOG_DIR</code>.', 'jigoshop'), JIGOSHOP_LOG_DIR), 'type' => 'constant', 'value' => $this->checkLogDirectory() ? $this->yes : $this->no), array('id' => 'wp-version', 'name' => 'wp-version', 'title' => __('WP Version', 'jigoshop'), 'tip' => __('The version of WordPress installed on your site.', 'jigoshop'), 'type' => 'constant', 'value' => get_bloginfo('version')), array('id' => 'wp-multisite', 'name' => 'wp-multisite', 'title' => __('WP Multisite', 'jigoshop'), 'tip' => __('The maximum amount of memory (RAM) that your site can use at one time.', 'jigoshop'), 'type' => 'constant', 'value' => is_multisite() ? $this->yes : $this->no), array('id' => 'wp-memory-limit', 'name' => 'wp-memory-limit', 'title' => __('WP Memory Limit', 'jigoshop'), 'tip' => __('The maximum amount of memory (RAM) that your site can use at one time.', 'jigoshop'), 'type' => 'constant', 'value' => $this->checkMemoryLimit(WP_MEMORY_LIMIT, JIGOSHOP_REQUIRED_WP_MEMORY)), array('id' => 'wp-debug-mode', 'name' => 'wp-debug-mode', 'title' => __('WP Debug Mode', 'jigoshop'), 'tip' => __('Displays whether or not WordPress is in Debug Mode.', 'jigoshop'), 'type' => 'constant', 'value' => defined('WP_DEBUG') && WP_DEBUG ? $this->yes : $this->no), array('id' => 'language', 'name' => 'language', 'title' => __('Language', 'jigoshop'), 'tip' => __('The current language used by WordPress. Default = English.', 'jigoshop'), 'type' => 'constant', 'value' => get_locale()))), array('title' => __('Server Environment', 'jigoshop'), 'id' => 'srever-environment', 'fields' => array(array('id' => 'server-info', 'name' => 'server-info', 'title' => __('Server Info', 'jigoshop'), 'tip' => __('Information about the web server that is currently hosting your site.', 'jigoshop'), 'type' => 'constant', 'value' => esc_html($_SERVER['SERVER_SOFTWARE'])), array('id' => 'php-version', 'name' => 'php-version', 'title' => __('PHP Version', 'jigoshop'), 'tip' => __('The version of PHP installed on your hosting server.', 'jigoshop'), 'type' => 'constant', 'value' => $this->checkPhpVersion(PHP_VERSION, JIGOSHOP_PHP_VERSION)), array('id' => 'php-post-max-size', 'name' => 'php-post-max-size', 'title' => __('PHP Post Max Size', 'jigoshop'), 'tip' => __('The largest filesize that can be contained in one post.', 'jigoshop'), 'type' => 'constant', 'value' => size_format($this->letterToNumber($this->iniGet('post_max_size')))), array('id' => 'php-time-limit', 'name' => 'php-time-limit', 'title' => __('PHP Time Limit', 'jigoshop'), 'tip' => __('The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'jigoshop'), 'type' => 'constant', 'value' => size_format($this->letterToNumber($this->iniGet('post_max_size')))), array('id' => 'php-time-limit', 'name' => 'php-time-limit', 'title' => __('PHP Max Input Vars', 'jigoshop'), 'tip' => __('The maximum number of variables your server can use for a single function to avoid overloads.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('max_input_vars')), array('id' => 'suhosin-installed', 'name' => 'suhosin-installed', 'title' => __('SUHOSIN Installed', 'jigoshop'), 'tip' => __('Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'jigoshop'), 'type' => 'constant', 'value' => extension_loaded('suhosin') ? $this->yes : $this->no), array('id' => 'eaccelerator', 'name' => 'eaccelerator', 'title' => __('eAccelerator', 'jigoshop'), 'classes' => array('system-data'), 'tip' => __('eAccelerator is deprecated and causes problems with Jigoshop.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('eaccelerator.enable') == 1 ? $this->yes : $this->no), array('id' => 'apc', 'name' => 'apc', 'title' => __('APC', 'jigoshop'), 'tip' => __('APC is deprecated and causes problems with Jigoshop.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('apc.enable') == 1 ? $this->yes : $this->no), array('id' => 'apc', 'name' => 'apc', 'title' => __('OpCache', 'jigoshop'), 'tip' => __('OpCache is new PHP optimizer and it is recommended to use with Jigoshop.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('opcache.enable') == 1 ? $this->yes : $this->no), array('id' => 'short-open-tag', 'name' => 'short-open-tag', 'title' => __('Short Open Tag', 'jigoshop'), 'tip' => __('Whether short tags are enabled, they are used by some older extensions.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('short-open-tag') != '' ? $this->yes : $this->no), array('id' => 'allow-url-fopen', 'name' => 'allow-url-fopen', 'title' => __('Allow URL fopen', 'jigoshop'), 'tip' => __('Whether fetching remote files is allowed. This option is used by many Jigoshop extensions.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('allow_url_fopen') != '' ? $this->yes : $this->no), array('id' => 'session', 'name' => 'session', 'title' => __('Session', 'jigoshop'), 'tip' => __('Whether fetching remote files is allowed. This option is used by many Jigoshop extensions.', 'jigoshop'), 'type' => 'constant', 'value' => session_id() != null && isset($_SESSION) ? $this->yes : $this->no), array('id' => 'cookie-path', 'name' => 'cookie-path', 'title' => __('Cookie Path', 'jigoshop'), 'tip' => __('Path for which cookies are saved. This is important for sessions and session security.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('session.cookie_path')), array('id' => 'save-path', 'name' => 'save-path', 'title' => __('Save Path', 'jigoshop'), 'tip' => __('Path where sessions are stored on the server. This is sometimes cause of login/logout problems.', 'jigoshop'), 'type' => 'constant', 'value' => esc_html($this->iniGet('session.save_path'))), array('id' => 'use-cookies', 'name' => 'use-cookies', 'title' => __('Use Cookies', 'jigoshop'), 'tip' => __('Whether cookies are used to store PHP session on user\'s computer. Recommended.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('session.use_cookies') != '' ? $this->yes : $this->no), array('id' => 'use-only-cookies', 'name' => 'use-only-cookies', 'title' => __('Use Only Cookies', 'jigoshop'), 'tip' => __('Whether PHP uses only cookies to handle user sessions. This is important for security reasons.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('session.use_only_cookies') != '' ? $this->yes : $this->no), array('id' => 'max-upload-size', 'name' => 'max-upload-size', 'title' => __('Max Upload Size', 'jigoshop'), 'tip' => __('The largest filesize that can be uploaded to your WordPress installation.', 'jigoshop'), 'type' => 'constant', 'value' => size_format(wp_max_upload_size())), array('id' => 'default-timezone', 'name' => 'default-timezone', 'title' => __('Default Timezone', 'jigoshop'), 'tip' => __('The default timezone for your server. We recommend to set it as UTC.', 'jigoshop'), 'type' => 'constant', 'value' => date_default_timezone_get()), array('id' => 'fsockopen-curl', 'name' => 'fsockopen-curl', 'title' => __('fsockopen/cURL', 'jigoshop'), 'tip' => __('Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'jigoshop'), 'type' => 'constant', 'value' => function_exists('fsockopen') || function_exists('curl_init') ? $this->yes : $this->no), array('id' => 'soap-client', 'name' => 'soap-client', 'title' => __('SoapClient', 'jigoshop'), 'tip' => __('Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'jigoshop'), 'type' => 'constant', 'value' => class_exists('SoapClient') ? $this->yes : $this->no), array('id' => 'wp-remote-post', 'name' => 'wp-remote-post', 'title' => __('Remote Post', 'jigoshop'), 'tip' => __('PayPal uses this method of communicating when sending back transaction information.', 'jigoshop'), 'type' => 'constant', 'value' => $this->checkRemoteRequest('post') ? $this->yes : $this->no), array('id' => 'wp-remote-get', 'name' => 'wp-remote-get', 'title' => __('Remote Get', 'jigoshop'), 'tip' => __('PayJigoshop plugins may use this method of communication when checking for plugin updates.', 'jigoshop'), 'type' => 'constant', 'value' => $this->checkRemoteRequest('get') ? $this->yes : $this->no))), array('title' => __('Server Locale', 'jigoshop'), 'id' => 'srever-locale', 'fields' => array(array('id' => 'decimal-point', 'name' => 'decimal-point', 'title' => __('Decimal Point', 'jigoshop'), 'tip' => __('The character used for decimal points.', 'jigoshop'), 'type' => 'constant', 'value' => $this->getServerLocale('decimal_point') ? $this->getServerLocale('decimal_point') : $this->no), array('id' => 'thousands-sep', 'name' => 'thousands-sep', 'title' => __('Thousands Separator', 'jigoshop'), 'tip' => __('The character used for a thousands separator.', 'jigoshop'), 'type' => 'constant', 'value' => $this->getServerLocale('thousands_sep') ? $this->getServerLocale('thousands_sep') : $this->no), array('id' => 'mon-decimal-point', 'name' => 'mon-decimal-point', 'title' => __('Monetary Decimal Point', 'jigoshop'), 'tip' => __('The character used for decimal points in monetary values.', 'jigoshop'), 'type' => 'constant', 'value' => $this->getServerLocale('mon_decimal_point') ? $this->getServerLocale('mon_decimal_point') : $this->no), array('id' => 'mon-thousands-sep', 'name' => 'mon-thousands-sep', 'title' => __('Monetary Thousands Separator', 'jigoshop'), 'tip' => __('The character used for a thousands separator in monetary values.', 'jigoshop'), 'type' => 'constant', 'value' => $this->getServerLocale('mon_thousands_sep') ? $this->getServerLocale('mon_thousands_sep') : $this->no))), array('title' => sprintf(__('Active Plugins (%s)', 'jigoshop'), count((array) $this->wp->getOption('active_plugins'))), 'id' => 'active-plugins', 'fields' => $this->getActivePlugins()), array('title' => __('Settings', 'jigoshop'), 'id' => 'settings', 'fields' => array(array('id' => 'force-ssl', 'name' => 'force-ssl', 'title' => __('Force SSL', 'jigoshop'), 'tip' => __('Does your site force a SSL Certificate for transactions?', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('shopping.force_ssl') ? $this->yes : $this->no), array('id' => 'shipping-enabled', 'name' => 'shipping-enabled', 'title' => __('Shipping Enabled', 'jigoshop'), 'tip' => __('Does your site have shipping enabled?', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('shipping.enabled') ? $this->yes : $this->no), array('id' => 'currency', 'name' => 'currency', 'title' => __('Shipping Enabled', 'jigoshop'), 'tip' => __('What currency prices are listed at in the catalog and which currency gateways will take payments in?', 'jigoshop'), 'type' => 'constant', 'value' => Currency::code() . '(' . Currency::symbol() . ')'), array('id' => 'currency-position', 'name' => 'currency-position', 'title' => __('Currency Position', 'jigoshop'), 'tip' => __('The position of the currency symbol.', 'jigoshop'), 'type' => 'constant', 'value' => $this->getCurrencyPosition()), array('id' => 'thousand-separator', 'name' => 'thousand-separator', 'title' => __('Thousand Separator', 'jigoshop'), 'tip' => __('The thousand separator of displayed prices.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('general.currency_thousand_separator')), array('id' => 'decimal-separator', 'name' => 'decimal-separator', 'title' => __('Decimal Separator', 'jigoshop'), 'tip' => __('The decimal separator of displayed prices.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('general.currency_decimal_separator')), array('id' => 'number-of-decimals', 'name' => 'number-of-decimals', 'title' => __('Number of Decimals', 'jigoshop'), 'tip' => __('The number of decimal points shown in displayed prices.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('general.currency_decimals')))), array('title' => __('Jigoshop Pages', 'jigoshop'), 'id' => 'jigoshop-pages', 'fields' => array(array('id' => 'shop-base', 'name' => 'shop-base', 'title' => __('Shop Base', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s homepage.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.shop') ? '#' . $this->options->get('advanced.pages.shop') : $this->no), array('id' => 'cart', 'name' => 'cart', 'title' => __('Cart', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s cart page.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.cart') ? '#' . $this->options->get('advanced.pages.cart') : $this->no), array('id' => 'checkout', 'name' => 'checkout', 'title' => __('Checkout', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s checkout page.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.checkout') ? '#' . $this->options->get('advanced.pages.checkout') : $this->no), array('id' => 'thank-you', 'name' => 'thank-you', 'title' => __('Thank You', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s thank you page.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.checkout_thank_you') ? '#' . $this->options->get('advanced.pages.checkout_thank_you') : $this->no), array('id' => 'my-account', 'name' => 'my-account', 'title' => __('My account', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s my account page.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.account') ? '#' . $this->options->get('advanced.pages.account') : $this->no), array('id' => 'terms', 'name' => 'terms', 'title' => __('Terms', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s terms page.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.terms') ? '#' . $this->options->get('advanced.pages.terms') : $this->no))), array('title' => __('Theme', 'jigoshop'), 'id' => 'theme', 'fields' => array(array('id' => 'name', 'name' => 'name', 'title' => __('Name', 'jigoshop'), 'tip' => __('The name of the current active theme.', 'jigoshop'), 'type' => 'constant', 'value' => $this->wp->wpGetTheme()->display('Name')), array('id' => 'version', 'name' => 'version', 'title' => __('Version', 'jigoshop'), 'tip' => __('The installed version of the current active theme.', 'jigoshop'), 'type' => 'constant', 'value' => $this->wp->wpGetTheme()->display('Version')), array('id' => 'author-url', 'name' => 'author-url', 'title' => __('Author URL', 'jigoshop'), 'tip' => __('The theme developers URL.', 'jigoshop'), 'type' => 'constant', 'value' => $this->wp->wpGetTheme()->display('AuthorURI')), array('id' => 'child-theme', 'name' => 'child-theme', 'title' => __('Child Theme', 'jigoshop'), 'tip' => __('Displays whether or not the current theme is a child theme', 'jigoshop'), 'description' => sprintf(__('If you\'re modifying Jigoshop or a parent theme you didn\'t build personally we recommend using a child theme. See: <a href="%s" target="-blank">How to create a child theme</a>', 'jigoshop'), 'https://codex.wordpress.org/Child_Themes'), 'type' => 'constant', 'value' => is_child_theme() ? $this->yes : $this->no), array('id' => 'parent-theme-name', 'name' => 'parent-theme-name', 'title' => __('Parent Theme Name', 'jigoshop'), 'tip' => __('The name of the parent theme.', 'jigoshop'), 'type' => 'constant', 'value' => is_child_theme() ? wp_get_theme($this->wp->wpGetTheme()->display('Template'))->display('Name') : $this->no), array('id' => 'parent-theme-version', 'name' => 'parent-theme-version', 'title' => __('Parent Theme Version', 'jigoshop'), 'tip' => __('The installed version of the parent theme.', 'jigoshop'), 'type' => 'constant', 'value' => is_child_theme() ? wp_get_theme($this->wp->wpGetTheme()->display('Template'))->display('Version') : $this->no), array('id' => 'parent-theme-author-url', 'name' => 'parent-theme-author-url', 'title' => __('Parent Theme Author URL', 'jigoshop'), 'tip' => __('The installed version of the parent theme.', 'jigoshop'), 'type' => 'constant', 'value' => is_child_theme() ? wp_get_theme($this->wp->wpGetTheme()->display('Template'))->display('AuthorURI') : $this->no))), array('title' => __('Templates', 'jigoshop'), 'id' => 'templates', 'description' => __('This section shows any files that are overriding the default jigoshop template pages', 'jigoshop'), 'fields' => $this->getOverrides())); } return $this->sections; }
<thead> <tr> <th scope="col"><?php Forms::constant(array('name' => 'order[items][id]', 'value' => __('ID', 'jigoshop'))); ?> </th> <th scope="col"><?php Forms::constant(array('name' => 'order[items][sku]', 'value' => __('SKU', 'jigoshop'))); ?> </th> <th scope="col"><?php Forms::constant(array('size' => 12, 'name' => 'order[items][name]', 'value' => __('Name', 'jigoshop'))); ?> </th> <th scope="col"><?php Forms::constant(array('size' => 12, 'name' => 'order[items][unit_price]', 'value' => sprintf(__('Unit price (%s)', 'jigoshop'), Currency::symbol()))); ?> </th> <th scope="col"><?php Forms::constant(array('size' => 12, 'name' => 'order[items][qty]', 'value' => __('Quantity', 'jigoshop'))); ?> </th> <th scope="col"><?php Forms::constant(array('name' => 'order[items][id][price]', 'value' => __('Price', 'jigoshop'))); ?> </th> <th scope="col"></th> </tr> </thead> <tbody> <?php
Render::output('admin/order/totals/shipping/method', array('method' => $method, 'order' => $order)); ?> <?php } ?> <?php } ?> </ul> </div> </div> <?php Forms::constant(array('name' => 'order[subtotal]', 'id' => 'subtotal', 'label' => __('Subtotal', 'jigoshop'), 'placeholder' => 0.0, 'size' => 12, 'value' => Product::formatPrice($order->getSubtotal()))); ?> <?php Forms::text(array('name' => 'order[discount]', 'label' => sprintf(__('Discount (%s)', 'jigoshop'), Currency::symbol()), 'placeholder' => 0.0, 'value' => $order->getDiscount())); ?> <?php foreach ($tax as $class => $option) { ?> <?php Forms::constant(array('name' => 'order[tax][' . $class . ']', 'label' => $option['label'], 'placeholder' => 0.0, 'value' => $option['value'], 'size' => 12, 'classes' => array($orderTax[$class] > 0 ? '' : 'not-active'))); ?> <?php } ?> <?php Forms::constant(array('name' => 'order[total]', 'id' => 'total', 'label' => __('Total', 'jigoshop'), 'placeholder' => 0.0, 'size' => 12, 'value' => Product::formatPrice($order->getTotal()))); ?> <?php do_action('jigoshop\\admin\\order\\totalsBox\\after_total', $order);
public function getMainChart() { global $wp_locale; // Prepare data for report $orderItemCounts = $this->prepareChartData($this->reportData->orderItems, 'post_date', 'order_item_count', $this->chartInterval, $this->range['start'], $this->chartGroupBy); $orderItemAmounts = $this->prepareChartData($this->reportData->orderItems, 'post_date', 'order_item_amount', $this->chartInterval, $this->range['start'], $this->chartGroupBy); $orderItemQuantity = $this->prepareChartData($this->reportData->orderItems, 'post_date', 'order_item_quantity', $this->chartInterval, $this->range['start'], $this->chartGroupBy); $data = array(); $data['series'] = array(); $data['series'][] = $this->arrayToObject(array('label' => __('Sold quantity', 'jigoshop'), 'data' => array_values($orderItemQuantity), 'color' => $this->chartColours['item_quantity'], 'bars' => $this->arrayToObject(array('fillColor' => $this->chartColours['item_quantity'], 'fill' => true, 'show' => true, 'lineWidth' => 0, 'align' => 'left', 'barWidth' => $this->barwidth * 0.4)), 'shadowSize' => 0, 'hoverable' => false)); $data['series'][] = $this->arrayToObject(array('label' => __('Number of items sold', 'jigoshop'), 'data' => array_values($orderItemCounts), 'color' => $this->chartColours['item_count'], 'bars' => $this->arrayToObject(array('fillColor' => $this->chartColours['item_count'], 'fill' => true, 'show' => true, 'lineWidth' => 0, 'align' => 'right', 'barWidth' => $this->barwidth * 0.4)), 'shadowSize' => 0, 'hoverable' => false)); $data['series'][] = $this->arrayToObject(array('label' => __('Sales amount', 'jigoshop'), 'data' => array_values($orderItemAmounts), 'yaxis' => 2, 'color' => $this->chartColours['sales_amount'], 'points' => $this->arrayToObject(array('show' => true, 'radius' => 5, 'lineWidth' => 3, 'fillColor' => '#fff', 'fill' => true)), 'lines' => $this->arrayToObject(array('show' => true, 'lineWidth' => 4, 'fill' => false)), 'shadowSize' => 0, 'append_tooltip' => Currency::symbol())); $data['options'] = $this->arrayToObject(array('legend' => $this->arrayToObject(array('show' => false)), 'grid' => $this->arrayToObject(array('color' => '#aaa', 'borderColor' => 'transparent', 'borderWidth' => 0, 'hoverable' => true)), 'xaxes' => array($this->arrayToObject(array('color' => '#aaa', 'position' => 'bottom', 'tickColor' => 'transparent', 'mode' => 'time', 'timeformat' => $this->chartGroupBy == 'hour' ? '%H' : $this->chartGroupBy == 'day' ? '%d %b' : '%b', 'monthNames' => array_values($wp_locale->month_abbrev), 'tickLength' => 1, 'minTickSize' => array(1, $this->chartGroupBy), 'font' => $this->arrayToObject(array('color' => '#aaa'))))), 'yaxes' => array($this->arrayToObject(array('min' => 0, 'minTickSize' => 1, 'tickDecimals' => 0, 'color' => '#ecf0f1', 'font' => $this->arrayToObject(array('color' => '#aaa')))), $this->arrayToObject(array('position' => 'right', 'min' => 0, 'tickDecimals' => 2, 'alignTicksWithAxis' => 1, 'color' => 'transparent', 'font' => $this->arrayToObject(array('color' => '#aaa'))))))); if ($this->chartGroupBy == 'hour') { $data['options']->xaxes[0]->min = 0; $data['options']->xaxes[0]->max = 24 * 60 * 60 * 1000; } return $data; }
public function getMainChart() { global $wp_locale; $chartData = array(); $index = 0; foreach ($this->showCategories as $category) { $category = get_term($category, 'product_category'); $productIds = $this->getProductsInCategory($category->term_id); $categoryTotal = 0; $categoryChartData = array(); for ($i = 0; $i <= $this->chartInterval; $i++) { $intervalTotal = 0; switch ($this->chartGroupBy) { case 'hour': $time = strtotime(date('YmdHi', strtotime($this->range['start']))) + $i * 3600000; break; case 'day': $time = strtotime(date('Ymd', strtotime("+{$i} DAY", $this->range['start']))) * 1000; break; case 'month': default: $time = strtotime(date('Ym', strtotime("+{$i} MONTH", $this->range['start'])) . '01') * 1000; break; } foreach ($productIds as $id) { if (isset($this->reportData->itemSalesAndTimes[$time][$id])) { $intervalTotal += $this->reportData->itemSalesAndTimes[$time][$id]; $categoryTotal += $this->reportData->itemSalesAndTimes[$time][$id]; } } $categoryChartData[] = array($time, $intervalTotal); } $chartData[$category->term_id]['category'] = $category->name; $chartData[$category->term_id]['data'] = $categoryChartData; $index++; } $index = 0; $data = array(); $data['series'] = array(); foreach ($chartData as $singleData) { $width = $this->barwidth / sizeof($chartData); $offset = $width * $index; foreach ($singleData['data'] as $key => $seriesData) { $singleData['data'][$key][0] = $seriesData[0] + $offset; } $data['series'][] = $this->arrayToObject(array('label' => esc_js($singleData['category']), 'data' => $singleData['data'], 'color' => $this->chartColours[$index % sizeof($this->chartColours)], 'bars' => $this->arrayToObject(array('fillColor' => $this->chartColours[$index % sizeof($this->chartColours)], 'fill' => true, 'show' => true, 'lineWidth' => 1, 'align' => 'center', 'barWidth' => $width * 0.8, 'stack' => false)), 'append_tooltip' => Currency::symbol(), 'enable_tooltip' => true)); $index++; } $data['options'] = $this->arrayToObject(array('legend' => $this->arrayToObject(array('show' => false)), 'grid' => $this->arrayToObject(array('color' => '#aaa', 'borderColor' => 'transparent', 'borderWidth' => 0, 'hoverable' => true)), 'xaxes' => array($this->arrayToObject(array('color' => '#aaa', 'reserveSpace' => false, 'position' => 'bottom', 'tickColor' => 'transparent', 'mode' => 'time', 'timeformat' => $this->chartGroupBy == 'hour' ? '%H' : $this->chartGroupBy == 'day' ? '%d %b' : '%b', 'monthNames' => array_values($wp_locale->month_abbrev), 'tickLength' => 1, 'minTickSize' => array(1, $this->chartGroupBy), 'tickSize' => array(1, $this->chartGroupBy), 'font' => $this->arrayToObject(array('color' => '#aaa'))))), 'yaxes' => array($this->arrayToObject(array('min' => 0, 'tickDecimals' => 2, 'color' => '#d4d9dc', 'font' => $this->arrayToObject(array('color' => '#aaa'))))))); if ($this->chartGroupBy == 'hour') { $data['options']->xaxes[0]->min = 0; $data['options']->xaxes[0]->max = 24 * 60 * 60 * 1000; } return $data; }
/** * @return array */ public function getMainChart() { global $wp_locale; $startTime = $this->range['start']; $endTime = $this->range['end']; $filterTimes = function ($item) use($startTime, $endTime) { $time = strtotime($item->post_date); return $time >= $startTime && $time < $endTime; }; // Prepare data for report $orderCouponCounts = $this->prepareChartData(array_filter($this->reportData->orderCouponCounts, $filterTimes), 'post_date', 'order_coupon_count', $this->chartInterval, $this->range['start'], $this->chartGroupBy); $orderDiscountAmounts = $this->prepareChartData(array_filter($this->reportData->orderDiscountAmounts, $filterTimes), 'post_date', 'discount_amount', $this->chartInterval, $this->range['start'], $this->chartGroupBy); $data = array(); $data['series'] = array(); $data['series'][] = $this->arrayToObject(array('label' => esc_js(__('Number of coupons used', 'jigoshop')), 'data' => array_values($orderCouponCounts), 'color' => $this->chartColours['coupon_count'], 'bars' => $this->arrayToObject(array('fillColor' => $this->chartColours['coupon_count'], 'fill' => true, 'show' => true, 'lineWidth' => 0, 'align' => 'center', 'barWidth' => $this->barwidth * 0.8)), 'shadowSize' => 0, 'hoverable' => false)); $data['series'][] = $this->arrayToObject(array('label' => esc_js(__('Discount amount', 'jigoshop')), 'data' => array_values($orderDiscountAmounts), 'yaxis' => 2, 'color' => $this->chartColours['discount_amount'], 'points' => $this->arrayToObject(array('show' => true, 'radius' => 5, 'lineWidth' => 4, 'fillColor' => '#fff', 'fill' => true)), 'lines' => $this->arrayToObject(array('show' => true, 'lineWidth' => 4, 'fill' => false)), 'shadowSize' => 0, 'append_tooltip' => Currency::symbol())); $data['options'] = $this->arrayToObject(array('legend' => $this->arrayToObject(array('show' => false)), 'grid' => $this->arrayToObject(array('color' => '#aaa', 'borderColor' => 'transparent', 'borderWidth' => 0, 'hoverable' => true)), 'xaxes' => array($this->arrayToObject(array('color' => '#aaa', 'position' => 'bottom', 'tickColor' => 'transparent', 'mode' => 'time', 'timeformat' => $this->chartGroupBy == 'hour' ? '%H' : $this->chartGroupBy == 'day' ? '%d %b' : '%b', 'monthNames' => array_values($wp_locale->month_abbrev), 'tickLength' => 1, 'minTickSize' => array(1, $this->chartGroupBy), 'font' => $this->arrayToObject(array('color' => '#aaa'))))), 'yaxes' => array($this->arrayToObject(array('min' => 0, 'minTickSize' => 1, 'tickDecimals' => 0, 'color' => '#ecf0f1', 'font' => $this->arrayToObject(array('color' => '#aaa')))), $this->arrayToObject(array('position' => 'right', 'min' => 0, 'tickDecimals' => 2, 'alignTicksWithAxis' => 1, 'autoscaleMargin' => 0, 'color' => 'transparent', 'font' => $this->arrayToObject(array('color' => '#aaa'))))))); if ($this->chartGroupBy == 'hour') { $data['options']->xaxes[0]->min = 0; $data['options']->xaxes[0]->max = 24 * 60 * 60 * 1000; } return $data; }
/** * @param $price float Price to format. * * @return string Formatted price with currency symbol. */ public static function formatPrice($price) { if ($price === 0.0) { return __('Free', 'jigoshop'); } if ($price !== '') { return sprintf(Currency::format(), Currency::symbol(), Currency::code(), self::formatNumericPrice($price)); } return __('Price not announced.', 'jigoshop'); }
<input type="hidden" id="min_price" name="min_price" value="0" /> <?php \Jigoshop\Helper\Forms::printHiddenFields($fields, array('max_price', 'min_price')); ?> </div> <div class="clear"></div> </div> </form> <script type="text/javascript"> /*<![CDATA[*/ jQuery(document).ready(function($){ // Price slider var min_price = parseInt($('.price_slider_amount #min_price').val()); var max_price = parseInt($('.price_slider_amount #max_price').val()); var html = '<?php echo sprintf(Currency::format(), Currency::symbol(), Currency::code(), '%s%'); ?> '; var current_min_price, current_max_price; current_min_price = min_price; current_max_price = max_price; $('.price_slider').slider({ range: true, min: min_price, max: max_price, values: [min_price, max_price], create: function(){ $(".price_slider_amount span").html(html.replace(/%s%/g, min_price) + " - " + html.replace(/%s%/g, max_price)); $(".price_slider_amount #min_price").val(current_min_price); $(".price_slider_amount #max_price").val(current_max_price); },
<?php use Jigoshop\Admin\Helper\Forms; use Jigoshop\Entity\Product; use Jigoshop\Helper\Currency; use Jigoshop\Helper\Product as ProductHelper; /** * @var $product Product The product. */ ?> <fieldset> <?php Forms::text(array('name' => 'product[regular_price]', 'label' => __('Price', 'jigoshop') . ' (' . Currency::symbol() . ')', 'placeholder' => __('Price not announced', 'jigoshop'), 'classes' => array('product-simple', $product instanceof Product\Purchasable ? '' : 'not-active'), 'value' => $product instanceof Product\Purchasable ? $product->getRegularPrice() : 0)); Forms::text(array('name' => 'product[sku]', 'label' => __('SKU', 'jigoshop'), 'value' => $product->getSku(), 'placeholder' => $product->getId())); Forms::text(array('name' => 'product[brand]', 'label' => __('Brand', 'jigoshop'), 'value' => $product->getBrand())); Forms::text(array('name' => 'product[gtin]', 'label' => __('GTIN', 'jigoshop'), 'tip' => 'Global Trade Item Number', 'value' => $product->getGtin())); Forms::text(array('name' => 'product[mpn]', 'label' => __('MPN', 'jigoshop'), 'tip' => 'Manufacturer Part Number', 'value' => $product->getMpn())); ?> </fieldset> <fieldset> <?php Forms::text(array('name' => 'product[size_weight]', 'label' => __('Weight', 'jigoshop') . ' (' . ProductHelper::weightUnit() . ')', 'value' => $product->getSize()->getWeight())); Forms::text(array('name' => 'product[size_length]', 'label' => __('Length', 'jigoshop') . ' (' . ProductHelper::dimensionsUnit() . ')', 'value' => $product->getSize()->getLength())); Forms::text(array('name' => 'product[size_width]', 'label' => __('Width', 'jigoshop') . ' (' . ProductHelper::dimensionsUnit() . ')', 'value' => $product->getSize()->getWidth())); Forms::text(array('name' => 'product[size_height]', 'label' => __('Height', 'jigoshop') . ' (' . ProductHelper::dimensionsUnit() . ')', 'value' => $product->getSize()->getHeight())); ?> </fieldset> <fieldset> <?php Forms::select(array('name' => 'product[visibility]', 'label' => __('Visibility', 'jigoshop'), 'options' => array(Product::VISIBILITY_PUBLIC => __('Catalog & Search', 'jigoshop'), Product::VISIBILITY_CATALOG => __('Catalog Only', 'jigoshop'), Product::VISIBILITY_SEARCH => __('Search Only', 'jigoshop'), Product::VISIBILITY_NONE => __('Hidden', 'jigoshop')), 'value' => $product->getVisibility())); Forms::checkbox(array('name' => 'product[featured]', 'label' => __('Featured?', 'jigoshop'), 'checked' => $product->isFeatured(), 'description' => __('Enable this option to feature this product', 'jigoshop')));
/** * Get the main chart * * @return string */ public function getMainChart() { // TODO: Remove this... global $wp_locale; $orderCounts = $this->prepareChartData($this->reportData->orders, 'post_date', 'count', $this->chartInterval, $this->range['start'], $this->chartGroupBy); $orderItemCounts = $this->prepareChartData($this->reportData->orders, 'post_date', 'order_item_count', $this->chartInterval, $this->range['start'], $this->chartGroupBy); $orderAmounts = $this->prepareChartData($this->reportData->orders, 'post_date', 'total_sales', $this->chartInterval, $this->range['start'], $this->chartGroupBy); $couponAmounts = $this->prepareChartData($this->reportData->orders, 'post_date', 'discount_amount', $this->chartInterval, $this->range['start'], $this->chartGroupBy); $shippingAmounts = $this->prepareChartData($this->reportData->orders, 'post_date', 'total_shipping', $this->chartInterval, $this->range['start'], $this->chartGroupBy); $shippingTaxAmounts = $this->prepareChartData($this->reportData->orders, 'post_date', 'total_shipping_tax', $this->chartInterval, $this->range['start'], $this->chartGroupBy); $taxAmounts = $this->prepareChartData($this->reportData->orders, 'post_date', 'total_tax', $this->chartInterval, $this->range['start'], $this->chartGroupBy); $netOrderAmounts = array(); foreach ($orderAmounts as $orderAmountKey => $orderAmountValue) { $netOrderAmounts[$orderAmountKey] = $orderAmountValue; $netOrderAmounts[$orderAmountKey][1] = $netOrderAmounts[$orderAmountKey][1] - $shippingAmounts[$orderAmountKey][1] - $shippingTaxAmounts[$orderAmountKey][1] - $taxAmounts[$orderAmountKey][1]; } $data = array(); $data['series'] = array(); $data['series'][] = $this->arrayToObject(array('label' => esc_js(__('Number of items sold', 'jigoshop')), 'data' => array_values($orderItemCounts), 'color' => $this->chartColours['item_count'], 'bars' => array('fillColor' => $this->chartColours['item_count'], 'fill' => true, 'show' => true, 'lineWidth' => 0, 'align' => 'left', 'barWidth' => $this->barwidth * 0.2), 'shadowSize' => 0, 'hoverable' => false)); $data['series'][] = $this->arrayToObject(array('label' => esc_js(__('Number of orders', 'jigoshop')), 'data' => array_values($orderCounts), 'color' => $this->chartColours['order_count'], 'bars' => array('fillColor' => $this->chartColours['order_count'], 'fill' => true, 'show' => true, 'lineWidth' => 0, 'align' => 'right', 'barWidth' => $this->barwidth * 0.2), 'shadowSize' => 0, 'hoverable' => false)); $data['series'][] = $this->arrayToObject(array('label' => esc_js(__('Average sales amount', 'jigoshop')), 'data' => array(array(min(array_keys($orderAmounts)), $this->reportData->averageSales), array(max(array_keys($orderAmounts)), $this->reportData->averageSales)), 'yaxis' => 2, 'color' => $this->chartColours['average'], 'points' => $this->arrayToObject(array('show' => false)), 'lines' => $this->arrayToObject(array('show' => true, 'lineWidth' => 2, 'fill' => false)), 'shadowSize' => 0, 'hoverable' => false)); $data['series'][] = $this->arrayToObject(array('label' => esc_js(__('Coupon amount', 'jigoshop')), 'data' => array_map(array($this, 'roundChartTotals'), array_values($couponAmounts)), 'yaxis' => 2, 'color' => $this->chartColours['coupon_amount'], 'points' => $this->arrayToObject(array('show' => true, 'radius' => 5, 'lineWidth' => 2, 'fillColor' => '#fff', 'fill' => true)), 'lines' => $this->arrayToObject(array('show' => true, 'lineWidth' => 2, 'fill' => false)), 'shadowSize' => 0, 'append_tooltip' => Currency::symbol())); $data['series'][] = $this->arrayToObject(array('label' => esc_js(__('Shipping amount', 'jigoshop')), 'data' => array_map(array($this, 'roundChartTotals'), array_values($shippingAmounts)), 'yaxis' => 2, 'color' => $this->chartColours['shipping_amount'], 'points' => $this->arrayToObject(array('show' => true, 'radius' => 5, 'lineWidth' => 2, 'fillColor' => '#fff', 'fill' => true)), 'lines' => $this->arrayToObject(array('show' => true, 'lineWidth' => 2, 'fill' => false)), 'shadowSize' => 0, 'append_tooltip' => Currency::symbol())); $data['series'][] = $this->arrayToObject(array('label' => esc_js(__('Gross Sales amount', 'jigoshop')), 'data' => array_map(array($this, 'roundChartTotals'), array_values($orderAmounts)), 'yaxis' => 2, 'color' => $this->chartColours['sales_amount'], 'points' => $this->arrayToObject(array('show' => true, 'radius' => 5, 'lineWidth' => 2, 'fillColor' => '#fff', 'fill' => true)), 'lines' => $this->arrayToObject(array('show' => true, 'lineWidth' => 2, 'fill' => false)), 'shadowSize' => 0, 'append_tooltip' => Currency::symbol())); $data['series'][] = $this->arrayToObject(array('label' => esc_js(__('Net Sales amount', 'jigoshop')), 'data' => array_map(array($this, 'roundChartTotals'), array_values($netOrderAmounts)), 'yaxis' => 2, 'color' => $this->chartColours['net_sales_amount'], 'points' => $this->arrayToObject(array('show' => true, 'radius' => 6, 'lineWidth' => 4, 'fillColor' => '#fff', 'fill' => true)), 'lines' => $this->arrayToObject(array('show' => true, 'lineWidth' => 5, 'fill' => false)), 'shadowSize' => 0, 'append_tooltip' => Currency::symbol())); $data['options'] = $this->arrayToObject(array('legend' => $this->arrayToObject(array('show' => false)), 'grid' => $this->arrayToObject(array('color' => '#aaa', 'borderColor' => 'transparent', 'borderWidth' => 0, 'hoverable' => true)), 'xaxis' => $this->arrayToObject(array('color' => '#aaa', 'position' => 'bottom', 'tickColor' => 'transparent', 'mode' => 'time', 'timeformat' => $this->chartGroupBy == 'hour' ? '%H' : ($this->chartGroupBy == 'day' ? '%d %b' : '%b'), 'monthNames' => array_values($wp_locale->month_abbrev), 'tickLength' => 1, 'minTickSize' => array(1, $this->chartGroupBy), 'font' => $this->arrayToObject(array('color' => '#aaa')))), 'yaxes' => array($this->arrayToObject(array('min' => 0, 'minTickSize' => 1, 'color' => '#d4d9dc', 'font' => $this->arrayToObject(array('color' => '#aaa')))), $this->arrayToObject(array('position' => 'right', 'min' => 0, 'tickDecimals' => 2, 'alignTicksWithAxis' => 1, 'autoscaleMargin' => 0, 'color' => 'transparent', 'font' => $this->arrayToObject(array('color' => '#aaa'))))))); if ($this->chartGroupBy == 'hour') { $data['options']->xaxis->min = 0; $data['options']->xaxis->max = 24 * 60 * 60 * 1000; } return $data; }