Example #1
0
 public function __construct()
 {
     parent::__construct();
     /* installs our gateway options in the settings */
     $this->id = 'futurepay';
     $this->icon = fflcommerce::assets_url() . '/assets/images/icons/futurepay.png';
     $this->has_fields = false;
     $this->enabled = FFLCommerce_Base::get_options()->get('fflcommerce_futurepay_enabled');
     $this->title = FFLCommerce_Base::get_options()->get('fflcommerce_futurepay_title');
     $this->description = FFLCommerce_Base::get_options()->get('fflcommerce_futurepay_description');
     $this->gmid = FFLCommerce_Base::get_options()->get('fflcommerce_futurepay_gmid');
     self::$request_url = FFLCommerce_Base::get_options()->get('fflcommerce_futurepay_mode') == 'no' ? self::FUTUREPAY_LIVE_URL : self::FUTUREPAY_SANDBOX_URL;
     add_action('init', array($this, 'check_response'));
     add_action('valid-futurepay-request', array($this, 'successful_request'), 10, 2);
     add_action('receipt_futurepay', array($this, 'receipt_page'));
     add_action('admin_notices', array($this, 'futurepay_notices'));
     add_action('wp_footer', array($this, 'futurepay_script'));
     $this->currency_symbol = get_fflcommerce_currency_symbol();
     $this->shop_base_country = fflcommerce_countries::get_base_country();
 }
/**
 * $fflcommerce_options_settings variable contains all the options used on the FFL Commerce settings page
 *
 * DISCLAIMER
 *
 * Do not edit or add directly to this file if you wish to upgrade FFL Commerce to newer
 * versions in the future. If you wish to customise FFLCommerce core for your needs,
 * please use our GitHub repository to publish essential changes for consideration.
 *
 * @package             FFLCommerce
 * @category            Admin
 * @author              Tampa Bay Tactical Supply, Inc.
 * @copyright           Copyright © 2011-2014 Tampa Bay Tactical Supply, Inc. & Jigoshop.
 * @license             GNU General Public License v3
 * 
 */
/***********************    NOTE:   AS OF FFL Commerce 1.3, THIS FILE IS NO LONGER IN USE       ************************/
_deprecated_file(__FILE__, '1.3', 'FFLCommerce_Base::get_options()');
/**
 * options_settings
 *
 * This variable contains all the options used on the FFL Commerce settings page
 *
 * @since 		1.0
 * @category 	Admin
 * @usedby 		fflcommerce_settings(), fflcommerce_default_options()
 */
