2011-08-10 17:11:11 +00:00
< ? php
/**
* Functions for the settings page in admin .
*
* The settings page contains options for the WooCommerce plugin - this file contains functions to display
* and save the list of options .
*
* @ author WooThemes
* @ category Admin
* @ package WooCommerce
*/
/**
2011-09-15 16:37:38 +00:00
* Define settings for the WooCommerce settings pages
2011-08-10 17:11:11 +00:00
*/
2011-09-09 14:23:32 +00:00
global $woocommerce_settings ;
2011-08-10 17:11:11 +00:00
2011-09-15 16:37:38 +00:00
$woocommerce_settings [ 'general' ] = apply_filters ( 'woocommerce_general_settings' , array (
2011-08-10 17:11:11 +00:00
2011-09-19 08:42:28 +00:00
array ( 'name' => __ ( 'General Options' , 'woothemes' ), 'type' => 'title' , 'desc' => '' , 'id' => 'general_options' ),
2011-08-10 17:11:11 +00:00
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Base Country/Region' , 'woothemes' ),
'desc' => __ ( 'This is the base country for your business. Tax rates will be based on this country.' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_default_country' ,
2011-08-13 13:57:48 +00:00
'css' => 'min-width:175px;' ,
2011-08-10 17:11:11 +00:00
'std' => 'GB' ,
'type' => 'single_select_country'
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Allowed Countries' , 'woothemes' ),
'desc' => __ ( 'These are countries that you are willing to ship to.' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_allowed_countries' ,
2011-08-13 13:57:48 +00:00
'css' => 'min-width:175px;' ,
2011-08-10 17:11:11 +00:00
'std' => 'all' ,
'type' => 'select' ,
'options' => array (
2011-09-19 08:42:28 +00:00
'all' => __ ( 'All Countries' , 'woothemes' ),
'specific' => __ ( 'Specific Countries' , 'woothemes' )
2011-08-10 17:11:11 +00:00
)
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Specific Countries' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'desc' => '' ,
'id' => 'woocommerce_specific_allowed_countries' ,
'css' => '' ,
'std' => '' ,
'type' => 'multi_select_countries'
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Guest checkout' , 'woothemes' ),
'desc' => __ ( 'Allow guest users to checkout without an account' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_enable_guest_checkout' ,
'std' => 'yes' ,
2011-08-13 13:57:48 +00:00
'type' => 'checkbox'
2011-08-10 17:11:11 +00:00
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Force SSL' , 'woothemes' ),
'desc' => __ ( 'Force SSL on the checkout for added security (SSL Certificate required).' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_force_ssl_checkout' ,
'std' => 'no' ,
2011-08-13 13:57:48 +00:00
'type' => 'checkbox'
2011-08-10 17:11:11 +00:00
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'WooCommerce CSS' , 'woothemes' ),
'desc' => __ ( 'Enable WooCommerce frontend CSS styles' , 'woothemes' ),
2011-08-13 13:57:48 +00:00
'id' => 'woocommerce_frontend_css' ,
'std' => 'yes' ,
'type' => 'checkbox'
),
2011-09-05 09:04:17 +00:00
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Lightbox' , 'woothemes' ),
'desc' => __ ( 'Enable WooCommerce lightbox?' , 'woothemes' ),
2011-09-05 09:04:17 +00:00
'id' => 'woocommerce_enable_lightbox' ,
'std' => 'yes' ,
'type' => 'checkbox'
),
2011-08-13 13:57:48 +00:00
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Demo store' , 'woothemes' ),
'desc' => __ ( 'Enable the "Demo Store" notice on your site' , 'woothemes' ),
2011-08-13 13:57:48 +00:00
'id' => 'woocommerce_demo_store' ,
2011-08-10 17:11:11 +00:00
'std' => 'no' ,
2011-08-13 13:57:48 +00:00
'type' => 'checkbox'
2011-08-10 17:11:11 +00:00
),
2011-10-01 22:48:26 +00:00
2011-09-19 10:02:36 +00:00
array (
'name' => __ ( 'ShareThis Publisher ID' , 'woothemes' ),
'desc' => sprintf ( __ ( 'Enter your %1$sShareThis publisher ID%2$s to show ShareThis on product pages.' , 'woothemes' ), '<a href="http://sharethis.com/account/">' , '</a>' ),
'id' => 'woocommerce_sharethis' ,
'type' => 'text' ,
2011-10-04 02:31:27 +00:00
'std' => '' ,
'css' => ''
2011-09-19 10:02:36 +00:00
),
array (
'name' => __ ( 'Google Analytics ID' , 'woothemes' ),
'desc' => __ ( 'Log into your google analytics account to find your ID. e.g. <code>UA-XXXXX-X</code>' , 'woothemes' ),
'id' => 'woocommerce_ga_id' ,
'type' => 'text' ,
2011-10-04 02:31:27 +00:00
'css' => ''
2011-09-19 10:02:36 +00:00
),
array (
'name' => __ ( 'Google Analytics tracking' , 'woothemes' ),
'desc' => __ ( 'Adds standard tracking code to the footer. You don\'t need to enable this if using a 3rd party google analytics plugin.' , 'woothemes' ),
'id' => 'woocommerce_ga_standard_tracking_enabled' ,
'type' => 'checkbox' ,
),
array (
'name' => __ ( 'Google Analytics eCommerce tracking' , 'woothemes' ),
'desc' => __ ( 'Adds eCommerce tracking code to the thankyou page.' , 'woothemes' ),
'id' => 'woocommerce_ga_ecommerce_tracking_enabled' ,
'type' => 'checkbox' ,
),
2011-09-15 12:59:06 +00:00
array ( 'type' => 'sectionend' , 'id' => 'general_options' ),
2011-09-15 16:37:38 +00:00
)); // End general settings
2011-10-10 21:32:07 +00:00
$shop_page_id = get_option ( 'woocommerce_shop_page_id' );
$base_slug = ( $shop_page_id > 0 && get_page ( $shop_page_id )) ? get_page_uri ( $shop_page_id ) : 'shop' ;
2011-09-15 16:37:38 +00:00
$woocommerce_settings [ 'pages' ] = apply_filters ( 'woocommerce_page_settings' , array (
2011-09-19 08:42:28 +00:00
array ( 'name' => __ ( 'Page Setup' , 'woothemes' ), 'type' => 'title' , 'desc' => '' , 'id' => 'page_options' ),
2011-08-13 13:57:48 +00:00
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Shop Base Page' , 'woothemes' ),
2011-10-16 20:22:01 +00:00
'desc' => sprintf ( __ ( 'This sets the base page of your shop.' , 'woothemes' ), '<a target="_blank" href="options-permalink.php">' , '</a>' ),
2011-08-13 13:57:48 +00:00
'id' => 'woocommerce_shop_page_id' ,
'css' => 'min-width:175px;' ,
'type' => 'single_select_page' ,
'std' => ''
),
2011-10-12 11:17:06 +00:00
array (
'name' => __ ( 'Base Page Title' , 'woothemes' ),
2011-10-16 20:22:01 +00:00
'desc' => __ ( 'This title to show on the shop base page. Leave blank to use the page title.' , 'woothemes' ),
2011-10-12 11:17:06 +00:00
'id' => 'woocommerce_shop_page_title' ,
'type' => 'text' ,
2011-10-24 09:58:10 +00:00
'std' => 'All Products' // Default value for the page title - changed in settings
2011-10-12 11:17:06 +00:00
),
2011-08-10 17:11:11 +00:00
2011-08-13 13:57:48 +00:00
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Terms page ID' , 'woothemes' ),
'desc' => __ ( 'If you define a "Terms" page the customer will be asked if they accept them when checking out.' , 'woothemes' ),
2011-08-13 13:57:48 +00:00
'tip' => '' ,
'id' => 'woocommerce_terms_page_id' ,
'css' => 'min-width:50px;' ,
'std' => '' ,
'type' => 'single_select_page' ,
'args' => 'show_option_none=' . __ ( 'None' , 'woothemes' ),
),
2011-10-29 16:10:33 +00:00
array (
'name' => __ ( 'Logout link' , 'woothemes' ),
'desc' => sprintf ( __ ( 'Append a logout link to menus containing "My Account"' , 'woothemes' ), $base_slug ),
'id' => 'woocommerce_menu_logout_link' ,
'std' => 'yes' ,
'type' => 'checkbox' ,
),
2011-10-10 21:32:07 +00:00
array ( 'type' => 'sectionend' , 'id' => 'page_options' ),
array ( 'name' => __ ( 'Permalinks' , 'woothemes' ), 'type' => 'title' , 'desc' => '' , 'id' => 'permalink_options' ),
array (
'name' => __ ( 'Taxonomy base page' , 'woothemes' ),
'desc' => sprintf ( __ ( 'Prepend shop categories/tags with shop base page (<code>%s</code>)' , 'woothemes' ), $base_slug ),
'id' => 'woocommerce_prepend_shop_page_to_urls' ,
'std' => 'no' ,
'type' => 'checkbox' ,
),
array (
'name' => __ ( 'Product base page' , 'woothemes' ),
'desc' => sprintf ( __ ( 'Prepend product permalinks with shop base page (<code>%s</code>)' , 'woothemes' ), $base_slug ),
'id' => 'woocommerce_prepend_shop_page_to_products' ,
'std' => 'yes' ,
'type' => 'checkbox' ,
'checkboxgroup' => 'start'
),
array (
'name' => __ ( 'Product base category' , 'woothemes' ),
'desc' => __ ( 'Prepend product permalinks with product category' , 'woothemes' ),
'id' => 'woocommerce_prepend_category_to_products' ,
2011-10-12 11:17:06 +00:00
'std' => 'no' ,
2011-10-10 21:32:07 +00:00
'type' => 'checkbox' ,
'checkboxgroup' => 'end'
),
array ( 'type' => 'sectionend' , 'id' => 'permalink_options' ),
2011-08-13 13:57:48 +00:00
2011-09-19 08:42:28 +00:00
array ( 'name' => __ ( 'Shop Pages' , 'woothemes' ), 'type' => 'title' , 'desc' => __ ( 'The following pages need selecting so that WooCommerce knows which are which. These pages should have been created upon installation of the plugin.' , 'woothemes' ) ),
2011-08-10 17:11:11 +00:00
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Cart Page' , 'woothemes' ),
'desc' => __ ( 'Page contents: [woocommerce_cart]' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_cart_page_id' ,
'css' => 'min-width:50px;' ,
'type' => 'single_select_page' ,
'std' => ''
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Checkout Page' , 'woothemes' ),
'desc' => __ ( 'Page contents: [woocommerce_checkout]' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_checkout_page_id' ,
'css' => 'min-width:50px;' ,
'type' => 'single_select_page' ,
'std' => ''
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Pay Page' , 'woothemes' ),
'desc' => __ ( 'Page contents: [woocommerce_pay] Parent: "Checkout"' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_pay_page_id' ,
'css' => 'min-width:50px;' ,
'type' => 'single_select_page' ,
'std' => ''
),
array (
'name' => __ ( 'Thanks Page' , 'woothemes' ),
2011-09-19 08:42:28 +00:00
'desc' => __ ( 'Page contents: [woocommerce_thankyou] Parent: "Checkout"' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_thanks_page_id' ,
'css' => 'min-width:50px;' ,
'type' => 'single_select_page' ,
'std' => ''
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'My Account Page' , 'woothemes' ),
'desc' => __ ( 'Page contents: [woocommerce_my_account]' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_myaccount_page_id' ,
'css' => 'min-width:50px;' ,
'type' => 'single_select_page' ,
'std' => ''
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Edit Address Page' , 'woothemes' ),
'desc' => __ ( 'Page contents: [woocommerce_edit_address] Parent: "My Account"' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_edit_address_page_id' ,
'css' => 'min-width:50px;' ,
'type' => 'single_select_page' ,
'std' => ''
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'View Order Page' , 'woothemes' ),
'desc' => __ ( 'Page contents: [woocommerce_view_order] Parent: "My Account"' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_view_order_page_id' ,
'css' => 'min-width:50px;' ,
'type' => 'single_select_page' ,
'std' => ''
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Change Password Page' , 'woothemes' ),
'desc' => __ ( 'Page contents: [woocommerce_change_password] Parent: "My Account"' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_change_password_page_id' ,
'css' => 'min-width:50px;' ,
'type' => 'single_select_page' ,
'std' => ''
),
2011-09-15 12:59:06 +00:00
array ( 'type' => 'sectionend' , 'id' => 'page_options' ),
2011-09-15 16:37:38 +00:00
)); // End pages settings
$woocommerce_settings [ 'catalog' ] = apply_filters ( 'woocommerce_catalog_settings' , array (
2011-09-19 08:42:28 +00:00
array ( 'name' => __ ( 'Catalog Options' , 'woothemes' ), 'type' => 'title' , 'desc' => '' , 'id' => 'catalog_options' ),
2011-08-10 17:11:11 +00:00
2011-10-07 19:27:10 +00:00
array (
2011-10-22 19:20:39 +00:00
'name' => __ ( 'Subcategories' , 'woothemes' ),
'desc' => __ ( 'Show subcategories on category pages' , 'woothemes' ),
2011-10-07 19:27:10 +00:00
'id' => 'woocommerce_show_subcategories' ,
'std' => 'no' ,
'type' => 'checkbox' ,
'checkboxgroup' => 'start'
),
array (
2011-10-22 19:20:39 +00:00
'desc' => __ ( 'Show subcategories on the shop page' , 'woothemes' ),
2011-10-07 19:27:10 +00:00
'id' => 'woocommerce_shop_show_subcategories' ,
'std' => 'no' ,
'type' => 'checkbox' ,
2011-10-22 19:20:39 +00:00
'checkboxgroup' => ''
),
array (
'desc' => __ ( 'When showing subcategories, hide products' , 'woothemes' ),
'id' => 'woocommerce_hide_products_when_showing_subcategories' ,
'std' => 'no' ,
'type' => 'checkbox' ,
2011-10-07 19:27:10 +00:00
'checkboxgroup' => 'end'
),
2011-08-13 13:57:48 +00:00
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Product fields' , 'woothemes' ),
'desc' => __ ( 'Enable the SKU field for products' , 'woothemes' ),
2011-08-13 13:57:48 +00:00
'id' => 'woocommerce_enable_sku' ,
'std' => 'yes' ,
'type' => 'checkbox' ,
'checkboxgroup' => 'start'
),
2011-08-10 17:11:11 +00:00
array (
2011-09-19 08:42:28 +00:00
'desc' => __ ( 'Enable the weight field for products' , 'woothemes' ),
2011-08-13 13:57:48 +00:00
'id' => 'woocommerce_enable_weight' ,
'std' => 'yes' ,
'type' => 'checkbox' ,
2011-10-08 11:57:04 +00:00
'checkboxgroup' => ''
),
array (
'desc' => __ ( 'Enable the dimension fields for products' , 'woothemes' ),
'id' => 'woocommerce_enable_dimensions' ,
'std' => 'yes' ,
'type' => 'checkbox' ,
2011-08-13 13:57:48 +00:00
'checkboxgroup' => 'end'
2011-08-10 17:11:11 +00:00
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Weight Unit' , 'woothemes' ),
'desc' => __ ( 'This controls what unit you will define weights in.' , 'woothemes' ),
2011-08-13 13:57:48 +00:00
'id' => 'woocommerce_weight_unit' ,
'css' => 'min-width:175px;' ,
'std' => 'GBP' ,
2011-08-10 17:11:11 +00:00
'type' => 'select' ,
2011-08-13 13:57:48 +00:00
'options' => array (
2011-09-19 08:42:28 +00:00
'kg' => __ ( 'kg' , 'woothemes' ),
'lbs' => __ ( 'lbs' , 'woothemes' )
2011-08-10 17:11:11 +00:00
)
),
2011-10-08 11:57:04 +00:00
array (
'name' => __ ( 'Dimensions Unit' , 'woothemes' ),
'desc' => __ ( 'This controls what unit you will define lengths in.' , 'woothemes' ),
'id' => 'woocommerce_dimension_unit' ,
'css' => 'min-width:175px;' ,
'std' => 'GBP' ,
'type' => 'select' ,
'options' => array (
'cm' => __ ( 'cm' , 'woothemes' ),
'in' => __ ( 'in' , 'woothemes' )
)
),
2011-08-10 17:11:11 +00:00
2011-08-18 23:14:35 +00:00
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Cart redirect' , 'woothemes' ),
'desc' => __ ( 'Redirect to cart after adding a product to the cart (on single product pages)' , 'woothemes' ),
2011-08-18 23:14:35 +00:00
'id' => 'woocommerce_cart_redirect_after_add' ,
'std' => 'no' ,
'type' => 'checkbox'
),
2011-09-19 08:42:28 +00:00
array ( 'type' => 'sectionend' , 'id' => 'catalog_options' ),
2011-08-13 13:57:48 +00:00
2011-09-19 08:42:28 +00:00
array ( 'name' => __ ( 'Pricing Options' , 'woothemes' ), 'type' => 'title' , 'desc' => '' , 'id' => 'pricing_options' ),
2011-08-13 13:57:48 +00:00
2011-08-10 17:11:11 +00:00
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Currency' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'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>. " , 'woothemes' ), 'https://www.paypal.com/cgi-bin/webscr?cmd=p/sell/mc/mc_intro-outside' ),
'tip' => '' ,
'id' => 'woocommerce_currency' ,
2011-08-13 13:57:48 +00:00
'css' => 'min-width:175px;' ,
2011-08-10 17:11:11 +00:00
'std' => 'GBP' ,
'type' => 'select' ,
'options' => apply_filters ( 'woocommerce_currencies' , array (
2011-09-19 08:42:28 +00:00
'USD' => __ ( 'US Dollars ($)' , 'woothemes' ),
'EUR' => __ ( 'Euros (€)' , 'woothemes' ),
'GBP' => __ ( 'Pounds Sterling (£)' , 'woothemes' ),
'AUD' => __ ( 'Australian Dollars ($)' , 'woothemes' ),
'BRL' => __ ( 'Brazilian Real ($)' , 'woothemes' ),
'CAD' => __ ( 'Canadian Dollars ($)' , 'woothemes' ),
'CZK' => __ ( 'Czech Koruna' , 'woothemes' ),
'DKK' => __ ( 'Danish Krone' , 'woothemes' ),
'HKD' => __ ( 'Hong Kong Dollar ($)' , 'woothemes' ),
'HUF' => __ ( 'Hungarian Forint' , 'woothemes' ),
'ILS' => __ ( 'Israeli Shekel' , 'woothemes' ),
'JPY' => __ ( 'Japanese Yen (¥)' , 'woothemes' ),
'MYR' => __ ( 'Malaysian Ringgits' , 'woothemes' ),
'MXN' => __ ( 'Mexican Peso ($)' , 'woothemes' ),
'NZD' => __ ( 'New Zealand Dollar ($)' , 'woothemes' ),
'NOK' => __ ( 'Norwegian Krone' , 'woothemes' ),
'PHP' => __ ( 'Philippine Pesos' , 'woothemes' ),
'PLN' => __ ( 'Polish Zloty' , 'woothemes' ),
'SGD' => __ ( 'Singapore Dollar ($)' , 'woothemes' ),
'SEK' => __ ( 'Swedish Krona' , 'woothemes' ),
'CHF' => __ ( 'Swiss Franc' , 'woothemes' ),
'TWD' => __ ( 'Taiwan New Dollars' , 'woothemes' ),
2011-09-30 09:40:28 +00:00
'THB' => __ ( 'Thai Baht' , 'woothemes' ),
'TRY' => __ ( 'Turkish Lira (TL)' , 'woothemes' )
2011-08-10 17:11:11 +00:00
)
)
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Currency Position' , 'woothemes' ),
'desc' => __ ( 'This controls the position of the currency symbol.' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'tip' => '' ,
'id' => 'woocommerce_currency_pos' ,
2011-08-13 13:57:48 +00:00
'css' => 'min-width:175px;' ,
2011-08-10 17:11:11 +00:00
'std' => 'left' ,
'type' => 'select' ,
'options' => array (
2011-09-19 08:42:28 +00:00
'left' => __ ( 'Left' , 'woothemes' ),
'right' => __ ( 'Right' , 'woothemes' ),
'left_space' => __ ( 'Left (with space)' , 'woothemes' ),
'right_space' => __ ( 'Right (with space)' , 'woothemes' )
2011-08-10 17:11:11 +00:00
)
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Thousand separator' , 'woothemes' ),
'desc' => __ ( 'This sets the thousand separator of displayed prices.' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'tip' => '' ,
'id' => 'woocommerce_price_thousand_sep' ,
'css' => 'width:30px;' ,
'std' => ',' ,
'type' => 'text' ,
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Decimal separator' , 'woothemes' ),
'desc' => __ ( 'This sets the decimal separator of displayed prices.' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'tip' => '' ,
'id' => 'woocommerce_price_decimal_sep' ,
'css' => 'width:30px;' ,
'std' => '.' ,
'type' => 'text' ,
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Number of decimals' , 'woothemes' ),
'desc' => __ ( 'This sets the number of decimal points shown in displayed prices.' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'tip' => '' ,
'id' => 'woocommerce_price_num_decimals' ,
'css' => 'width:30px;' ,
'std' => '2' ,
'type' => 'text' ,
),
2011-09-09 15:09:22 +00:00
array ( 'type' => 'sectionend' , 'id' => 'pricing_options' ),
2011-10-03 10:29:36 +00:00
array ( 'name' => __ ( 'Image Options' , 'woothemes' ), 'type' => 'title' , 'desc' => __ ( 'These settings affect the actual dimensions of images in your catalog - the display on the front-end will still be affected by CSS styles.' , 'woothemes' ), 'id' => 'image_options' ),
array (
'name' => __ ( 'Catalog Images' , 'woothemes' ),
'desc' => __ ( 'This size is usually used in product listings' , 'woothemes' ),
'id' => 'woocommerce_catalog_image' ,
'css' => '' ,
'type' => 'image_width' ,
'std' => '150'
),
array (
'name' => __ ( 'Single Product Image' , 'woothemes' ),
'desc' => __ ( 'This is the size used by the main image on the product page.' , 'woothemes' ),
'id' => 'woocommerce_single_image' ,
'css' => '' ,
'type' => 'image_width' ,
'std' => '300'
),
array (
'name' => __ ( 'Product Thumbnails' , 'woothemes' ),
'desc' => __ ( 'This size is usually used for the gallery of images on the product page.' , 'woothemes' ),
'id' => 'woocommerce_thumbnail_image' ,
'css' => '' ,
'type' => 'image_width' ,
'std' => '90'
),
array ( 'type' => 'sectionend' , 'id' => 'image_options' ),
2011-08-10 17:11:11 +00:00
2011-09-15 16:37:38 +00:00
)); // End catalog settings
$woocommerce_settings [ 'inventory' ] = apply_filters ( 'woocommerce_inventory_settings' , array (
2011-09-19 08:42:28 +00:00
array ( 'name' => __ ( 'Inventory Options' , 'woothemes' ), 'type' => 'title' , 'desc' => '' , 'id' => 'inventory_options' ),
2011-08-10 17:11:11 +00:00
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Manage stock' , 'woothemes' ),
'desc' => __ ( 'Enable stock management' , 'woothemes' ),
2011-08-13 13:57:48 +00:00
'id' => 'woocommerce_manage_stock' ,
'std' => 'yes' ,
'type' => 'checkbox'
2011-08-10 17:11:11 +00:00
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Notifications' , 'woothemes' ),
'desc' => __ ( 'Enable low stock notifications' , 'woothemes' ),
2011-08-13 13:57:48 +00:00
'id' => 'woocommerce_notify_low_stock' ,
2011-08-10 17:11:11 +00:00
'std' => 'yes' ,
2011-08-13 13:57:48 +00:00
'type' => 'checkbox' ,
'checkboxgroup' => 'start'
2011-08-10 17:11:11 +00:00
),
array (
2011-09-19 08:42:28 +00:00
'desc' => __ ( 'Enable out of stock notifications' , 'woothemes' ),
2011-08-13 13:57:48 +00:00
'id' => 'woocommerce_notify_no_stock' ,
2011-08-10 17:11:11 +00:00
'std' => 'yes' ,
2011-08-13 13:57:48 +00:00
'type' => 'checkbox' ,
'checkboxgroup' => 'end'
2011-08-10 17:11:11 +00:00
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Low stock threshold' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'desc' => '' ,
'tip' => '' ,
'id' => 'woocommerce_notify_low_stock_amount' ,
'css' => 'min-width:50px;' ,
'type' => 'text' ,
'std' => '2'
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Out of stock threshold' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'desc' => '' ,
'tip' => '' ,
'id' => 'woocommerce_notify_no_stock_amount' ,
'css' => 'min-width:50px;' ,
'type' => 'text' ,
'std' => '0'
),
2011-08-17 23:42:07 +00:00
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Out of stock visibility' , 'woothemes' ),
2011-08-17 23:42:07 +00:00
'desc' => __ ( 'Hide out of stock items from the catalog' , 'woothemes' ),
'id' => 'woocommerce_hide_out_of_stock_items' ,
'std' => 'no' ,
'type' => 'checkbox'
),
2011-09-09 15:09:22 +00:00
array ( 'type' => 'sectionend' , 'id' => 'inventory_options' ),
2011-09-15 16:37:38 +00:00
)); // End inventory settings
$woocommerce_settings [ 'shipping' ] = apply_filters ( 'woocommerce_shipping_settings' , array (
2011-09-19 08:42:28 +00:00
array ( 'name' => __ ( 'Shipping Options' , 'woothemes' ), 'type' => 'title' , 'desc' => '' , 'id' => 'shipping_options' ),
2011-08-10 17:11:11 +00:00
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Calculate shipping' , 'woothemes' ),
'desc' => __ ( 'Enable shipping/shipping calculations' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_calc_shipping' ,
'std' => 'yes' ,
2011-08-13 13:57:48 +00:00
'type' => 'checkbox'
2011-08-10 17:11:11 +00:00
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Shipping calculator' , 'woothemes' ),
'desc' => __ ( 'Enable the shipping calculator on the cart page' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_enable_shipping_calc' ,
'std' => 'yes' ,
2011-08-13 13:57:48 +00:00
'type' => 'checkbox'
2011-08-10 17:11:11 +00:00
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Ship to billing' , 'woothemes' ),
'desc' => __ ( 'Only ship to the users billing address' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_ship_to_billing_address_only' ,
'std' => 'no' ,
2011-08-13 13:57:48 +00:00
'type' => 'checkbox'
2011-08-10 17:11:11 +00:00
),
2011-09-19 08:42:28 +00:00
array ( 'type' => 'sectionend' , 'id' => 'shipping_options' ),
2011-09-15 16:37:38 +00:00
)); // End shipping settings
$woocommerce_settings [ 'tax' ] = apply_filters ( 'woocommerce_tax_settings' , array (
2011-08-19 20:11:04 +00:00
2011-09-19 08:42:28 +00:00
array ( 'name' => __ ( 'Tax Options' , 'woothemes' ), 'type' => 'title' , 'desc' => '' , 'id' => 'tax_options' ),
2011-08-10 17:11:11 +00:00
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Calculate Taxes' , 'woothemes' ),
'desc' => __ ( 'Enable taxes and tax calculations' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_calc_taxes' ,
'std' => 'yes' ,
2011-08-13 13:57:48 +00:00
'type' => 'checkbox'
2011-08-10 17:11:11 +00:00
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Prices inclusive of tax' , 'woothemes' ),
'desc' => __ ( 'Catalog Prices include tax' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_prices_include_tax' ,
'std' => 'yes' ,
2011-08-13 13:57:48 +00:00
'type' => 'checkbox'
2011-08-10 17:11:11 +00:00
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Cart totals display...' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'desc' => '' ,
2011-09-19 08:42:28 +00:00
'tip' => __ ( 'Should the subtotal be shown including or excluding tax on the frontend?' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_display_totals_tax' ,
'css' => 'min-width:100px;' ,
'std' => 'excluding' ,
'type' => 'select' ,
'options' => array (
2011-09-19 08:42:28 +00:00
'including' => __ ( 'price including tax' , 'woothemes' ),
'excluding' => __ ( 'price excluding tax' , 'woothemes' )
2011-08-10 17:11:11 +00:00
)
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Additional Tax classes' , 'woothemes' ),
'desc' => __ ( 'List 1 per line. This is in addition to the default <em>Standard Rate</em>.' , 'woothemes' ),
'tip' => __ ( 'List product and shipping tax classes here, e.g. Zero Tax, Reduced Rate.' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_tax_classes' ,
'css' => 'width:100%; height: 75px;' ,
'type' => 'textarea' ,
'std' => " Reduced Rate \n Zero Rate "
),
array (
2011-09-19 08:42:28 +00:00
'name' => __ ( 'Tax rates' , 'woothemes' ),
'desc' => __ ( 'All fields are required.' , 'woothemes' ),
'tip' => __ ( 'To avoid rounding errors, insert tax rates with 4 decimal places.' , 'woothemes' ),
2011-08-10 17:11:11 +00:00
'id' => 'woocommerce_tax_rates' ,
'css' => 'min-width:50px;' ,
'type' => 'tax_rates' ,
'std' => ''
),
2011-09-19 08:42:28 +00:00
array ( 'type' => 'sectionend' , 'id' => 'tax_options' ),
2011-08-13 13:57:48 +00:00
2011-09-15 16:37:38 +00:00
)); // End tax settings
2011-08-13 13:57:48 +00:00
2011-10-25 12:54:16 +00:00
$woocommerce_settings [ 'email' ] = apply_filters ( 'woocommerce_email_settings' , array (
array ( 'name' => __ ( 'Email Options' , 'woothemes' ), 'type' => 'title' , '' , 'id' => 'email_options' ),
array (
'name' => __ ( '"From" name' , 'woothemes' ),
'desc' => __ ( 'The sender name for WooCommerce emails.' , 'woothemes' ),
'id' => 'woocommerce_email_from_name' ,
'type' => 'text' ,
'std' => esc_attr ( get_bloginfo ( 'name' ))
),
array (
'name' => __ ( '"From" email address' , 'woothemes' ),
'desc' => __ ( 'The sender email address for WooCommerce emails.' , 'woothemes' ),
'id' => 'woocommerce_email_from_address' ,
'type' => 'text' ,
'std' => get_option ( 'admin_email' )
),
array ( 'type' => 'sectionend' , 'id' => 'email_options' ),
2011-10-30 00:00:32 +00:00
array ( 'name' => __ ( 'Email template' , 'woothemes' ), 'type' => 'title' , 'desc' => sprintf ( __ ( 'This section lets you customise the WooCommerce emails. <a href="%s" target="_blank">Click here to preview your email template</a>. For more advanced control copy <code>woocommerce/templates/emails/</code> to <code>yourtheme/woocommmerce/emails/</code>.' , 'woothemes' ), wp_nonce_url ( admin_url ( '?preview_woocommerce_mail=true' ), 'preview-mail' )), 'id' => 'email_template_options' ),
2011-10-25 12:54:16 +00:00
2011-10-26 17:13:29 +00:00
array (
'name' => __ ( 'Header image' , 'woothemes' ),
'desc' => sprintf ( __ ( 'Enter a URL to an image you want to show in the email\'s header. Upload your image using the <a href="%s">media uploader</a>.' , 'woothemes' ), admin_url ( 'media-new.php' )),
'id' => 'woocommerce_email_header_image' ,
'type' => 'text' ,
'std' => ''
),
2011-10-25 12:54:16 +00:00
array (
'name' => __ ( 'Email footer text' , 'woothemes' ),
'desc' => __ ( 'The text to appear in the footer of WooCommerce emails.' , 'woothemes' ),
'id' => 'woocommerce_email_footer_text' ,
2011-10-26 13:11:20 +00:00
'css' => 'width:100%; height: 75px;' ,
'type' => 'textarea' ,
2011-10-25 12:54:16 +00:00
'std' => get_bloginfo ( 'name' ) . ' - ' . __ ( 'Powered by WooCommerce' , 'woothemes' )
),
array (
'name' => __ ( 'Base colour' , 'woothemes' ),
'desc' => __ ( 'The base colour for WooCommerce email templates. Default <code>#557da1</code>.' , 'woothemes' ),
'id' => 'woocommerce_email_base_color' ,
'type' => 'color' ,
'std' => '#557da1'
),
array (
'name' => __ ( 'Background colour' , 'woothemes' ),
'desc' => __ ( 'The background colour for WooCommerce email templates. Default <code>#eeeeee</code>.' , 'woothemes' ),
'id' => 'woocommerce_email_background_color' ,
'type' => 'color' ,
'std' => '#eeeeee'
),
array (
'name' => __ ( 'Email body background colour' , 'woothemes' ),
'desc' => __ ( 'The main body background colour. Default <code>#fdfdfd</code>.' , 'woothemes' ),
'id' => 'woocommerce_email_body_background_color' ,
'type' => 'color' ,
'std' => '#fdfdfd'
),
array (
'name' => __ ( 'Email body text colour' , 'woothemes' ),
'desc' => __ ( 'The main body text colour. Default <code>#505050</code>.' , 'woothemes' ),
'id' => 'woocommerce_email_text_color' ,
'type' => 'color' ,
'std' => '#505050'
),
array ( 'type' => 'sectionend' , 'id' => 'email_template_options' ),
)); // End email settings
2011-08-13 13:57:48 +00:00
/**
* Settings page
*
2011-09-09 14:23:32 +00:00
* Handles the display of the main woocommerce settings page in admin .
2011-08-13 13:57:48 +00:00
*/
2011-09-19 09:49:52 +00:00
if ( ! function_exists ( 'woocommerce_settings' )) {
2011-08-13 13:57:48 +00:00
function woocommerce_settings () {
2011-09-15 16:37:38 +00:00
global $woocommerce , $woocommerce_settings ;
2011-09-09 14:23:32 +00:00
2011-09-15 16:37:38 +00:00
$current_tab = ( isset ( $_GET [ 'tab' ])) ? $_GET [ 'tab' ] : 'general' ;
2011-09-19 08:42:28 +00:00
if ( isset ( $_POST ) && $_POST ) :
if ( ! wp_verify_nonce ( $_REQUEST [ '_wpnonce' ], 'woocommerce-settings' ) ) die ( __ ( 'Action failed. Please refresh the page and retry.' , 'woothemes' ) );
2011-09-15 16:37:38 +00:00
2011-09-19 08:42:28 +00:00
switch ( $current_tab ) :
2011-09-15 16:37:38 +00:00
case " general " :
case " pages " :
case " catalog " :
case " inventory " :
case " shipping " :
case " tax " :
2011-10-25 12:54:16 +00:00
case " email " :
2011-09-19 08:42:28 +00:00
woocommerce_update_options ( $woocommerce_settings [ $current_tab ] );
2011-09-15 16:37:38 +00:00
break ;
endswitch ;
do_action ( 'woocommerce_update_options' );
do_action ( 'woocommerce_update_options_' . $current_tab );
flush_rewrite_rules ( false );
2011-09-19 08:42:28 +00:00
wp_redirect ( add_query_arg ( 'saved' , 'true' , admin_url ( 'admin.php?page=woocommerce&tab=' . $current_tab ) ) );
2011-09-09 14:23:32 +00:00
endif ;
2011-09-05 08:28:17 +00:00
if ( isset ( $_GET [ 'saved' ]) && $_GET [ 'saved' ]) :
2011-09-19 08:42:28 +00:00
echo '<div id="message" class="updated fade"><p><strong>' . __ ( 'Your settings have been saved.' , 'woothemes' ) . '</strong></p></div>' ;
2011-09-05 08:28:17 +00:00
flush_rewrite_rules ( false );
endif ;
2011-09-20 13:04:40 +00:00
if ( isset ( $_GET [ 'installed' ]) && $_GET [ 'installed' ]) :
2011-09-29 12:55:52 +00:00
echo '<div id="message" class="updated fade"><p style="float:right;">' . __ ( 'Like WooCommerce? <a href="http://wordpress.org/extend/plugins/woocommerce/">Support us by leaving a rating!</a>' , 'woothemes' ) . '</p><p><strong>' . __ ( 'WooCommerce has been installed. Enjoy :)' , 'woothemes' ) . '</strong></p></div>' ;
2011-09-20 13:04:40 +00:00
flush_rewrite_rules ( false );
endif ;
2011-08-13 13:57:48 +00:00
?>
< div class = " wrap woocommerce " >
< form method = " post " id = " mainform " action = " " >
2011-09-09 14:23:32 +00:00
< div class = " icon32 icon32-woocommerce-settings " id = " icon-woocommerce " >< br ></ div >< h2 class = " nav-tab-wrapper woo-nav-tab-wrapper " >
< ? php
2011-09-15 16:37:38 +00:00
$tabs = array (
2011-09-19 08:42:28 +00:00
'general' => __ ( 'General' , 'woothemes' ),
'pages' => __ ( 'Pages' , 'woothemes' ),
'catalog' => __ ( 'Catalog' , 'woothemes' ),
'inventory' => __ ( 'Inventory' , 'woothemes' ),
'shipping' => __ ( 'Shipping' , 'woothemes' ),
'tax' => __ ( 'Tax' , 'woothemes' ),
'shipping_methods' => __ ( 'Shipping Methods' , 'woothemes' ),
2011-10-25 12:54:16 +00:00
'payment_gateways' => __ ( 'Payment Gateways' , 'woothemes' ),
'email' => __ ( 'Emails' , 'woothemes' ),
2011-09-15 16:37:38 +00:00
);
foreach ( $tabs as $name => $label ) :
2011-09-19 08:42:28 +00:00
echo '<a href="' . admin_url ( 'admin.php?page=woocommerce&tab=' . $name ) . '" class="nav-tab ' ;
if ( $current_tab == $name ) echo 'nav-tab-active' ;
echo '">' . $label . '</a>' ;
2011-09-15 16:37:38 +00:00
endforeach ;
2011-10-05 15:25:12 +00:00
do_action ( 'woocommerce_settings_tabs' );
2011-09-09 14:23:32 +00:00
?>
</ h2 >
2011-09-19 08:42:28 +00:00
< ? php wp_nonce_field ( 'woocommerce-settings' , '_wpnonce' , true , true ); ?>
2011-09-15 16:37:38 +00:00
< ? php
switch ( $current_tab ) :
case " general " :
case " pages " :
case " catalog " :
case " inventory " :
case " shipping " :
case " tax " :
2011-10-25 12:54:16 +00:00
case " email " :
2011-09-19 08:42:28 +00:00
woocommerce_admin_fields ( $woocommerce_settings [ $current_tab ] );
2011-09-15 16:37:38 +00:00
break ;
case " shipping_methods " :
$links = array ();
2011-09-19 08:42:28 +00:00
foreach ( $woocommerce -> shipping -> shipping_methods as $method ) :
2011-09-15 16:37:38 +00:00
$title = ( $method -> method_title ) ? ucwords ( $method -> method_title ) : ucwords ( $method -> id );
$links [] = '<a href="#shipping-' . $method -> id . '">' . $title . '</a>' ;
endforeach ;
echo '<div class="subsubsub_section"><ul class="subsubsub"><li>' . implode ( ' | </li><li>' , $links ) . '</li></ul><br class="clear" />' ;
foreach ( $woocommerce -> shipping -> shipping_methods as $method ) :
echo '<div class="section" id="shipping-' . $method -> id . '">' ;
$method -> admin_options ();
echo '</div>' ;
endforeach ;
echo '</div>' ;
break ;
case " payment_gateways " :
$links = array ();
foreach ( $woocommerce -> payment_gateways -> payment_gateways () as $gateway ) :
2011-09-16 11:15:49 +00:00
$title = ( isset ( $gateway -> method_title ) && $gateway -> method_title ) ? ucwords ( $gateway -> method_title ) : ucwords ( $gateway -> id );
2011-09-15 16:37:38 +00:00
$links [] = '<a href="#gateway-' . $gateway -> id . '">' . $title . '</a>' ;
endforeach ;
echo '<div class="subsubsub_section"><ul class="subsubsub"><li>' . implode ( ' | </li><li>' , $links ) . '</li></ul><br class="clear" />' ;
2011-09-19 08:42:28 +00:00
foreach ( $woocommerce -> payment_gateways -> payment_gateways () as $gateway ) :
2011-09-15 16:37:38 +00:00
echo '<div class="section" id="gateway-' . $gateway -> id . '">' ;
$gateway -> admin_options ();
echo '</div>' ;
endforeach ;
echo '</div>' ;
break ;
default :
do_action ( 'woocommerce_settings_tabs_' . $current_tab );
break ;
endswitch ;
?>
2011-09-19 08:42:28 +00:00
< p class = " submit " >< input name = " save " class = " button-primary " type = " submit " value = " <?php _e( 'Save changes', 'woothemes' ); ?> " /></ p >
2011-08-13 13:57:48 +00:00
</ form >
2011-09-15 16:37:38 +00:00
< script type = " text/javascript " >
// Subsubsub tabs
jQuery ( 'ul.subsubsub li a:eq(0)' ) . addClass ( 'current' );
jQuery ( '.subsubsub_section .section:gt(0)' ) . hide ();
jQuery ( 'ul.subsubsub li a' ) . click ( function (){
jQuery ( 'a' , jQuery ( this ) . closest ( 'ul.subsubsub' )) . removeClass ( 'current' );
jQuery ( this ) . addClass ( 'current' );
jQuery ( '.section' , jQuery ( this ) . closest ( '.subsubsub_section' )) . hide ();
jQuery ( jQuery ( this ) . attr ( 'href' ) ) . show ();
return false ;
});
// Countries
jQuery ( 'select#woocommerce_allowed_countries' ) . change ( function (){
if ( jQuery ( this ) . val () == " specific " ) {
jQuery ( this ) . parent () . parent () . next ( 'tr.multi_select_countries' ) . show ();
} else {
jQuery ( this ) . parent () . parent () . next ( 'tr.multi_select_countries' ) . hide ();
}
}) . change ();
// Country Multiselect boxes
jQuery ( " .country_multiselect " ) . multiselect ({
2011-09-19 08:42:28 +00:00
noneSelectedText : '<?php _e( ' Select countries / states ', ' woothemes ' ); ?>' ,
2011-09-15 16:37:38 +00:00
selectedList : 4
});
2011-10-25 12:54:16 +00:00
// Color picker
jQuery ( '.colorpick' ) . each ( function (){
jQuery ( '.colorpickdiv' , jQuery ( this ) . parent ()) . farbtastic ( this );
jQuery ( this ) . click ( function () {
if ( jQuery ( this ) . val () == " " ) jQuery ( this ) . val ( '#' );
jQuery ( '.colorpickdiv' , jQuery ( this ) . parent () ) . show ();
});
});
jQuery ( document ) . mousedown ( function (){
jQuery ( '.colorpickdiv' ) . hide ();
});
2011-09-15 16:37:38 +00:00
// Edit prompt
jQuery ( function (){
var changed = false ;
jQuery ( 'input, textarea, select, checkbox' ) . change ( function (){
changed = true ;
});
jQuery ( '.woo-nav-tab-wrapper a' ) . click ( function (){
if ( changed ) {
window . onbeforeunload = function () {
2011-09-19 08:42:28 +00:00
return '<?php echo __( ' The changes you made will be lost if you navigate away from this page . ', ' woothemes ' ); ?>' ;
2011-09-15 16:37:38 +00:00
}
} else {
window . onbeforeunload = '' ;
}
});
jQuery ( '.submit input' ) . click ( function (){
window . onbeforeunload = '' ;
});
});
</ script >
2011-08-13 13:57:48 +00:00
</ div >
< ? php
2011-09-19 09:49:52 +00:00
}
2011-08-15 16:48:24 +00:00
}