global $fflcommerce_options_settings;
$fflcommerce_options_settings = apply_filters('fflcommerce_options_settings', array(array('type' => 'tab', 'tabname' => __('General', 'fflcommerce')), array('name' => __('General Options', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Send FFL Commerce emails from', 'fflcommerce'), 'desc' => '', 'tip' => __('The email used to send all FFL Commerce related emails, such as order confirmations and notices.', 'fflcommerce'), 'id' => 'fflcommerce_email', 'css' => 'width:250px;', 'type' => 'text', 'std' => get_option('admin_email')), array('name' => __('Base Country/Region', 'fflcommerce'), 'desc' => '', 'tip' => __('This is the base country for your business. Tax rates will be based on this country.', 'fflcommerce'), 'id' => 'fflcommerce_default_country', 'css' => '', 'std' => 'GB', 'type' => 'single_select_country'), array('name' => __('Allowed Countries', 'fflcommerce'), 'desc' => '', 'tip' => __('These are countries that you are willing to ship to.', 'fflcommerce'), 'id' => 'fflcommerce_allowed_countries', 'css' => 'min-width:100px;', 'std' => 'all', 'type' => 'select', 'options' => array('all' => __('All Countries', 'fflcommerce'), 'specific' => __('Specific Countries', 'fflcommerce'))), array('name' => __('Specific Countries', 'fflcommerce'), 'desc' => '', 'tip' => '', 'id' => 'fflcommerce_specific_allowed_countries', 'css' => '', 'std' => '', 'type' => 'multi_select_countries'), array('name' => __('After adding product to cart', 'fflcommerce'), 'desc' => '', 'tip' => __('Define what should happen when a user clicks on &#34;Add to Cart&#34; on any product or page.', 'fflcommerce'), 'id' => 'fflcommerce_redirect_add_to_cart', 'css' => 'min-width:100px;', 'std' => 'same_page', 'type' => 'select', 'options' => array('same_page' => __('Stay on the same page', 'fflcommerce'), 'to_checkout' => __('Redirect to Checkout', 'fflcommerce'), 'to_cart' => __('Redirect to Cart', 'fflcommerce'))), array('name' => __('Downloads', 'fflcommerce'), 'desc' => __('Enforce login for downloads', 'fflcommerce'), 'tip' => __('If a guest purchases a download, the guest can still download a link without logging in. We recommend disabling guest purchases if you enable this option.', 'fflcommerce'), 'id' => 'fflcommerce_downloads_require_login', 'std' => 'no', 'type' => 'checkbox'), array('name' => __('Styles and scripts', 'fflcommerce'), 'desc' => __('Demo store banner', 'fflcommerce'), 'tip' => __('Enable this option to show a banner at the top of every page stating this shop is currently in testing mode.', 'fflcommerce'), 'id' => 'fflcommerce_demo_store', 'std' => 'no', 'type' => 'checkbox'), array('desc' => __('Disable FFL Commerce frontend.css', 'fflcommerce'), 'tip' => __('Useful if you want to disable FFL Commerce styles and theme it yourself via your theme.', 'fflcommerce'), 'id' => 'fflcommerce_disable_css', 'std' => 'no', 'type' => 'checkbox'), array('desc' => __('Disable bundled PrettyPhoto', 'fflcommerce'), 'tip' => __('Useful if or one of your plugin already loads the PrettyPhoto script and css. But be careful, fflcommerce will still try to open product images using Fancybox.', 'fflcommerce'), 'id' => 'fflcommerce_disable_fancybox', 'std' => 'no', 'type' => 'checkbox'), array('name' => __('Checkout page', 'fflcommerce'), 'desc' => __('Allow guest purchases', 'fflcommerce'), 'tip' => __('Setting this to Yes will allow users to checkout without registering or signing up. Otherwise, users must be signed in or must sign up to checkout.', 'fflcommerce'), 'id' => 'fflcommerce_enable_guest_checkout', 'std' => 'yes', 'type' => 'checkbox'), array('desc' => __('Show login form', 'fflcommerce'), 'id' => 'fflcommerce_enable_guest_login', 'std' => 'yes', 'type' => 'checkbox'), array('desc' => __('Allow registration', 'fflcommerce'), 'id' => 'fflcommerce_enable_signup_form', 'std' => 'yes', 'type' => 'checkbox'), array('desc' => __('Force SSL on checkout', 'fflcommerce'), 'tip' => __('Forcing SSL is recommended. This will load your checkout page with https://. An SSL certificate is <strong>required</strong> if you choose yes. Contact your hosting provider for more information on SSL Certs.', 'fflcommerce'), 'id' => 'fflcommerce_force_ssl_checkout', 'std' => 'no', 'type' => 'checkbox'), array('name' => __('Beta testing', 'fflcommerce'), 'desc' => __('Use beta versions', 'fflcommerce'), 'tip' => __('Only beta plugin updates will be shown for FFL Commerce. Beta updates will display normally in the Wordpress plugin manager.', 'fflcommerce'), 'id' => 'fflcommerce_use_beta_version', 'std' => 'no', 'type' => 'checkbox'), array('desc' => __('Check for update now', 'fflcommerce'), 'tip' => __('Manually check if a beta update is available.', 'fflcommerce'), 'id' => 'fflcommerce_check_beta_now', 'type' => 'button', 'href' => is_multisite() ? admin_url() . 'network/' : '' . 'admin.php?page=fflcommerce_settings&amp;action=fflcommerce_beta_check&amp;_wpnonce=' . wp_create_nonce('fflcommerce_check_beta_' . get_current_user_id() . '_wpnonce')), array('name' => __('Invoicing', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Company Name', 'fflcommerce'), 'desc' => '', 'tip' => __('Setting your company name will enable us to print it out on your invoice emails. Leave blank to disable.', 'fflcommerce'), 'id' => 'fflcommerce_company_name', 'css' => 'width:300px;', 'type' => 'text', 'std' => ''), array('name' => __('Tax Registration Number', 'fflcommerce'), 'desc' => 'Add your tax registration label before the registration number and it will be printed as well. eg. <code>VAT Number: 88888888</code>', 'tip' => __('Setting your tax number will enable us to print it out on your invoice emails. Leave blank to disable.', 'fflcommerce'), 'id' => 'fflcommerce_tax_number', 'css' => 'width:300px;', 'type' => 'text', 'std' => ''), array('name' => __('Address Line1', 'fflcommerce'), 'desc' => '', 'tip' => __('Setting your address will enable us to print it out on your invoice emails. Leave blank to disable.', 'fflcommerce'), 'id' => 'fflcommerce_address_line1', 'css' => 'width:300px;', 'type' => 'text', 'std' => ''), array('name' => __('Address Line2', 'fflcommerce'), 'desc' => '', 'tip' => __('If address line1 is not set, address line2 will not display even if you put a value in it. Setting your address will enable us to print it out on your invoice emails. Leave blank to disable.', 'fflcommerce'), 'id' => 'fflcommerce_address_line2', 'css' => 'width:300px;', 'type' => 'text', 'std' => ''), array('name' => __('Company Phone', 'fflcommerce'), 'desc' => '', 'tip' => __('Setting your company phone number will enable us to print it out on your invoice emails. Leave blank to disable.', 'fflcommerce'), 'id' => 'fflcommerce_company_phone', 'css' => 'width:300px;', 'type' => 'text', 'std' => ''), array('name' => __('Company Email', 'fflcommerce'), 'desc' => '', 'tip' => __('Setting your company email will enable us to print it out on your invoice emails. Leave blank to disable.', 'fflcommerce'), 'id' => 'fflcommerce_company_email', 'css' => 'width:300px;', 'type' => 'text', 'std' => ''), array('name' => __('Integration', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('ShareThis Publisher ID', 'fflcommerce'), 'desc' => __("Enter your <a href='http://sharethis.com/account/'>ShareThis publisher ID</a> to show ShareThis on product pages.", 'fflcommerce'), 'tip' => __('ShareThis is a small social sharing widget for posting links on popular sites such as Twitter and Facebook.', 'fflcommerce'), 'id' => 'fflcommerce_sharethis', 'css' => 'width:300px;', 'type' => 'text', 'std' => ''), array('name' => __('Google Analytics ID', 'fflcommerce'), 'desc' => __('Log into your Google Analytics account to find your ID. e.g. <code>UA-XXXXXXX-X</code>', 'fflcommerce'), 'id' => 'fflcommerce_ga_id', 'type' => 'text', 'css' => 'min-width:300px;'), array('name' => __('Enable Google eCommerce', 'fflcommerce'), 'tip' => __('Add Google Analytics eCommerce tracking code upon successful orders', 'fflcommerce'), 'desc' => __('<a href="//support.google.com/analytics/bin/answer.py?hl=en&answer=1009612" target="_TOP">Learn how to enable</a> eCommerce tracking for your Google Analytics account.', 'fflcommerce'), 'id' => 'fflcommerce_ga_ecommerce_tracking_enabled', 'type' => 'checkbox'), array('type' => 'tabend'), array('type' => 'tab', 'tabname' => __('Pages', 'fflcommerce')), array('name' => __('Permalinks', 'fflcommerce'), 'type' => 'title', 'desc' => '', 'id' => ''), array('name' => __('Prepend options', 'fflcommerce'), 'desc' => __('Prepend shop categories / tags with base page', 'fflcommerce'), 'tip' => __('This will only apply to tags &amp; categories.<br/>Enabled: http://yoursite.com / product_category / YourCategory<br/>Disabled: http://yoursite.com / base_page / product_category / YourCategory', 'fflcommerce'), 'id' => 'fflcommerce_prepend_shop_page_to_urls', 'std' => 'no', 'type' => 'checkbox'), array('desc' => __('Prepend product permalinks with shop base page', 'fflcommerce'), 'id' => 'fflcommerce_prepend_shop_page_to_product', 'std' => 'no', 'type' => 'checkbox'), array('desc' => __('Prepend product permalinks with product category', 'fflcommerce'), 'id' => 'fflcommerce_prepend_category_to_product', 'std' => 'no', 'type' => 'checkbox'), array('name' => __('Slug variables', 'fflcommerce'), 'desc' => 'Product category slug', 'tip' => __('Slug displayed in product category URLs. Leave blank to use default "product-category"', 'fflcommerce'), 'id' => 'fflcommerce_product_category_slug', 'std' => 'product-category', 'css' => 'width:130px;', 'type' => 'text', 'group' => true), array('desc' => __('Product tag slug', 'fflcommerce'), 'tip' => __('Slug displayed in product tag URLs. Leave blank to use default "product-tag"', 'fflcommerce'), 'id' => 'fflcommerce_product_tag_slug', 'std' => 'product-tag', 'css' => 'width:130px;', 'type' => 'text', 'group' => true), array('name' => __('Shop page configuration', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Cart Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_cart]</code>', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_cart_page_id', 'css' => 'min-width:50px;', 'type' => 'single_select_page', 'std' => ''), array('name' => __('Checkout Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_checkout]</code>', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_checkout_page_id', 'css' => 'min-width:50px;', 'type' => 'single_select_page', 'std' => ''), array('name' => __('Pay Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_pay]</code><br/>Default parent page: Checkout', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_pay_page_id', 'css' => 'min-width:50px;', 'type' => 'single_select_page', 'std' => ''), array('name' => __('Thanks Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_thankyou]</code><br/>Default parent page: Checkout', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_thanks_page_id', 'css' => 'min-width:50px;', 'type' => 'single_select_page', 'std' => ''), array('name' => __('My Account Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_my_account]</code>', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_myaccount_page_id', 'css' => 'min-width:50px;', 'type' => 'single_select_page', 'std' => ''), array('name' => __('Edit Address Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_edit_address]</code><br/>Default parent page: My Account', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_edit_address_page_id', 'css' => 'min-width:50px;', 'type' => 'single_select_page', 'std' => ''), array('name' => __('View Order Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_view_order]</code><br/>Default parent page: My Account', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_view_order_page_id', 'css' => 'min-width:50px;', 'type' => 'single_select_page', 'std' => ''), array('name' => __('Change Password Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_change_password]</code><br/>Default parent page: My Account', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_change_password_page_id', 'css' => 'min-width:50px;', 'type' => 'single_select_page', 'std' => ''), array('name' => __('Track Order Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_order_tracking]</code>', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_track_order_page_id', 'css' => 'min-width:50px;', 'type' => 'single_select_page', 'std' => ''), array('name' => __('Terms Page', 'fflcommerce'), 'desc' => __('If you define a &#34;Terms&#34; page the customer will be asked to accept it before allowing them to place their order.', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_terms_page_id', 'css' => 'min-width:50px;', 'std' => '', 'type' => 'single_select_page', 'args' => 'show_option_none=' . __('None', 'fflcommerce')), array('type' => 'tabend'), array('type' => 'tab', 'tabname' => __('Catalog &amp; Pricing', 'fflcommerce')), array('name' => __('Catalog Options', 'fflcommerce'), 'type' => 'title', 'desc' => '', 'id' => ''), array('name' => __('Catalog base page', 'fflcommerce'), 'desc' => '', 'tip' => __('This sets the base page of your shop. You should not change this value once you have launched your site otherwise you risk breaking urls of other sites pointing to yours, etc.', 'fflcommerce'), 'id' => 'fflcommerce_shop_page_id', 'css' => 'min-width:50px;', 'type' => 'single_select_page', 'std' => ''), array('name' => __('Shop redirection page', 'fflcommerce'), 'desc' => '', 'tip' => __('This will point users to the page you set for buttons like `Return to shop` or `Continue Shopping`.', 'fflcommerce'), 'id' => 'fflcommerce_shop_redirect_page_id', 'css' => 'min-width:50px;', 'type' => 'single_select_page', 'std' => ''), array('name' => __('Sort products in catalog by', 'fflcommerce'), 'desc' => '', 'tip' => __('Determines the display sort order of products for the Shop, Categories, and Tag pages.', 'fflcommerce'), 'id' => 'fflcommerce_catalog_sort_orderby', 'std' => 'post_date', 'type' => 'radio', 'options' => array('post_date' => __('Creation Date', 'fflcommerce'), 'title' => __('Product Title', 'fflcommerce'), 'menu_order' => __('Product Post Order', 'fflcommerce'))), array('name' => __('Catalog sort direction', 'fflcommerce'), 'desc' => '', 'tip' => __('Determines whether the catalog sort orderby is ascending or descending.', 'fflcommerce'), 'id' => 'fflcommerce_catalog_sort_direction', 'std' => 'asc', 'type' => 'radio', 'options' => array('asc' => __('Ascending', 'fflcommerce'), 'desc' => __('Descending', 'fflcommerce'))), array('name' => __('Catalog products display', 'fflcommerce'), 'desc' => __('Per row', 'fflcommerce'), 'tip' => __('Determines how many products to show on one display row for Shop, Category and Tag pages. Default = 3.', 'fflcommerce'), 'id' => 'fflcommerce_catalog_columns', 'css' => 'width:60px;', 'std' => '3', 'type' => 'number', 'restrict' => array('min' => 0), 'group' => true), array('desc' => __('Per page', 'fflcommerce'), 'tip' => __('Determines how many products to display on Shop, Category and Tag pages before needing next and previous page navigation. Default = 12.', 'fflcommerce'), 'id' => 'fflcommerce_catalog_per_page', 'css' => 'width:60px;', 'std' => '12', 'type' => 'number', 'restrict' => array('min' => 0), 'group' => true), array('name' => __('Pricing Options', 'fflcommerce'), 'type' => 'title', 'desc' => '', 'id' => ''), array('name' => __('Currency', 'fflcommerce'), 'desc' => sprintf(__("This controls what currency prices are listed at in the catalog, and which currency PayPal, and other gateways, will take payments in. See the list of supported <a target='_new' href='%s'>PayPal currencies</a>.", 'fflcommerce'), 'https://www.paypal.com/cgi-bin/webscr?cmd=p/sell/mc/mc_intro-outside'), 'tip' => '', 'id' => 'fflcommerce_currency', 'css' => 'min-width:200px;', 'std' => 'GBP', 'type' => 'select', 'options' => apply_filters('fflcommerce_currencies', array('AED' => __('United Arab Emirates dirham (&#1583;&#46;&#1573;)', 'fflcommerce'), 'AUD' => __('Australian Dollar (&#36;)', 'fflcommerce'), 'BRL' => __('Brazilian Real (&#82;&#36;)', 'fflcommerce'), 'CAD' => __('Canadian Dollar (&#36;)', 'fflcommerce'), 'CHF' => __('Swiss Franc (SFr.)', 'fflcommerce'), 'CNY' => __('Chinese yuan (&#165;)', 'fflcommerce'), 'CZK' => __('Czech Koruna (&#75;&#269;)', 'fflcommerce'), 'DKK' => __('Danish Krone (kr)', 'fflcommerce'), 'EUR' => __('Euro (&euro;)', 'fflcommerce'), 'GBP' => __('Pounds Sterling (&pound;)', 'fflcommerce'), 'HKD' => __('Hong Kong Dollar (&#36;)', 'fflcommerce'), 'HRK' => __('Croatian Kuna (&#107;&#110;)', 'fflcommerce'), 'HUF' => __('Hungarian Forint (&#70;&#116;)', 'fflcommerce'), 'IDR' => __('Indonesia Rupiah (&#82;&#112;)', 'fflcommerce'), 'ILS' => __('Israeli Shekel (&#8362;)', 'fflcommerce'), 'INR' => __('Indian Rupee (&#8360;)', 'fflcommerce'), 'JPY' => __('Japanese Yen (&yen;)', 'fflcommerce'), 'MXN' => __('Mexican Peso (&#36;)', 'fflcommerce'), 'MYR' => __('Malaysian Ringgits (RM)', 'fflcommerce'), 'NGN' => __('Nigerian Naira (&#8358;)', 'fflcommerce'), 'NOK' => __('Norwegian Krone (kr)', 'fflcommerce'), 'NZD' => __('New Zealand Dollar (&#36;)', 'fflcommerce'), 'PHP' => __('Philippine Pesos (&#8369;)', 'fflcommerce'), 'PLN' => __('Polish Zloty (&#122;&#322;)', 'fflcommerce'), 'RON' => __('Romanian New Leu (&#108;&#101;&#105;)', 'fflcommerce'), 'RUB' => __('Russian Ruble (&#1088;&#1091;&#1073;)', 'fflcommerce'), 'SEK' => __('Swedish Krona (kr)', 'fflcommerce'), 'SGD' => __('Singapore Dollar (&#36;)', 'fflcommerce'), 'THB' => __('Thai Baht (&#3647;)', 'fflcommerce'), 'TRY' => __('Turkish Lira (&#8356;)', 'fflcommerce'), 'TWD' => __('Taiwan New Dollar (&#36;)', 'fflcommerce'), 'USD' => __('US Dollar (&#36;)', 'fflcommerce'), 'ZAR' => __('South African rand (R)', 'fflcommerce')))), array('name' => __('Currency display', 'fflcommerce'), 'desc' => __("This controls the display of the currency symbol and currency code.", 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_currency_pos', 'css' => 'min-width:200px;', 'std' => 'left', 'type' => 'select', 'options' => array('left' => __(get_fflcommerce_currency_symbol() . '0' . get_option('fflcommerce_price_decimal_sep') . '00', 'fflcommerce'), 'left_space' => __(get_fflcommerce_currency_symbol() . ' 0' . get_option('fflcommerce_price_decimal_sep') . '00', 'fflcommerce'), 'right' => __('0' . get_option('fflcommerce_price_decimal_sep') . '00' . get_fflcommerce_currency_symbol(), 'fflcommerce'), 'right_space' => __('0' . get_option('fflcommerce_price_decimal_sep') . '00 ' . get_fflcommerce_currency_symbol(), 'fflcommerce'), 'left_code' => __(get_option('fflcommerce_currency') . '0' . get_option('fflcommerce_price_decimal_sep') . '00', 'fflcommerce'), 'left_code_space' => __(get_option('fflcommerce_currency') . ' 0' . get_option('fflcommerce_price_decimal_sep') . '00', 'fflcommerce'), 'right_code' => __('0' . get_option('fflcommerce_price_decimal_sep') . '00' . get_option('fflcommerce_currency'), 'fflcommerce'), 'right_code_space' => __('0' . get_option('fflcommerce_price_decimal_sep') . '00 ' . get_option('fflcommerce_currency'), 'fflcommerce'), 'symbol_code' => __(get_fflcommerce_currency_symbol() . '0' . get_option('fflcommerce_price_decimal_sep') . '00' . get_option('fflcommerce_currency'), 'fflcommerce'), 'symbol_code_space' => __(get_fflcommerce_currency_symbol() . ' 0' . get_option('fflcommerce_price_decimal_sep') . '00 ' . get_option('fflcommerce_currency'), 'fflcommerce'), 'code_symbol' => __(get_option('fflcommerce_currency') . '0' . get_option('fflcommerce_price_decimal_sep') . '00' . get_fflcommerce_currency_symbol(), 'fflcommerce'), 'code_symbol_space' => __(get_option('fflcommerce_currency') . ' 0' . get_option('fflcommerce_price_decimal_sep') . '00 ' . get_fflcommerce_currency_symbol(), 'fflcommerce'))), array('name' => __('Price Separators', 'fflcommerce'), 'desc' => __('Thousand separator', 'fflcommerce'), 'id' => 'fflcommerce_price_thousand_sep', 'css' => 'width:30px;', 'std' => ',', 'type' => 'text', 'group' => true), array('desc' => __('Decimal separator', 'fflcommerce'), 'id' => 'fflcommerce_price_decimal_sep', 'css' => 'width:30px;', 'std' => '.', 'type' => 'text', 'group' => true), array('desc' => __('Number of decimals', 'fflcommerce'), 'id' => 'fflcommerce_price_num_decimals', 'css' => 'width:30px;', 'std' => '2', 'type' => 'number', 'restrict' => array('min' => 0), 'group' => true), array('type' => 'tabend'), array('type' => 'tab', 'tabname' => __('Images', 'fflcommerce')), array('name' => __('Image Options', 'fflcommerce'), 'type' => 'title', 'desc' => sprintf(__('<p>Changing any of these settings will affect the dimensions of images used in your Shop. After changing these settings you may need to <a href="%s">regenerate your thumbnails</a>.</p>
																										<p>Crop: Leave unchecked to set the image size by resizing the image proportionally (that is, without distorting it). Leave checked to set the image size by hard cropping the image (either from the sides, or from the top and bottom).</p>
																										<p><strong>Note:</strong> Your images may not display in the size you choose below. This is because they may still be affected by CSS styles, that is, your theme.', 'fflcommerce'), 'http://wordpress.org/extend/plugins/regenerate-thumbnails/'), 'id' => ''), array('name' => __('Tiny Images', 'fflcommerce'), 'desc' => __('Cart, Checkout, Orders and Widgets', 'fflcommerce'), 'id' => 'fflcommerce_shop_tiny', 'type' => 'image_size', 'std' => 36, 'placeholder' => 36), array('name' => __('Thumbnail Images', 'fflcommerce'), 'desc' => __('Single Product page extra images.', 'fflcommerce'), 'id' => 'fflcommerce_shop_thumbnail', 'type' => 'image_size', 'std' => 90, 'placeholder' => 90), array('name' => __('Catalog Images', 'fflcommerce'), 'desc' => __('Shop, Categories, Tags, and Related Products.', 'fflcommerce'), 'id' => 'fflcommerce_shop_small', 'type' => 'image_size', 'std' => 150, 'placeholder' => 150), array('name' => __('Large Images', 'fflcommerce'), 'desc' => __('Single Product pages', 'fflcommerce'), 'id' => 'fflcommerce_shop_large', 'type' => 'image_size', 'std' => 300, 'placeholder' => 300), array('type' => 'tabend'), array('type' => 'tab', 'tabname' => __('Coupons', 'fflcommerce')), array('name' => __('Coupon Information', 'fflcommerce'), 'type' => 'title', 'desc' => __('<div>Coupons allow you to give your customers special offers and discounts. </div>', 'fflcommerce')), array('name' => __('Coupons', 'fflcommerce'), 'desc' => __('All fields are required.', 'fflcommerce'), 'id' => 'fflcommerce_coupons', 'css' => 'min-width:50px;', 'type' => 'coupons', 'std' => ''), array('type' => 'tabend'), array('type' => 'tab', 'tabname' => __('Products &amp; Inventory', 'fflcommerce')), array('name' => __('Product Options', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Product fields', 'fflcommerce'), 'desc' => __('Enable SKU', 'fflcommerce'), 'tip' => __('Turning off the SKU field will give products an SKU of their post id.', 'fflcommerce'), 'id' => 'fflcommerce_enable_sku', 'std' => 'no', 'type' => 'checkbox'), array('desc' => __('Enable weight', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_enable_weight', 'std' => 'yes', 'type' => 'checkbox'), array('desc' => __('Enable product dimensions', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_enable_dimensions', 'std' => 'yes', 'type' => 'checkbox'), array('name' => __('Weight Unit', 'fflcommerce'), 'tip' => __("This controls what unit you will define weights in.", 'fflcommerce'), 'id' => 'fflcommerce_weight_unit', 'std' => 'kg', 'type' => 'radio', 'options' => array('kg' => __('Kilograms', 'fflcommerce'), 'lbs' => __('Pounds', 'fflcommerce'))), array('name' => __('Dimensions Unit', 'fflcommerce'), 'tip' => __("This controls what unit you will define dimensions in.", 'fflcommerce'), 'id' => 'fflcommerce_dimension_unit', 'std' => 'cm', 'type' => 'radio', 'options' => array('cm' => __('centimeters', 'fflcommerce'), 'in' => __('inches', 'fflcommerce'))), array('name' => __('Show related products', 'fflcommerce'), 'desc' => '', 'tip' => __('To show or hide the related products section on a single product page.', 'fflcommerce'), 'id' => 'fflcommerce_enable_related_products', 'std' => 'yes', 'type' => 'checkbox'), array('name' => __('Inventory Options', 'fflcommerce'), 'type' => 'title', 'desc' => '', 'id' => ''), array('name' => __('General inventory options', 'fflcommerce'), 'desc' => __('Enable product stock', 'fflcommerce'), 'tip' => __('If you are not managing stock, turn it off here to disable it in admin and on the front-end. You can manage stock on a per-item basis if you leave this option on.', 'fflcommerce'), 'id' => 'fflcommerce_manage_stock', 'std' => 'yes', 'type' => 'checkbox'), array('desc' => __('Show stock amounts', 'fflcommerce'), 'tip' => __('Set to yes to allow customers to view the amount of stock available for a product.', 'fflcommerce'), 'id' => 'fflcommerce_show_stock', 'std' => 'yes', 'type' => 'checkbox'), array('desc' => __('Hide out of stock products', 'fflcommerce'), 'tip' => 'When enabled: When the Out of Stock Threshold (above) is reached, the product visibility will be set to hidden so that it will not appear on the Catalog or Shop product lists.', 'id' => 'fflcommerce_hide_no_stock_product', 'std' => 'no', 'type' => 'checkbox'), array('name' => __('Notifications', 'fflcommerce'), 'desc' => __('Notify on low stock', 'fflcommerce'), 'id' => 'fflcommerce_notify_low_stock', 'std' => 'yes', 'type' => 'checkbox'), array('desc' => __('Low stock threshold', 'fflcommerce'), 'tip' => __('You will receive a notification as soon this threshold is hit (if notifications are turned on).', 'fflcommerce'), 'id' => 'fflcommerce_notify_low_stock_amount', 'css' => 'width:50px;', 'type' => 'number', 'restrict' => array('min' => 0), 'std' => '2', 'group' => true), array('desc' => __('Notify on out of stock', 'fflcommerce'), 'id' => 'fflcommerce_notify_no_stock', 'std' => 'yes', 'type' => 'checkbox', 'group' => true), array('desc' => __('Out of stock threshold', 'fflcommerce'), 'tip' => __('You will receive a notification as soon this threshold is hit (if notifications are turned on).', 'fflcommerce'), 'id' => 'fflcommerce_notify_no_stock_amount', 'css' => 'width:50px;', 'type' => 'number', 'restrict' => array('min' => 0), 'std' => '0', 'group' => true), array('type' => 'tabend'), array('type' => 'tab', 'tabname' => __('Shipping', 'fflcommerce')), array('name' => __('Shipping Options', 'fflcommerce'), 'type' => 'title', 'desc' => '', 'id' => ''), array('name' => __('General shipping settings', 'fflcommerce'), 'desc' => __('Calculate shipping', 'fflcommerce'), 'tip' => __('Only set this to no if you are not shipping items, or items have shipping costs included. If you are not calculating shipping then you can ignore all other tax options.', 'fflcommerce'), 'id' => 'fflcommerce_calc_shipping', 'std' => 'yes', 'type' => 'checkbox'), array('desc' => __('Enable shipping calculator on cart', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_enable_shipping_calc', 'std' => 'yes', 'type' => 'checkbox'), array('desc' => __('Only ship to billing address?', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_ship_to_billing_address_only', 'std' => 'no', 'type' => 'checkbox'), array('type' => 'shipping_options'), array('type' => 'tabend'), array('type' => 'tab', 'tabname' => __('Tax', 'fflcommerce')), array('name' => __('Tax Options', 'fflcommerce'), 'type' => 'title', 'desc' => '', 'id' => ''), array('name' => __('General tax options', 'fflcommerce'), 'desc' => __('Enable tax calculation', 'fflcommerce'), 'tip' => __('Only disable this if you are exclusively selling non-taxable items. If you are not calculating taxes then you can ignore all other tax options.', 'fflcommerce'), 'id' => 'fflcommerce_calc_taxes', 'std' => 'yes', 'type' => 'checkbox'), array('desc' => __('Apply Taxes After Coupon', 'fflcommerce'), 'tip' => __('If yes, taxes get applied after coupons. When no, taxes get applied before coupons.', 'fflcommerce'), 'id' => 'fflcommerce_tax_after_coupon', 'std' => 'yes', 'type' => 'checkbox'), array('desc' => __('Catalog Prices include tax?', 'fflcommerce'), 'tip' => __('If prices include tax then tax calculations will work backwards.', 'fflcommerce'), 'id' => 'fflcommerce_prices_include_tax', 'std' => 'yes', 'type' => 'checkbox'), array('name' => __('Cart total displays', 'fflcommerce'), 'desc' => '', 'tip' => __('Should the subtotal be shown including or excluding tax on the frontend?', 'fflcommerce'), 'id' => 'fflcommerce_display_totals_tax', 'std' => 'excluding', 'type' => 'radio', 'options' => array('including' => __('price including tax', 'fflcommerce'), 'excluding' => __('price excluding tax', 'fflcommerce'))), array('name' => __('Additional Tax classes', 'fflcommerce'), 'desc' => __('List 1 per line. This is in addition to the default <em>Standard Rate</em>.', 'fflcommerce'), 'tip' => __('List product and shipping tax classes here, e.g. Zero Tax, Reduced Rate.', 'fflcommerce'), 'id' => 'fflcommerce_tax_classes', 'css' => 'width:100%; height: 75px;', 'type' => 'textarea', 'std' => sprintf(__('Reduced Rate%sZero Rate', 'fflcommerce'), PHP_EOL)), array('name' => __('Tax rates', 'fflcommerce'), 'desc' => __('All fields are required.', 'fflcommerce'), 'tip' => __('To avoid rounding errors, insert tax rates with 4 decimal places.', 'fflcommerce'), 'id' => 'fflcommerce_tax_rates', 'css' => 'min-width:50px;', 'type' => 'tax_rates', 'std' => ''), array('type' => 'tabend'), array('type' => 'tab', 'tabname' => __('Payment Gateways', 'fflcommerce')), array('type' => 'gateway_options'), array('type' => 'tabend')));
Example #3
0
/**
 * Product data box
 *
 * Displays the product data box, tabbed, with several panels covering price, stock etc
 *
 * @since 		1.0
 */
function fflcommerce_product_data_box()
{
    global $post, $wpdb, $thepostid;
    add_action('admin_footer', 'fflcommerce_meta_scripts');
    wp_nonce_field('fflcommerce_save_data', 'fflcommerce_meta_nonce');
    $thepostid = $post->ID;
    // Product Type
    $terms = get_the_terms($thepostid, 'product_type');
    $product_type = $terms ? current($terms)->slug : 'simple';
    $product_type_selector = apply_filters('fflcommerce_product_type_selector', array('simple' => __('Simple', 'fflcommerce'), 'downloadable' => __('Downloadable', 'fflcommerce'), 'grouped' => __('Grouped', 'fflcommerce'), 'virtual' => __('Virtual', 'fflcommerce'), 'variable' => __('Variable', 'fflcommerce'), 'external' => __('External / Affiliate', 'fflcommerce')));
    $product_type_select = '<div class="product-type-label">' . __('Product Type', 'fflcommerce') . '</div><select id="product-type" name="product-type"><optgroup label="' . __('Product Type', 'fflcommerce') . '">';
    foreach ($product_type_selector as $value => $label) {
        $product_type_select .= '<option value="' . $value . '" ' . selected($product_type, $value, false) . '>' . $label . '</option>';
    }
    $product_type_select .= '</optgroup></select><div class="clear"></div>';
    ?>

	<div class="panels">
		<span class="fflcommerce_product_data_type"><?php 
    echo $product_type_select;
    ?>
</span>
		<ul class="product_data_tabs tabs" style="display:none;">
			<li class="general_tab active">
				<a href="#general"><?php 
    _e('General', 'fflcommerce');
    ?>
</a>
			</li>

			<li class="advanced_tab">
				<a href="#tax"><?php 
    _e('Advanced', 'fflcommerce');
    ?>
</a>
			</li>

			<?php 
    if (FFLCommerce_Base::get_options()->get('fflcommerce_manage_stock') == 'yes') {
        ?>
			<li class="inventory_tab">
				<a href="#inventory"><?php 
        _e('Inventory', 'fflcommerce');
        ?>
</a>
			</li>
			<?php 
    }
    ?>

			<li class="attributes_tab">
				<a href="#attributes"><?php 
    _e('Attributes', 'fflcommerce');
    ?>
</a>
			</li>

			<li class="grouped_tab">
				<a href="#grouped"><?php 
    _e('Grouping', 'fflcommerce');
    ?>
</a>
			</li>

			<li class="file_tab">
				<a href="#files"><?php 
    _e('Download', 'fflcommerce');
    ?>
</a>
			</li>

			<?php 
    do_action('fflcommerce_product_write_panel_tabs');
    ?>
			<?php 
    do_action('product_write_panel_tabs');
    ?>
		</ul>

		<div id="general" class="panel fflcommerce_options_panel">
			<fieldset>
			<?php 
    // Visibility
    $args = array('id' => 'product_visibility', 'label' => __('Visibility', 'fflcommerce'), 'options' => array('visible' => __('Catalog & Search', 'fflcommerce'), 'catalog' => __('Catalog Only', 'fflcommerce'), 'search' => __('Search Only', 'fflcommerce'), 'hidden' => __('Hidden', 'fflcommerce')), 'selected' => get_post_meta($post->ID, 'visibility', true));
    echo FFLCommerce_Forms::select($args);
    // Featured
    $args = array('id' => 'featured', 'label' => __('Featured?', 'fflcommerce'), 'desc' => __('Enable this option to feature this product', 'fflcommerce'), 'value' => false);
    echo FFLCommerce_Forms::checkbox($args);
    ?>
			</fieldset>
			<fieldset>
			<?php 
    // SKU
    if (FFLCommerce_Base::get_options()->get('fflcommerce_enable_sku') !== 'no') {
        $args = array('id' => 'sku', 'label' => __('SKU', 'fflcommerce'), 'placeholder' => $post->ID);
        echo FFLCommerce_Forms::input($args);
    }
    //Brand
    if (FFLCommerce_Base::get_options()->get('fflcommerce_enable_brand') !== 'no') {
        $args = array('id' => 'brand', 'label' => __('Brand', 'fflcommerce'));
        echo FFLCommerce_Forms::input($args);
    }
    //GTIN
    if (FFLCommerce_Base::get_options()->get('fflcommerce_enable_gtin ') !== 'no') {
        $args = array('id' => 'gtin', 'label' => __('GTIN ', 'fflcommerce'));
        echo FFLCommerce_Forms::input($args);
    }
    //MPN
    if (FFLCommerce_Base::get_options()->get('fflcommerce_enable_mpn') !== 'no') {
        $args = array('id' => 'mpn', 'label' => __('MPN', 'fflcommerce'));
        echo FFLCommerce_Forms::input($args);
    }
    ?>
			</fieldset>

			<fieldset id="price_fieldset">
			<?php 
    // Regular Price
    $args = array('id' => 'regular_price', 'label' => __('Regular Price', 'fflcommerce'), 'after_label' => ' (' . get_fflcommerce_currency_symbol() . ')', 'type' => 'number', 'step' => 'any', 'placeholder' => __('Price Not Announced', 'fflcommerce'));
    echo FFLCommerce_Forms::input($args);
    // Sale Price
    $args = array('id' => 'sale_price', 'label' => __('Sale Price', 'fflcommerce'), 'after_label' => ' (' . get_fflcommerce_currency_symbol() . __(' or %', 'fflcommerce') . ')', 'desc' => '<a href="#" class="sale_schedule">' . __('Schedule', 'fflcommerce') . '</a>', 'placeholder' => __('15% or 19.99', 'fflcommerce'));
    echo FFLCommerce_Forms::input($args);
    // Sale Price date range
    // TODO: Convert this to a helper somehow?
    $field = array('id' => 'sale_price_dates', 'label' => __('On Sale Between', 'fflcommerce'));
    $sale_price_dates_from = get_post_meta($thepostid, 'sale_price_dates_from', true);
    $sale_price_dates_to = get_post_meta($thepostid, 'sale_price_dates_to', true);
    echo '<p class="form-field sale_price_dates_fields">' . __('Current time:', 'fflcommerce') . ' ' . current_time('Y-m-d H:i') . '</p>';
    echo '	<p class="form-field sale_price_dates_fields">
							<label for="' . esc_attr($field['id']) . '_from">' . $field['label'] . '</label>
							<input type="text" class="short date-pick" name="' . esc_attr($field['id']) . '_from" id="' . esc_attr($field['id']) . '_from" value="';
    if ($sale_price_dates_from) {
        echo date('Y-m-d H:i', $sale_price_dates_from);
    }
    echo '" placeholder="' . __('From', 'fflcommerce') . ' (' . date('Y-m-d H:i') . ')" maxlength="16" />
							<input type="text" class="short date-pick" name="' . esc_attr($field['id']) . '_to" id="' . esc_attr($field['id']) . '_to" value="';
    if ($sale_price_dates_to) {
        echo date('Y-m-d H:i', $sale_price_dates_to);
    }
    echo '" placeholder="' . __('To', 'fflcommerce') . ' (' . date('Y-m-d H:i') . ')" maxlength="16" />
							<a href="#" class="cancel_sale_schedule">' . __('Cancel', 'fflcommerce') . '</a>
						</p>';
    ?>
			<?php 
    do_action('fflcommerce_product_pricing_options');
    /* allow extensions like sales flash pro to add pricing options */
    ?>
			</fieldset>

			<fieldset>
			<?php 
    // External products
    $args = array('id' => 'external_url', 'label' => __('Product URL', 'fflcommerce'), 'placeholder' => __('The URL of the external product (eg. http://www.google.com)', 'fflcommerce'), 'extras' => array());
    echo FFLCommerce_Forms::input($args);
    ?>
			</fieldset>
			<?php 
    do_action('fflcommerce_product_general_panel');
    ?>
		</div>
		<div id="tax" class="panel fflcommerce_options_panel">
			<fieldset id="tax_fieldset">
				<?php 
    // Tax Status
    $status = get_post_meta($post->ID, 'tax_status', true);
    if (empty($status)) {
        $status = FFLCommerce_Base::get_options()->get('fflcommerce_tax_defaults_status', 'taxable');
    }
    $args = array('id' => 'tax_status', 'label' => __('Tax Status', 'fflcommerce'), 'options' => array('taxable' => __('Taxable', 'fflcommerce'), 'shipping' => __('Shipping', 'fflcommerce'), 'none' => __('None', 'fflcommerce')), 'selected' => $status);
    echo FFLCommerce_Forms::select($args);
    ?>
				<p class="form_field tax_classes_field">
					<label for="tax_classes"><?php 
    _e('Tax Classes', 'fflcommerce');
    ?>
</label>
            <span class="multiselect short">
            <?php 
    $_tax = new fflcommerce_tax();
    $tax_classes = $_tax->get_tax_classes();
    $selections = get_post_meta($post->ID, 'tax_classes', true);
    if (!is_array($selections)) {
        $selections = FFLCommerce_Base::get_options()->get('fflcommerce_tax_defaults_classes', array('*'));
    }
    $checked = checked(in_array('*', $selections), true, false);
    printf('<label %s><input type="checkbox" name="tax_classes[]" value="%s" %s/> %s</label>', !empty($checked) ? 'class="selected"' : '', '*', $checked, __('Standard', 'fflcommerce'));
    if ($tax_classes) {
        foreach ($tax_classes as $tax_class) {
            $checked = checked(in_array(sanitize_title($tax_class), $selections), true, false);
            printf('<label %s><input type="checkbox" name="tax_classes[]" value="%s" %s/> %s</label>', !empty($checked) ? 'class="selected"' : '', sanitize_title($tax_class), $checked, __($tax_class, 'fflcommerce'));
        }
    }
    ?>
            </span>
            <span class="multiselect-controls">
						<a class="check-all" href="#"><?php 
    _e('Check All', 'fflcommerce');
    ?>
</a>&nbsp;|
						<a class="uncheck-all" href="#"><?php 
    _e('Uncheck All', 'fflcommerce');
    ?>
</a>
					</span>
				</p>
			</fieldset>

			<?php 
    if (FFLCommerce_Base::get_options()->get('fflcommerce_enable_weight') !== 'no' || FFLCommerce_Base::get_options()->get('fflcommerce_enable_dimensions', true) !== 'no') {
        ?>
			<fieldset id="form_fieldset">
			<?php 
        // Weight
        if (FFLCommerce_Base::get_options()->get('fflcommerce_enable_weight') !== 'no') {
            $args = array('id' => 'weight', 'label' => __('Weight', 'fflcommerce'), 'after_label' => ' (' . FFLCommerce_Base::get_options()->get('fflcommerce_weight_unit') . ')', 'type' => 'number', 'step' => 'any', 'placeholder' => '0.00');
            echo FFLCommerce_Forms::input($args);
        }
        // Dimensions
        if (FFLCommerce_Base::get_options()->get('fflcommerce_enable_dimensions', true) !== 'no') {
            echo '
					<p class="form-field dimensions_field">
						<label for"product_length">' . __('Dimensions', 'fflcommerce') . ' (' . FFLCommerce_Base::get_options()->get('fflcommerce_dimension_unit') . ')' . '</label>
						<input type="number" step="any" name="length" class="short" value="' . get_post_meta($thepostid, 'length', true) . '" placeholder="' . __('Length', 'fflcommerce') . '" />
						<input type="number" step="any" name="width" class="short" value="' . get_post_meta($thepostid, 'width', true) . '" placeholder="' . __('Width', 'fflcommerce') . '" />
						<input type="number" step="any" name="height" class="short" value="' . get_post_meta($thepostid, 'height', true) . '" placeholder="' . __('Height', 'fflcommerce') . '" />
					</p>
					';
        }
        ?>
			</fieldset>
			<?php 
    }
    ?>

			<fieldset>
			<?php 
    // Customizable
    $args = array('id' => 'product_customize', 'label' => __('Can be personalized', 'fflcommerce'), 'options' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce')), 'selected' => get_post_meta($post->ID, 'customizable', true));
    echo FFLCommerce_Forms::select($args);
    // Customizable length
    $args = array('id' => 'customized_length', 'label' => __('Personalized Characters', 'fflcommerce'), 'type' => 'number', 'value' => get_post_meta($post->ID, 'customized_length', true), 'placeholder' => __('Leave blank for unlimited', 'fflcommerce'));
    echo FFLCommerce_Forms::input($args);
    ?>
			</fieldset>
			<?php 
    do_action('fflcommerce_product_tax_panel');
    ?>

		</div>

		<?php 
    if (FFLCommerce_Base::get_options()->get('fflcommerce_manage_stock') == 'yes') {
        ?>
		<div id="inventory" class="panel fflcommerce_options_panel">
			<fieldset>
			<?php 
        // manage stock
        $args = array('id' => 'manage_stock', 'label' => __('Manage Stock?', 'fflcommerce'), 'desc' => __('Handle stock for me', 'fflcommerce'), 'value' => false);
        echo FFLCommerce_Forms::checkbox($args);
        ?>
			</fieldset>
			<fieldset>
			<?php 
        // Stock Status
        // TODO: These values should be true/false
        $args = array('id' => 'stock_status', 'label' => __('Stock Status', 'fflcommerce'), 'options' => array('instock' => __('In Stock', 'fflcommerce'), 'outofstock' => __('Out of Stock', 'fflcommerce')));
        echo FFLCommerce_Forms::select($args);
        echo '<div class="stock_fields">';
        // Stock
        // TODO: Missing default value of 0
        $args = array('id' => 'stock', 'label' => __('Stock Quantity', 'fflcommerce'), 'type' => 'number');
        echo FFLCommerce_Forms::input($args);
        // Backorders
        $args = array('id' => 'backorders', 'label' => __('Allow Backorders?', 'fflcommerce'), 'options' => array('no' => __('Do not allow', 'fflcommerce'), 'notify' => __('Allow, but notify customer', 'fflcommerce'), 'yes' => __('Allow', 'fflcommerce')));
        echo FFLCommerce_Forms::select($args);
        echo '</div>';
        ?>
			</fieldset>
			<?php 
        do_action('fflcommerce_product_inventory_panel');
        ?>
		</div>
		<?php 
    }
    ?>

		<div id="attributes" class="panel">
			<?php 
    do_action('fflcommerce_attributes_display');
    ?>
		</div>

		<div id="grouped" class="panel fflcommerce_options_panel">
			<?php 
    // Grouped Products
    // TODO: Needs refactoring & a bit of love
    $posts_in = (array) get_objects_in_term(get_term_by('slug', 'grouped', 'product_type')->term_id, 'product_type');
    $posts_in = array_unique($posts_in);
    if ((bool) $posts_in) {
        $args = array('post_type' => 'product', 'post_status' => 'publish', 'numberposts' => -1, 'orderby' => 'title', 'order' => 'asc', 'post_parent' => 0, 'include' => $posts_in);
        $grouped_products = get_posts($args);
        $options = array(null => '&ndash; Pick a Product Group &ndash;');
        if ($grouped_products) {
            foreach ($grouped_products as $product) {
                if ($product->ID == $post->ID) {
                    continue;
                }
                $options[$product->ID] = $product->post_title;
            }
        }
        // Only echo the form if we have grouped products
        $args = array('id' => 'parent_id', 'label' => __('Product Group', 'fflcommerce'), 'options' => $options, 'selected' => $post->post_parent);
        echo FFLCommerce_Forms::select($args);
    }
    // Ordering
    $args = array('id' => 'menu_order', 'label' => __('Sort Order', 'fflcommerce'), 'type' => 'number', 'value' => $post->menu_order);
    echo FFLCommerce_Forms::input($args);
    $args = array('id' => 'variation_order', 'label' => __('Variation Order', 'fflcommerce'), 'options' => array('asort' => __('By name ascending', 'fflcommerce'), 'arsort' => __('By name descending', 'fflcommerce'), 'ksort' => __('From first to last key', 'fflcommerce'), 'krsort' => __('From last to first key', 'fflcommerce'), 'shuffle' => __('Random', 'fflcommerce')), 'selected' => get_post_meta($post->ID, 'variation_order', true));
    echo FFLCommerce_Forms::select($args);
    ?>
			<?php 
    do_action('fflcommerce_product_grouped_panel');
    ?>
		</div>

		<div id="files" class="panel fflcommerce_options_panel">
			<fieldset>
			<?php 
    // DOWNLOADABLE OPTIONS
    // File URL
    // TODO: Refactor this into a helper
    $file_path = get_post_meta($post->ID, 'file_path', true);
    $field = array('id' => 'file_path', 'label' => __('File Path', 'fflcommerce'));
    echo '<p class="form-field"><label for="' . esc_attr($field['id']) . '">' . $field['label'] . ':</label>
				<input type="text" class="file_path" name="' . esc_attr($field['id']) . '" id="' . esc_attr($field['id']) . '" value="' . esc_attr($file_path) . '" placeholder="' . site_url() . '" />
				<input type="button"  class="upload_file_button button" data-postid="' . esc_attr($post->ID) . '" value="' . __('Upload a file', 'fflcommerce') . '" />
			</p>';
    // Download Limit
    $args = array('id' => 'download_limit', 'label' => __('Download Limit', 'fflcommerce'), 'type' => 'number', 'desc' => __('Leave blank for unlimited re-downloads', 'fflcommerce'));
    echo FFLCommerce_Forms::input($args);
    do_action('additional_downloadable_product_type_options');
    ?>
			</fieldset>
			<?php 
    do_action('fflcommerce_product_files_panel');
    ?>
		</div>

		<?php 
    do_action('fflcommerce_product_write_panels');
    ?>
		<?php 
    do_action('product_write_panels');
    ?>
	</div>
	<?php 
}
Example #4
0
</td>
		</tr>
		<tr>
			<td data-export-label="Currency"><?php 
_e('Currency', 'fflcommerce');
?>
</td>
			<td class="help"><?php 
echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('What currency prices are listed at in the catalog and which currency gateways will take payments in.', 'fflcommerce') . '">[?]</a>';
?>
</td>
			<td><?php 
echo $options->get('fflcommerce_currency');
?>
 (<?php 
echo get_fflcommerce_currency_symbol();
?>
)</td>
		</tr>
		<tr>
			<td data-export-label="Currency Position"><?php 
_e('Currency Position', 'fflcommerce');
?>
</td>
			<td class="help"><?php 
echo '<a href="#" class="help_tip" data-tip="' . esc_attr__('The position of the currency symbol.', 'fflcommerce') . '">[?]</a>';
?>
</td>
			<td><?php 
echo $options->get('fflcommerce_currency_pos');
?>
    /**
     * Monthly Report
     */
    function fflcommerce_dash_monthly_report()
    {
        global $current_month_offset;
        $current_month_offset = (int) date('m');
        if (isset($_GET['month'])) {
            $current_month_offset = (int) $_GET['month'];
        }
        ?>
		<div class="stats" id="fflcommerce-stats">
			<p>
				<?php 
        if ($current_month_offset != date('m')) {
            ?>
					<a href="admin.php?page=fflcommerce&amp;month=<?php 
            echo $current_month_offset + 1;
            ?>
" class="next"><?php 
            _e('Next Month &rarr;', 'fflcommerce');
            ?>
</a>
				<?php 
        }
        ?>
				<a href="admin.php?page=fflcommerce&amp;month=<?php 
        echo $current_month_offset - 1;
        ?>
" class="previous"><?php 
        _e('&larr; Previous Month', 'fflcommerce');
        ?>
</a>
			</p>

			<div class="inside">
				<div id="placeholder" style="width:100%; height:300px; position:relative;"></div>
				<script type="text/javascript">
					/* <![CDATA[ */
					jQuery(function(){
						function weekendAreas(axes){
							var markings = [];
							var d = new Date(axes.xaxis.min);
							// go to the first Saturday
							d.setUTCDate(d.getUTCDate() - ((d.getUTCDay() + 1) % 7))
							d.setUTCSeconds(0);
							d.setUTCMinutes(0);
							d.setUTCHours(0);
							var i = d.getTime();
							do {
								// when we don't set yaxis, the rectangle automatically
								// extends to infinity upwards and downwards
								markings.push({ xaxis: { from: i, to: i + 2 * 24 * 60 * 60 * 1000 } });
								i += 7 * 24 * 60 * 60 * 1000;
							} while(i < axes.xaxis.max);
							return markings;
						}

						<?php 
        function orders_this_month($where = '')
        {
            global $current_month_offset;
            $month = $current_month_offset;
            $year = (int) date('Y');
            $first_day = strtotime("{$year}-{$month}-01");
            $last_day = strtotime('-1 second', strtotime('+1 month', $first_day));
            $after = date('Y-m-d H:i:s', $first_day);
            $before = date('Y-m-d H:i:s', $last_day);
            $where .= " AND post_date >= '{$after}'";
            $where .= " AND post_date <= '{$before}'";
            return $where;
        }
        add_filter('posts_where', 'orders_this_month');
        $args = array('numberposts' => -1, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'shop_order', 'post_status' => 'publish', 'suppress_filters' => false);
        $orders = get_posts($args);
        $order_counts = array();
        $order_amounts = array();
        // Blank date ranges to begin
        $month = $current_month_offset;
        $year = (int) date('Y');
        $first_day = strtotime("{$year}-{$month}-01");
        $last_day = strtotime('-1 second', strtotime('+1 month', $first_day));
        if (date('m') - $current_month_offset == 0) {
            $up_to = date('d', strtotime('NOW'));
        } else {
            $up_to = date('d', $last_day);
        }
        $count = 0;
        while ($count < $up_to) {
            $time = strtotime(date('Ymd', strtotime('+ ' . $count . ' DAY', $first_day))) . '000';
            $order_counts[$time] = 0;
            $order_amounts[$time] = 0;
            $count++;
        }
        if ($orders) {
            foreach ($orders as $order) {
                $order_data = new fflcommerce_order($order->ID);
                if ($order_data->status == 'cancelled' || $order_data->status == 'refunded') {
                    continue;
                }
                $time = strtotime(date('Ymd', strtotime($order->post_date))) . '000';
                if (isset($order_counts[$time])) {
                    $order_counts[$time]++;
                } else {
                    $order_counts[$time] = 1;
                }
                if (isset($order_amounts[$time])) {
                    $order_amounts[$time] = $order_amounts[$time] + $order_data->order_total;
                } else {
                    $order_amounts[$time] = (double) $order_data->order_total;
                }
            }
        }
        remove_filter('posts_where', 'orders_this_month');
        ?>
						var d = [
							<?php 
        $values = array();
        foreach ($order_counts as $key => $value) {
            $values[] = "[{$key}, {$value}]";
        }
        echo implode(',', $values);
        ?>
						];
						for(var i = 0; i < d.length; ++i) d[i][0] += 60 * 60 * 1000;
						var d2 = [
							<?php 
        $values = array();
        foreach ($order_amounts as $key => $value) {
            $values[] = "[{$key}, {$value}]";
        }
        echo implode(',', $values);
        ?>
						];
						for(var i = 0; i < d2.length; ++i) d2[i][0] += 60 * 60 * 1000;
						var plot = jQuery.plot(jQuery("#placeholder"), [
							{ label: "<?php 
        __('Number of sales', 'fflcommerce');
        ?>
", data: d },
							{ label: "<?php 
        __('Sales amount', 'fflcommerce');
        ?>
", data: d2, yaxis: 2 }
						], {
							series: {
								lines: { show: true },
								points: { show: true }
							},
							grid: {
								show: true,
								aboveData: false,
								color: '#ccc',
								backgroundColor: '#fff',
								borderWidth: 2,
								borderColor: '#ccc',
								clickable: false,
								hoverable: true,
								markings: weekendAreas
							},
							xaxis: {
								mode: "time",
								timeformat: "%d %b",
								tickLength: 1,
								minTickSize: [1, "day"]
							},
							yaxes: [
								{ min: 0, tickDecimals: 0 },
								{ position: "right", min: 0, tickDecimals: 2 }
							],
							colors: ["#21759B", "#ed8432"]
						});

						function showTooltip(x, y, contents){
							jQuery('<div id="tooltip">' + contents + '</div>').css({
								position: 'absolute',
								display: 'none',
								top: y + 5,
								left: x + 5,
								border: '1px solid #fdd',
								padding: '2px',
								'background-color': '#fee',
								opacity: 0.80
							}).appendTo("body").fadeIn(200);
						}

						var previousPoint = null;
						jQuery("#placeholder").bind("plothover", function(event, pos, item){
							if(item){
								if(previousPoint != item.dataIndex){
									previousPoint = item.dataIndex;
									jQuery("#tooltip").remove();
									if(item.series.label == "<?php 
        __('Number of sales', 'fflcommerce');
        ?>
"){
										var y = item.datapoint[1];
										showTooltip(item.pageX, item.pageY, item.series.label + " - " + y);
									} else {
										var y = item.datapoint[1].toFixed(2);
										showTooltip(item.pageX, item.pageY, item.series.label + " - <?php 
        echo get_fflcommerce_currency_symbol();
        ?>
" + y);
									}
								}
							}
							else {
								jQuery("#tooltip").remove();
								previousPoint = null;
							}
						});
					});
					/* ]]> */
				</script>
			</div>
		</div>
	<?php 
    }
 /**
  * Return currency tooltip FC based on FFL Commerce currency position settings.
  *
  * @return string
  */
 public function get_currency_tooltip()
 {
     $options = FFLCommerce_Base::get_options();
     switch ($options->get('fflcommerce_currency_pos')) {
         case 'right':
             $currency_tooltip = 'append_tooltip: "' . get_fflcommerce_currency_symbol() . '"';
             break;
         case 'right_space':
             $currency_tooltip = 'append_tooltip: "&nbsp;' . get_fflcommerce_currency_symbol() . '"';
             break;
         case 'left':
             $currency_tooltip = 'prepend_tooltip: "' . get_fflcommerce_currency_symbol() . '"';
             break;
         case 'left_space':
         default:
             $currency_tooltip = 'prepend_tooltip: "' . get_fflcommerce_currency_symbol() . '&nbsp;"';
             break;
     }
     return $currency_tooltip;
 }
    /**
     * Get the main chart
     *
     * @return string
     */
    public function get_main_chart()
    {
        global $wp_locale;
        // Prepare data for report
        $order_counts = $this->prepare_chart_data($this->report_data->order_counts, 'post_date', 'count', $this->chart_interval, $this->start_date, $this->chart_groupby);
        $order_item_counts = $this->prepare_chart_data($this->report_data->order_items, 'post_date', 'order_item_count', $this->chart_interval, $this->start_date, $this->chart_groupby);
        $order_amounts = $this->prepare_chart_data($this->report_data->orders, 'post_date', 'total_sales', $this->chart_interval, $this->start_date, $this->chart_groupby);
        $coupon_amounts = $this->prepare_chart_data($this->report_data->coupons, 'post_date', 'discount_amount', $this->chart_interval, $this->start_date, $this->chart_groupby);
        $shipping_amounts = $this->prepare_chart_data($this->report_data->orders, 'post_date', 'total_shipping', $this->chart_interval, $this->start_date, $this->chart_groupby);
        $shipping_tax_amounts = $this->prepare_chart_data($this->report_data->orders, 'post_date', 'total_shipping_tax', $this->chart_interval, $this->start_date, $this->chart_groupby);
        $tax_amounts = $this->prepare_chart_data($this->report_data->orders, 'post_date', 'total_tax', $this->chart_interval, $this->start_date, $this->chart_groupby);
        $net_order_amounts = array();
        foreach ($order_amounts as $order_amount_key => $order_amount_value) {
            $net_order_amounts[$order_amount_key] = $order_amount_value;
            $net_order_amounts[$order_amount_key][1] = $net_order_amounts[$order_amount_key][1] - $shipping_amounts[$order_amount_key][1] - $shipping_tax_amounts[$order_amount_key][1] - $tax_amounts[$order_amount_key][1];
        }
        // Encode in json format
        $chart_data = json_encode(array('order_counts' => array_values($order_counts), 'order_item_counts' => array_values($order_item_counts), 'order_amounts' => array_map(array($this, 'round_chart_totals'), array_values($order_amounts)), 'net_order_amounts' => array_map(array($this, 'round_chart_totals'), array_values($net_order_amounts)), 'shipping_amounts' => array_map(array($this, 'round_chart_totals'), array_values($shipping_amounts)), 'coupon_amounts' => array_map(array($this, 'round_chart_totals'), array_values($coupon_amounts))));
        ?>
		<div class="chart-container">
			<div class="chart-placeholder main"></div>
		</div>
		<script type="text/javascript">
			var main_chart;
			jQuery(function(){
				var order_data = jQuery.parseJSON('<?php 
        echo $chart_data;
        ?>
');
				var drawGraph = function(highlight){
					var series = [
						{
							label: "<?php 
        echo esc_js(__('Number of items sold', 'fflcommerce'));
        ?>
",
							data: order_data.order_item_counts,
							color: '<?php 
        echo $this->chart_colours['item_count'];
        ?>
',
							bars: {
								fillColor: '<?php 
        echo $this->chart_colours['item_count'];
        ?>
',
								fill: true,
								show: true,
								lineWidth: 0,
								align: 'left',
								barWidth: 0<?php 
        echo $this->barwidth;
        ?>
 * 0.25
							},
							shadowSize: 0,
							hoverable: false
						},
						{
							label: "<?php 
        echo esc_js(__('Number of orders', 'fflcommerce'));
        ?>
",
							data: order_data.order_counts,
							color: '<?php 
        echo $this->chart_colours['order_count'];
        ?>
',
							bars: {
								fillColor: '<?php 
        echo $this->chart_colours['order_count'];
        ?>
',
								fill: true,
								show: true,
								lineWidth: 0,
								align: 'right',
								barWidth: 0<?php 
        echo $this->barwidth;
        ?>
 * 0.25
							},
							shadowSize: 0,
							hoverable: false
						},
						{
							label: "<?php 
        echo esc_js(__('Average sales amount', 'fflcommerce'));
        ?>
",
							data: [[<?php 
        echo min(array_keys($order_amounts));
        ?>
, <?php 
        echo $this->report_data->average_sales;
        ?>
], [<?php 
        echo max(array_keys($order_amounts));
        ?>
, <?php 
        echo $this->report_data->average_sales;
        ?>
]],
							yaxis: 2,
							color: '<?php 
        echo $this->chart_colours['average'];
        ?>
',
							points: {show: false},
							lines: {show: true, lineWidth: 2, fill: false},
							shadowSize: 0,
							hoverable: false
						},
						{
							label: "<?php 
        echo esc_js(__('Coupon amount', 'fflcommerce'));
        ?>
",
							data: order_data.coupon_amounts,
							yaxis: 2,
							color: '<?php 
        echo $this->chart_colours['coupon_amount'];
        ?>
',
							points: {show: true, radius: 5, lineWidth: 2, fillColor: '#fff', fill: true},
							lines: {show: true, lineWidth: 2, fill: false},
							shadowSize: 0,
							<?php 
        echo $this->get_currency_tooltip();
        ?>
						},
						{
							label: "<?php 
        echo esc_js(__('Shipping amount', 'fflcommerce'));
        ?>
",
							data: order_data.shipping_amounts,
							yaxis: 2,
							color: '<?php 
        echo $this->chart_colours['shipping_amount'];
        ?>
',
							points: {show: true, radius: 5, lineWidth: 2, fillColor: '#fff', fill: true},
							lines: {show: true, lineWidth: 2, fill: false},
							shadowSize: 0,
							prepend_tooltip: "<?php 
        echo get_fflcommerce_currency_symbol();
        ?>
"
						},
						{
							label: "<?php 
        echo esc_js(__('Gross Sales amount', 'fflcommerce'));
        ?>
",
							data: order_data.order_amounts,
							yaxis: 2,
							color: '<?php 
        echo $this->chart_colours['sales_amount'];
        ?>
',
							points: {show: true, radius: 5, lineWidth: 2, fillColor: '#fff', fill: true},
							lines: {show: true, lineWidth: 2, fill: false},
							shadowSize: 0,
							<?php 
        echo $this->get_currency_tooltip();
        ?>
						},
						{
							label: "<?php 
        echo esc_js(__('Net Sales amount', 'fflcommerce'));
        ?>
",
							data: order_data.net_order_amounts,
							yaxis: 2,
							color: '<?php 
        echo $this->chart_colours['net_sales_amount'];
        ?>
',
							points: {show: true, radius: 6, lineWidth: 4, fillColor: '#fff', fill: true},
							lines: {show: true, lineWidth: 5, fill: false},
							shadowSize: 0,
							<?php 
        echo $this->get_currency_tooltip();
        ?>
						}
					];
					if(highlight !== 'undefined' && series[highlight]){
						highlight_series = series[highlight];
						highlight_series.color = '#98c242';
						if(highlight_series.bars)
							highlight_series.bars.fillColor = '#98c242';
						if(highlight_series.lines){
							highlight_series.lines.lineWidth = 5;
						}
					}
					main_chart = jQuery.plot(
						jQuery('.chart-placeholder.main'),
						series,
						{
							legend: {
								show: false
							},
							grid: {
								color: '#aaa',
								borderColor: 'transparent',
								borderWidth: 0,
								hoverable: true
							},
							xaxes: [{
								color: '#aaa',
								position: "bottom",
								tickColor: 'transparent',
								mode: "time",
								timeformat: "<?php 
        if ($this->chart_groupby == 'hour') {
            echo '%H';
        } elseif ($this->chart_groupby == 'day') {
            echo '%d %b';
        } else {
            echo '%b';
        }
        ?>
",
								<?php 
        if ($this->chart_groupby == 'hour') {
            ?>
								min: 0,
								max: 24*3600000,
								<?php 
        }
        ?>
								monthNames: <?php 
        echo json_encode(array_values($wp_locale->month_abbrev));
        ?>
,
								tickLength: 1,
								minTickSize: [1, "<?php 
        echo $this->chart_groupby;
        ?>
"],
								font: {
									color: "#aaa"
								}
							}],
							yaxes: [
								{
									min: 0,
									minTickSize: 1,
									tickDecimals: 0,
									color: '#d4d9dc',
									font: {color: "#aaa"}
								},
								{
									position: "right",
									min: 0,
									tickDecimals: 2,
									alignTicksWithAxis: 1,
									autoscaleMargin: 0,
									color: 'transparent',
									font: {color: "#aaa"}
								}
							]
						}
					);
					jQuery('.chart-placeholder').resize();
				};

				drawGraph();
				jQuery('.highlight_series').hover(
					function(){
						drawGraph(jQuery(this).data('series'));
					},
					function(){
						drawGraph();
					}
				);
			});
		</script>
	<?php 
    }
Example #8
0
function fflcommerce_price($price, $args = array())
{
    $options = FFLCommerce_Base::get_options();
    $ex_tax_label = 0;
    $with_currency = true;
    extract(shortcode_atts(array('ex_tax_label' => 0, 'with_currency' => true), $args));
    if ($ex_tax_label === 1) {
        $tax_label = __(' <small>(ex. tax)</small>', 'fflcommerce');
    } else {
        if ($ex_tax_label === 2) {
            $tax_label = __(' <small>(inc. tax)</small>', 'fflcommerce');
        } else {
            $tax_label = '';
        }
    }
    $price = number_format((double) $price, (int) $options->get('fflcommerce_price_num_decimals'), $options->get('fflcommerce_price_decimal_sep'), $options->get('fflcommerce_price_thousand_sep'));
    $return = $price;
    if ($with_currency) {
        $currency_pos = $options->get('fflcommerce_currency_pos');
        $currency_symbol = get_fflcommerce_currency_symbol();
        $currency_code = $options->get('fflcommerce_currency');
        switch ($currency_pos) {
            case 'left':
                $return = $currency_symbol . $price;
                break;
            case 'left_space':
                $return = $currency_symbol . ' ' . $price;
                break;
            case 'right':
                $return = $price . $currency_symbol;
                break;
            case 'right_space':
                $return = $price . ' ' . $currency_symbol;
                break;
            case 'left_code':
                $return = $currency_code . $price;
                break;
            case 'left_code_space':
                $return = $currency_code . ' ' . $price;
                break;
            case 'right_code':
                $return = $price . $currency_code;
                break;
            case 'right_code_space':
                $return = $price . ' ' . $currency_code;
                break;
            case 'code_symbol':
                $return = $currency_code . $price . $currency_symbol;
                break;
            case 'code_symbol_space':
                $return = $currency_code . ' ' . $price . ' ' . $currency_symbol;
                break;
            case 'symbol_code':
                $return = $currency_symbol . $price . $currency_code;
                break;
            case 'symbol_code_space':
                $return = $currency_symbol . ' ' . $price . ' ' . $currency_code;
                break;
        }
        // only show tax label (ex. tax) if we are going to show the price with currency as well. Otherwise we just want the formatted price
        if ($options->get('fflcommerce_calc_taxes') == 'yes') {
            $return .= $tax_label;
        }
    }
    return apply_filters('fflcommerce_price_display_filter', $return);
}
 /**
  * Sets the FFL Commerece default options
  *
  * This will create the default options array. Extensions may install options of the same format into this.
  *
  * @param   none
  * @return  Void
  *
  * @since	1.3
  *
  */
 private function set_default_options()
 {
     $symbols = fflcommerce::currency_symbols();
     $countries = fflcommerce::currency_countries();
     $currencies = array();
     foreach ($countries as $key => $country) {
         $currencies[$key] = $country . ' (' . $symbols[$key] . ')';
     }
     $currencies = apply_filters('fflcommerce_currencies', $currencies);
     $cSymbol = '';
     if (function_exists('get_fflcommerce_currency_symbol')) {
         $cSymbol = get_fflcommerce_currency_symbol();
     }
     $cCode = $this->get('fflcommerce_currency') ? $this->get('fflcommerce_currency') : 'GBP';
     $cSep = $this->get('fflcommerce_price_decimal_sep') ? $this->get('fflcommerce_price_decimal_sep') : '.';
     self::$default_options = array(array('type' => 'tab', 'name' => __('Shop', 'fflcommerce')), array('name' => __('Shop Options', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Base Country/Region', 'fflcommerce'), 'desc' => '', 'tip' => __('This is the base country for your business. Tax rates will be based on this country.', 'fflcommerce'), 'id' => 'fflcommerce_default_country', 'type' => 'single_select_country'), array('name' => __('Default Country/Region for customer', 'fflcommerce'), 'desc' => '', 'tip' => __('This is the country for your clients with new accounts.', 'fflcommerce'), 'id' => 'fflcommerce_default_country_for_customer', 'std' => $this->get('fflcommerce_default_country'), 'type' => 'single_select_country', 'options' => array('add_empty' => true)), array('name' => __('Currency', 'fflcommerce'), 'desc' => '', 'tip' => __('This controls what currency the prices are listed with in the Catalog, and which currency PayPal, and other gateways, will take payments in.', 'fflcommerce'), 'id' => 'fflcommerce_currency', 'type' => 'select', 'choices' => $currencies), array('name' => __('Allowed Countries', 'fflcommerce'), 'desc' => '', 'tip' => __('These are countries that you are willing to ship to.', 'fflcommerce'), 'id' => 'fflcommerce_allowed_countries', 'type' => 'select', 'choices' => array('all' => __('All Countries', 'fflcommerce'), 'specific' => __('Specific Countries', 'fflcommerce'))), array('name' => __('Specific Countries', 'fflcommerce'), 'desc' => '', 'tip' => '', 'id' => 'fflcommerce_specific_allowed_countries', 'type' => 'multi_select_countries'), array('name' => __('Demo store', 'fflcommerce'), 'desc' => '', 'tip' => __('Enable this option to show a banner at the top of every page stating this shop is currently in testing mode.', 'fflcommerce'), 'id' => 'fflcommerce_demo_store', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Invoicing', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Company Name', 'fflcommerce'), 'desc' => '', 'tip' => __('Setting your company name will enable us to print it out on your invoice emails. Leave blank to disable.', 'fflcommerce'), 'id' => 'fflcommerce_company_name', 'type' => 'text'), array('name' => __('Tax Registration Number', 'fflcommerce'), 'desc' => __('Add your tax registration label before the registration number and it will be printed as well. eg. <code>VAT Number: 88888888</code>', 'fflcommerce'), 'tip' => __('Setting your tax number will enable us to print it out on your invoice emails. Leave blank to disable.', 'fflcommerce'), 'id' => 'fflcommerce_tax_number', 'type' => 'text'), array('name' => __('Address Line1', 'fflcommerce'), 'desc' => '', 'tip' => __('Setting your address will enable us to print it out on your invoice emails. Leave blank to disable.', 'fflcommerce'), 'id' => 'fflcommerce_address_1', 'type' => 'longtext'), array('name' => __('Address Line2', 'fflcommerce'), 'desc' => '', 'tip' => __('If address line1 is not set, address line2 will not display even if you put a value in it. Setting your address will enable us to print it out on your invoice emails. Leave blank to disable.', 'fflcommerce'), 'id' => 'fflcommerce_address_2', 'type' => 'longtext'), array('name' => __('Company Phone', 'fflcommerce'), 'desc' => '', 'tip' => __('Setting your company phone number will enable us to print it out on your invoice emails. Leave blank to disable.', 'fflcommerce'), 'id' => 'fflcommerce_company_phone', 'type' => 'text'), array('name' => __('Company Email', 'fflcommerce'), 'desc' => '', 'tip' => __('Setting your company email will enable us to print it out on your invoice emails. Leave blank to disable.', 'fflcommerce'), 'id' => 'fflcommerce_company_email', 'type' => 'email'), array('name' => __('Permalinks', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Prepend shop categories and tags with base page', 'fflcommerce'), 'desc' => '', 'tip' => __('This will only apply to tags &amp; categories.<br/>Enabled: http://yoursite.com / product_category / YourCategory<br/>Disabled: http://yoursite.com / base_page / product_category / YourCategory', 'fflcommerce'), 'id' => 'fflcommerce_prepend_shop_page_to_urls', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Prepend product permalinks with shop base page', 'fflcommerce'), 'desc' => '', 'tip' => '', 'id' => 'fflcommerce_prepend_shop_page_to_product', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Prepend product permalinks with product category', 'fflcommerce'), 'desc' => '', 'tip' => '', 'id' => 'fflcommerce_prepend_category_to_product', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Product category slug', 'fflcommerce'), 'desc' => '', 'tip' => __('Slug displayed in product category URLs. Leave blank to use default "product-category"', 'fflcommerce'), 'id' => 'fflcommerce_product_category_slug', 'type' => 'text'), array('name' => __('Product tag slug', 'fflcommerce'), 'desc' => '', 'tip' => __('Slug displayed in product tag URLs. Leave blank to use default "product-tag"', 'fflcommerce'), 'id' => 'fflcommerce_product_tag_slug', 'type' => 'text'), array('type' => 'tab', 'name' => __('General', 'fflcommerce')), array('name' => __('General Options', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Cart shows "Return to Shop" button', 'fflcommerce'), 'desc' => '', 'tip' => __('Enabling this setting will display a "Return to Shop" button on the Cart page along with the "Continue to Checkout" button.', 'fflcommerce'), 'id' => 'fflcommerce_cart_shows_shop_button', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('After adding product to cart', 'fflcommerce'), 'desc' => '', 'tip' => __('Define what should happen when a user clicks on &#34;Add to Cart&#34; on any product or page.', 'fflcommerce'), 'id' => 'fflcommerce_redirect_add_to_cart', 'type' => 'radio', 'extra' => array('vertical'), 'choices' => array('same_page' => __('Stay on the same page', 'fflcommerce'), 'to_checkout' => __('Redirect to Checkout', 'fflcommerce'), 'to_cart' => __('Redirect to Cart', 'fflcommerce'))), array('name' => __('Cart status after login', 'fflcommerce'), 'desc' => __('Current cart <b>always</b> will be loaded if customer logs in checkout page.', 'fflcommerce'), 'tip' => __("Define what should happen with shopping cart if customer added items to shopping cart as guest and than he logs in to your shop.", 'fflcommerce'), 'id' => 'fflcommerce_cart_after_login', 'type' => 'select', 'choices' => array('load_saved' => __('Load saved cart', 'fflcommerce'), 'load_current' => __('Load current cart', 'fflcommerce'), 'merge' => __('Merge saved and current carts', 'fflcommerce'))), array('name' => __('Reset pending Orders', 'fflcommerce'), 'desc' => __("Change all 'Pending' Orders older than one month to 'On Hold'", 'fflcommerce'), 'tip' => __("For customers that have not completed the Checkout process or haven't paid for an Order after a period of time, this will reset the Order to On Hold allowing the Shop owner to take action.  WARNING: For the first use on an existing Shop this setting <em>can</em> generate a <strong>lot</strong> of email!", 'fflcommerce'), 'id' => 'fflcommerce_reset_pending_orders', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Complete processing Orders', 'fflcommerce'), 'desc' => __("Change all 'Processing' Orders older than one month to 'Completed'", 'fflcommerce'), 'tip' => __("For orders that have been completed but the status is still set to 'processing'.  This will move them to a 'completed' status without sending an email out to all the customers.", 'fflcommerce'), 'id' => 'fflcommerce_complete_processing_orders', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Enforce login for downloads', 'fflcommerce'), 'desc' => '', 'tip' => __('If a guest purchases a download, the guest can still download a link without logging in. We recommend disabling guest purchases if you enable this option.', 'fflcommerce'), 'id' => 'fflcommerce_downloads_require_login', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Disable FFL Commerce frontend.css', 'fflcommerce'), 'desc' => __('(The next option below will have no effect if this one is disabled)', 'fflcommerce'), 'tip' => __('Useful if you want to disable FFL Commerce styles and theme it yourself via your theme.', 'fflcommerce'), 'id' => 'fflcommerce_disable_css', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Include extra theme styles with FFL Commerce frontend.css', 'fflcommerce'), 'desc' => '', 'tip' => __("With this option <em>on</em>, FFL Commerce's default frontend.css will still load, and any extra bits found in 'theme/fflcommerce/style.css' for over-rides will also be loaded.", 'fflcommerce'), 'id' => 'fflcommerce_frontend_with_theme_css', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Disable bundled Lightbox', 'fflcommerce'), 'desc' => __('Product galleries and images as well as the Add Review form will open in a lightbox.', 'fflcommerce'), 'tip' => __('Useful if your theme or other plugin already loads our Lightbox script and css (prettyPhoto), or you want to use a different one.', 'fflcommerce'), 'id' => 'fflcommerce_disable_fancybox', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Use custom product category order', 'fflcommerce'), 'desc' => '', 'tip' => __('This option allows to make custom product category order, by drag and drop method.', 'fflcommerce'), 'id' => 'fflcommerce_enable_draggable_categories', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('FFL Commerce messages', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Message disappear time', 'fflcommerce'), 'desc' => __('How long message is displayed before disappearing (in ms). Set to 0 to keep it displayed.', 'fflcommerce'), 'id' => 'fflcommerce_message_disappear_time', 'type' => 'natural'), array('name' => __('Error disappear time', 'fflcommerce'), 'desc' => __('How long error is displayed before disappearing (in ms). Set to 0 to keep it displayed.', 'fflcommerce'), 'id' => 'fflcommerce_error_disappear_time', 'type' => 'natural'), array('name' => __('Email Details', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('FFL Commerce email address', 'fflcommerce'), 'desc' => '', 'tip' => __('The email address used to send all FFL Commerce related emails, such as order confirmations and notices.  This may be different than your Company email address on "Shop Tab -> Invoicing".', 'fflcommerce'), 'id' => 'fflcommerce_email', 'type' => 'email'), array('name' => __('Email from name', 'fflcommerce'), 'desc' => '', 'tip' => __('', 'fflcommerce'), 'id' => 'fflcommerce_email_from_name', 'type' => 'text'), array('name' => __('Email footer', 'fflcommerce'), 'desc' => '', 'tip' => __('The email footer used in all FFL Commerce emails.', 'fflcommerce'), 'id' => 'fflcommerce_email_footer', 'type' => 'textarea'), array('name' => __('Use HTML emails', 'fflcommerce'), 'desc' => '', 'tip' => __('This option enables HTML email templates.', 'fflcommerce'), 'id' => 'fflcommerce_enable_html_emails', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Generate default emails', 'fflcommerce'), 'desc' => '', 'tip' => '', 'id' => 'fflcommerce_email_generete_defaults', 'type' => 'user_defined', 'display' => array($this, 'generate_defaults_emails')), array('name' => __('Checkout page', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Validate postal/zip codes', 'fflcommerce'), 'desc' => '', 'tip' => __('Enabling this setting will force proper postcodes to be entered by a customer for a country.', 'fflcommerce'), 'id' => 'fflcommerce_enable_postcode_validating', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Show verify information message', 'fflcommerce'), 'desc' => '', 'tip' => __('Enabling this setting will display a message at the bottom of the Checkout asking customers to verify all their informatioin is correctly entered before placing their Order.  This is useful in particular for Countries that have states to ensure the correct shipping state is selected.', 'fflcommerce'), 'id' => 'fflcommerce_verify_checkout_info_message', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Show EU VAT reduction message', 'fflcommerce'), 'desc' => __('This will only apply to EU Union based Shops.', 'fflcommerce'), 'tip' => __('Enabling this setting will display a message at the bottom of the Checkout informing the customer that EU VAT will not be removed until the Order is placed and only if they have provided a valid EU VAT Number.', 'fflcommerce'), 'id' => 'fflcommerce_eu_vat_reduction_message', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Allow guest purchases', 'fflcommerce'), 'desc' => '', 'tip' => __('Enabling this setting will allow users to checkout without registering or signing up. Otherwise, users must be signed in or must sign up to checkout.', 'fflcommerce'), 'id' => 'fflcommerce_enable_guest_checkout', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Show login form', 'fflcommerce'), 'desc' => '', 'id' => 'fflcommerce_enable_guest_login', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Allow registration', 'fflcommerce'), 'desc' => '', 'id' => 'fflcommerce_enable_signup_form', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Force SSL on checkout', 'fflcommerce'), 'desc' => '', 'tip' => __('This will load your checkout page with https://. An SSL certificate is <strong>required</strong> if you choose yes. Contact your hosting provider for more information on SSL Certs.', 'fflcommerce'), 'id' => 'fflcommerce_force_ssl_checkout', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Integration', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('ShareThis Publisher ID', 'fflcommerce'), 'desc' => __("Enter your <a href='http://sharethis.com/account/'>ShareThis publisher ID</a> to show ShareThis on product pages.", 'fflcommerce'), 'tip' => __('ShareThis is a small social sharing widget for posting links on popular sites such as Twitter and Facebook.', 'fflcommerce'), 'id' => 'fflcommerce_sharethis', 'type' => 'text'), array('name' => __('Google Analytics ID', 'fflcommerce'), 'desc' => __('Log into your Google Analytics account to find your ID. e.g. <code>UA-XXXXXXX-X</code>', 'fflcommerce'), 'id' => 'fflcommerce_ga_id', 'type' => 'text'), array('name' => __('Enable eCommerce Tracking', 'fflcommerce'), 'tip' => __('Add Google Analytics eCommerce tracking code upon successful orders', 'fflcommerce'), 'desc' => __('<a href="//support.google.com/analytics/bin/answer.py?hl=en&answer=1009612">Learn how to enable</a> eCommerce tracking for your Google Analytics account.', 'fflcommerce'), 'id' => 'fflcommerce_ga_ecommerce_tracking_enabled', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('type' => 'tab', 'name' => __('Pages', 'fflcommerce')), array('name' => __('Page configurations', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Cart Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_cart]</code>', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_cart_page_id', 'type' => 'single_select_page'), array('name' => __('Checkout Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_checkout]</code>', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_checkout_page_id', 'type' => 'single_select_page'), array('name' => __('Pay Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_pay]</code><br/>Default parent page: Checkout', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_pay_page_id', 'type' => 'single_select_page'), array('name' => __('Thanks Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_thankyou]</code><br/>Default parent page: Checkout', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_thanks_page_id', 'type' => 'single_select_page'), array('name' => __('My Account Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_my_account]</code>', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_myaccount_page_id', 'type' => 'single_select_page'), array('name' => __('Edit Address Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_edit_address]</code><br/>Default parent page: My Account', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_edit_address_page_id', 'type' => 'single_select_page'), array('name' => __('View Order Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_view_order]</code><br/>Default parent page: My Account', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_view_order_page_id', 'type' => 'single_select_page'), array('name' => __('Change Password Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_change_password]</code><br/>Default parent page: My Account', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_change_password_page_id', 'type' => 'single_select_page'), array('name' => __('Track Order Page', 'fflcommerce'), 'desc' => __('Shortcode to place on page: <code>[fflcommerce_order_tracking]</code>', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_track_order_page_id', 'type' => 'single_select_page'), array('name' => __('Terms Page', 'fflcommerce'), 'desc' => __('If you define a &#34;Terms&#34; page the customer will be asked to accept it before allowing them to place their order.', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_terms_page_id', 'type' => 'single_select_page', 'extra' => 'show_option_none=' . __('None', 'fflcommerce')), array('type' => 'tab', 'name' => __('Catalog &amp; Pricing', 'fflcommerce')), array('name' => __('Catalog Options', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Catalog base page', 'fflcommerce'), 'desc' => '', 'tip' => __('This sets the base page of your shop. You should not change this value once you have launched your site otherwise you risk breaking urls of other sites pointing to yours, etc.', 'fflcommerce'), 'id' => 'fflcommerce_shop_page_id', 'type' => 'single_select_page'), array('name' => __('Shop redirection page', 'fflcommerce'), 'desc' => '', 'tip' => __('This will point users to the page you set for buttons like `Return to shop` or `Continue Shopping`.', 'fflcommerce'), 'id' => 'fflcommerce_shop_redirect_page_id', 'type' => 'single_select_page'), array('name' => __('Catalog product buttons show', 'fflcommerce'), 'desc' => '', 'tip' => __('This will determine the type of button and the action it will use when clicked on the Shop and Category product listings.  You can also set it to use no button.', 'fflcommerce'), 'id' => 'fflcommerce_catalog_product_button', 'type' => 'radio', 'choices' => array('add' => __('Add to Cart', 'fflcommerce'), 'view' => __('View Product', 'fflcommerce'), 'none' => __('No Button', 'fflcommerce'))), array('name' => __('Sort products in catalog by', 'fflcommerce'), 'desc' => '', 'tip' => __('Determines the display sort order of products for the Shop, Categories, and Tag pages.', 'fflcommerce'), 'id' => 'fflcommerce_catalog_sort_orderby', 'type' => 'radio', 'choices' => array('post_date' => __('Creation Date', 'fflcommerce'), 'title' => __('Product Title', 'fflcommerce'), 'menu_order' => __('Product Post Order', 'fflcommerce'))), array('name' => __('Catalog sort direction', 'fflcommerce'), 'desc' => '', 'tip' => __('Determines whether the catalog sort orderby is ascending or descending.', 'fflcommerce'), 'id' => 'fflcommerce_catalog_sort_direction', 'type' => 'radio', 'choices' => array('asc' => __('Ascending', 'fflcommerce'), 'desc' => __('Descending', 'fflcommerce'))), array('name' => __('Catalog products per row', 'fflcommerce'), 'desc' => __('Default = 3', 'fflcommerce'), 'tip' => __('Determines how many products to show on one display row for Shop, Category and Tag pages.', 'fflcommerce'), 'id' => 'fflcommerce_catalog_columns', 'type' => 'number', 'extra' => array('min' => 1, 'max' => 10, 'step' => 1)), array('name' => __('Catalog products per page', 'fflcommerce'), 'desc' => __('Default = 12', 'fflcommerce'), 'tip' => __('Determines how many products to display on Shop, Category and Tag pages before needing next and previous page navigation.', 'fflcommerce'), 'id' => 'fflcommerce_catalog_per_page', 'type' => 'number', 'extra' => array('min' => 1, 'max' => 100, 'step' => 1)), array('name' => __('Pricing Options', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Show prices with tax', 'fflcommerce'), 'desc' => __("This controls the display of the product price in cart and checkout page.", 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_show_prices_with_tax', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Currency display', 'fflcommerce'), 'desc' => __("This controls the display of the currency symbol and currency code.", 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_currency_pos', 'type' => 'select', 'choices' => array('left' => sprintf('%1$s0%2$s00', $cSymbol, $cSep), 'left_space' => sprintf('%1$s0 %2$s00', $cSymbol, $cSep), 'right' => sprintf('0%2$s00%1$s', $cSymbol, $cSep), 'right_space' => sprintf('0%2$s00 %1$s', $cSymbol, $cSep), 'left_code' => sprintf('%1$s0%2$s00', $cCode, $cSep), 'left_code_space' => sprintf('%1$s 0%2$s00', $cCode, $cSep), 'right_code' => sprintf('0%2$s00%1$s', $cCode, $cSep), 'right_code_space' => sprintf('0%2$s00 %1$s', $cCode, $cSep), 'symbol_code' => sprintf('%1$s0%2$s00%3$s', $cSymbol, $cSep, $cCode), 'symbol_code_space' => sprintf('%1$s 0%2$s00 %3$s', $cSymbol, $cSep, $cCode), 'code_symbol' => sprintf('%3$s0%2$s00%1$s', $cSymbol, $cSep, $cCode), 'code_symbol_space' => sprintf('%3$s 0%2$s00 %1$s', $cSymbol, $cSep, $cCode))), array('name' => __('Thousand separator', 'fflcommerce'), 'desc' => __('This sets the thousand separator of displayed prices.', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_price_thousand_sep', 'type' => 'text'), array('name' => __('Decimal separator', 'fflcommerce'), 'desc' => __('This sets the decimal separator of displayed prices.', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_price_decimal_sep', 'type' => 'text'), array('name' => __('Number of decimals', 'fflcommerce'), 'desc' => __('This sets the number of decimal points shown in displayed prices.', 'fflcommerce'), 'tip' => '', 'id' => 'fflcommerce_price_num_decimals', 'type' => 'natural'), array('type' => 'tab', 'name' => __('Images', 'fflcommerce')), array('name' => __('Image Options', 'fflcommerce'), 'type' => 'title', 'desc' => sprintf(__('<p>Changing any of these settings will affect the dimensions of images used in your Shop. After changing these settings you may need to <a href="%s">regenerate your thumbnails</a>.</p><p>Crop: Leave unchecked to set the image size by resizing the image proportionally (that is, without distorting it). Leave checked to set the image size by hard cropping the image (either from the sides, or from the top and bottom).</p><p><strong>Note:</strong> Your images may not display in the size you choose below. This is because they may still be affected by CSS styles in your theme.', 'fflcommerce'), 'https://wordpress.org/plugins/regenerate-thumbnails/')), array('name' => __('Cropping Options', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Crop Tiny images', 'fflcommerce'), 'desc' => '', 'tip' => __('Use No to set the image size by resizing the image proportionally (that is, without distorting it).<br />Use Yes to set the image size by hard cropping the image (either from the sides, or from the top and bottom).', 'fflcommerce'), 'id' => 'fflcommerce_use_wordpress_tiny_crop', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Crop Thumbnail images', 'fflcommerce'), 'desc' => '', 'tip' => __('Use No to set the image size by resizing the image proportionally (that is, without distorting it).<br />Use Yes to set the image size by hard cropping the image (either from the sides, or from the top and bottom).', 'fflcommerce'), 'id' => 'fflcommerce_use_wordpress_thumbnail_crop', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Crop Catalog images', 'fflcommerce'), 'desc' => '', 'tip' => __('Use No to set the image size by resizing the image proportionally (that is, without distorting it).<br />Use Yes to set the image size by hard cropping the image (either from the sides, or from the top and bottom).', 'fflcommerce'), 'id' => 'fflcommerce_use_wordpress_catalog_crop', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Crop Large images', 'fflcommerce'), 'desc' => '', 'tip' => __('Use No to set the image size by resizing the image proportionally (that is, without distorting it).<br />Use Yes to set the image size by hard cropping the image (either from the sides, or from the top and bottom).', 'fflcommerce'), 'id' => 'fflcommerce_use_wordpress_featured_crop', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Image Sizes', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Tiny Image Width', 'fflcommerce'), 'desc' => __('Default = 36px', 'fflcommerce'), 'tip' => __('Set the width of the small image used in the Cart, Checkout, Orders and Widgets.', 'fflcommerce'), 'id' => 'fflcommerce_shop_tiny_w', 'type' => 'natural'), array('name' => __('Tiny Image Height', 'fflcommerce'), 'desc' => __('Default = 36px', 'fflcommerce'), 'tip' => __('Set the height of the small image used in the Cart, Checkout, Orders and Widgets.', 'fflcommerce'), 'id' => 'fflcommerce_shop_tiny_h', 'type' => 'natural'), array('name' => __('Thumbnail Image Width', 'fflcommerce'), 'desc' => __('Default = 90px', 'fflcommerce'), 'tip' => __('Set the width of the thumbnail image for Single Product page extra images.', 'fflcommerce'), 'id' => 'fflcommerce_shop_thumbnail_w', 'type' => 'natural'), array('name' => __('Thumbnail Image Height', 'fflcommerce'), 'desc' => __('Default = 90px', 'fflcommerce'), 'tip' => __('Set the height of the thumbnail image for Single Product page extra images.', 'fflcommerce'), 'id' => 'fflcommerce_shop_thumbnail_h', 'type' => 'natural'), array('name' => __('Catalog Image Width', 'fflcommerce'), 'desc' => __('Default = 150px', 'fflcommerce'), 'tip' => __('Set the width of the catalog image for Shop, Categories, Tags, and Related Products.', 'fflcommerce'), 'id' => 'fflcommerce_shop_small_w', 'type' => 'natural'), array('name' => __('Catalog Image Height', 'fflcommerce'), 'desc' => __('Default = 150px', 'fflcommerce'), 'tip' => __('Set the height of the catalog image for Shop, Categories, Tags, and Related Products.', 'fflcommerce'), 'id' => 'fflcommerce_shop_small_h', 'type' => 'natural'), array('name' => __('Large Image Width', 'fflcommerce'), 'desc' => __('Default = 300px', 'fflcommerce'), 'tip' => __('Set the width of the Single Product page large or Featured image.', 'fflcommerce'), 'id' => 'fflcommerce_shop_large_w', 'type' => 'natural'), array('name' => __('Large Image Height', 'fflcommerce'), 'desc' => __('Default = 300px', 'fflcommerce'), 'tip' => __('Set the height of the Single Product page large or Featured image.', 'fflcommerce'), 'id' => 'fflcommerce_shop_large_h', 'type' => 'natural'), array('type' => 'tab', 'name' => __('Products & Inventory', 'fflcommerce')), array('name' => __('Product Options', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Enable SKU field', 'fflcommerce'), 'desc' => '', 'tip' => __('Turning off the SKU field will give products an SKU of their post id.', 'fflcommerce'), 'id' => 'fflcommerce_enable_sku', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Enable weight field', 'fflcommerce'), 'desc' => '', 'tip' => '', 'id' => 'fflcommerce_enable_weight', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Weight Unit', 'fflcommerce'), 'desc' => '', 'tip' => __("This controls what unit you will define weights in.", 'fflcommerce'), 'id' => 'fflcommerce_weight_unit', 'type' => 'radio', 'choices' => array('kg' => __('Kilograms', 'fflcommerce'), 'lbs' => __('Pounds', 'fflcommerce'))), array('name' => __('Enable product dimensions', 'fflcommerce'), 'desc' => '', 'tip' => '', 'id' => 'fflcommerce_enable_dimensions', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Dimensions Unit', 'fflcommerce'), 'desc' => '', 'tip' => __('This controls what unit you will define dimensions in.', 'fflcommerce'), 'id' => 'fflcommerce_dimension_unit', 'type' => 'radio', 'choices' => array('cm' => __('centimeters', 'fflcommerce'), 'in' => __('inches', 'fflcommerce'))), array('name' => __('Product thumbnail images per row', 'fflcommerce'), 'desc' => __('Default = 3', 'fflcommerce'), 'tip' => __('Determines how many extra product thumbnail images attached to a product to show on one row for the Single Product page.', 'fflcommerce'), 'id' => 'fflcommerce_product_thumbnail_columns', 'type' => 'number', 'extra' => array('min' => 1, 'max' => 10, 'step' => 1)), array('name' => __('Show related products', 'fflcommerce'), 'desc' => '', 'tip' => __('To show or hide the related products section on a single product page.', 'fflcommerce'), 'id' => 'fflcommerce_enable_related_products', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Inventory Options', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Manage stock', 'fflcommerce'), 'desc' => __('If you are not managing stock, turn it off here to disable it in admin and on the front-end.', 'fflcommerce'), 'tip' => __('You can manage stock on a per-item basis if you leave this option on.', 'fflcommerce'), 'id' => 'fflcommerce_manage_stock', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Show stock amounts', 'fflcommerce'), 'desc' => '', 'tip' => __('Set to yes to allow customers to view the amount of stock available for a product.', 'fflcommerce'), 'id' => 'fflcommerce_show_stock', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Notify on low stock', 'fflcommerce'), 'desc' => '', 'id' => 'fflcommerce_notify_low_stock', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Low stock threshold', 'fflcommerce'), 'desc' => '', 'tip' => __('You will receive a notification as soon this threshold is hit (if notifications are turned on).', 'fflcommerce'), 'id' => 'fflcommerce_notify_low_stock_amount', 'type' => 'natural', 'std' => '2'), array('name' => __('Notify on out of stock', 'fflcommerce'), 'desc' => '', 'id' => 'fflcommerce_notify_no_stock', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Out of stock threshold', 'fflcommerce'), 'desc' => '', 'tip' => __('You will receive a notification as soon this threshold is hit (if notifications are turned on).', 'fflcommerce'), 'id' => 'fflcommerce_notify_no_stock_amount', 'type' => 'natural'), array('name' => __('Hide out of stock products', 'fflcommerce'), 'desc' => '', 'tip' => __('For Yes: When the Out of Stock Threshold (above) is reached, the product visibility will be set to hidden so that it will not appear on the Catalog or Shop product lists.', 'fflcommerce'), 'id' => 'fflcommerce_hide_no_stock_product', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('type' => 'tab', 'name' => __('Tax', 'fflcommerce')), array('name' => __('Tax Options', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Calculate Taxes', 'fflcommerce'), 'desc' => __('Only turn this off if you are exclusively selling non-taxable items.', 'fflcommerce'), 'tip' => __('If you are not calculating taxes then you can ignore all other tax options.', 'fflcommerce'), 'id' => 'fflcommerce_calc_taxes', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Apply Taxes After Coupon', 'fflcommerce'), 'desc' => __('This will have no effect if Calculate Taxes is turned off.', 'fflcommerce'), 'tip' => __('If yes, taxes get applied after coupons. When no, taxes get applied before coupons.', 'fflcommerce'), 'id' => 'fflcommerce_tax_after_coupon', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Catalog Prices include tax?', 'fflcommerce'), 'desc' => __('This will only apply to the Shop, Category and Product pages.', 'fflcommerce'), 'tip' => __('This will have no effect on the Cart, Checkout, Emails, or final Orders; prices are always shown with tax out.', 'fflcommerce'), 'id' => 'fflcommerce_prices_include_tax', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Country to base taxes on', 'fflcommerce'), 'desc' => __('This option defines whether to use billing or shipping address to calculate taxes.', 'fflcommerce'), 'id' => 'fflcommerce_country_base_tax', 'type' => 'select', 'choices' => array('billing_country' => __('Billing', 'fflcommerce'), 'shipping_country' => __('Shipping', 'fflcommerce'))), array('name' => __('Additional Tax classes', 'fflcommerce'), 'desc' => __('List 1 per line. This is in addition to the default <em>Standard Rate</em>.', 'fflcommerce'), 'tip' => __('List product and shipping tax classes here, e.g. Zero Tax, Reduced Rate.', 'fflcommerce'), 'id' => 'fflcommerce_tax_classes', 'type' => 'textarea'), array('name' => __('Tax rates', 'fflcommerce'), 'desc' => '', 'tip' => __('To avoid rounding errors, insert tax rates with 4 decimal places.', 'fflcommerce'), 'id' => 'fflcommerce_tax_rates', 'type' => 'tax_rates'), array('name' => __('Default options for new products', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Tax status', 'fflcommerce'), 'tip' => __('Whether new products should be taxable by default.', 'fflcommerce'), 'id' => 'fflcommerce_tax_defaults_status', 'type' => 'select', 'std' => 'taxable', 'choices' => array('taxable' => __('Taxable', 'fflcommerce'), 'shipping' => __('Shipping', 'fflcommerce'), 'none' => __('None', 'fflcommerce'))), array('name' => __('Tax classes', 'fflcommerce'), 'tip' => __('List of tax classes added by default to new products.', 'fflcommerce'), 'id' => 'fflcommerce_tax_defaults_classes', 'type' => 'user_defined', 'display' => array($this, 'display_default_tax_classes'), 'update' => array($this, 'update_default_tax_classes')), array('type' => 'tab', 'name' => __('Shipping', 'fflcommerce')), array('name' => __('Shipping Options', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Enable Shipping', 'fflcommerce'), 'desc' => __('Only turn this off if you are <strong>not</strong> shipping items, or items have shipping costs included.', 'fflcommerce'), 'tip' => __('If turned off, this will also remove shipping address fields on the Checkout.', 'fflcommerce'), 'id' => 'fflcommerce_calc_shipping', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Enable shipping calculator on cart', 'fflcommerce'), 'desc' => '', 'tip' => '', 'id' => 'fflcommerce_enable_shipping_calc', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Only ship to billing address?', 'fflcommerce'), 'desc' => '', 'tip' => __('When activated, Shipping address fields will not appear on the Checkout.', 'fflcommerce'), 'id' => 'fflcommerce_ship_to_billing_address_only', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Checkout always shows Shipping fields?', 'fflcommerce'), 'desc' => __('This will have no effect if "Only ship to billing address" is activated.', 'fflcommerce'), 'tip' => __('When activated, Shipping address fields will appear by default on the Checkout.', 'fflcommerce'), 'id' => 'fflcommerce_show_checkout_shipping_fields', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'fflcommerce'), 'yes' => __('Yes', 'fflcommerce'))), array('name' => __('Available Shipping Methods', 'fflcommerce'), 'type' => 'title', 'desc' => __('Please enable all of the Shipping Methods you wish to make available to your customers.', 'fflcommerce')), array('type' => 'tab', 'name' => __('Payment Gateways', 'fflcommerce')), array('name' => __('Gateway Options', 'fflcommerce'), 'type' => 'title', 'desc' => ''), array('name' => __('Default Gateway', 'fflcommerce'), 'desc' => __('Only enabled gateways will appear in this list.', 'fflcommerce'), 'tip' => __('This will determine which gateway appears first in the Payment Methods list on the Checkout.', 'fflcommerce'), 'id' => 'fflcommerce_default_gateway', 'type' => 'default_gateway', 'choices' => apply_filters('fflcommerce_available_payment_gateways', array())), array('name' => __('Available gateways', 'fflcommerce'), 'type' => 'title', 'desc' => __('Please enable all of the Payment Gateways you wish to make available to your customers.', 'fflcommerce')));
 }