Merge pull request #3 from woothemes/master

update fork
This commit is contained in:
andreibarabas 2013-03-20 00:05:41 -07:00
commit 5970224047
467 changed files with 396577 additions and 229803 deletions

5
.gitignore vendored
View File

@ -3,4 +3,7 @@ logs/
project.xml
project.properties
.DS_Store
Thumbs.db
Thumbs.db
.buildpath
.project
.settings*

View File

@ -4,7 +4,7 @@ Community made patches, localisations, bug reports and contributions are always
When contributing please ensure you follow the guidelines below so that we can keep on top of things.
__note__ GitHub is for bug reports and contributions only - if you have a support question or a request for a customisation don't post here. Use [WooThemes Support](http://support.woothemes.com) and [WooJobs](http://jobs.woothemes.com) respectively.
__note:__ GitHub is for bug reports and contributions only - if you have a support question or a request for a customization don't post here. Use [WooThemes Support](http://support.woothemes.com) and [WooJobs](http://jobs.woothemes.com) respectively.
## Getting Started
@ -13,20 +13,20 @@ __note__ GitHub is for bug reports and contributions only - if you have a suppor
* Clearly describe the issue including steps to reproduce when it is a bug.
* Make sure you fill in the earliest version that you know has the issue.
## Making Changes
## Making Changes
* Fork the repository on GitHub
* Make the changes to your forked repository
* Ensure you stick to the [WordPress Coding Standards](http://codex.wordpress.org/WordPress_Coding_Standards)
* Ensure you use LF line endings - no crazy windows line endings :)
* When committing, reference your issue (#1234) and include a note about the fix
* Push the changes to your fork and submit a pull request on the master WooCommerce repository
* Fork the repository on GitHub.
* Make the changes to your forked repository.
* **Ensure you stick to the [WordPress Coding Standards](http://codex.wordpress.org/WordPress_Coding_Standards).**
* Ensure you use LF line endings - no crazy windows line endings. :)
* When committing, reference your issue (#1234) and include a note about the fix.
* Push the changes to your fork and submit a pull request on the master WooCommerce repository.
At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary.
At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary.
# Additional Resources
* [General GitHub documentation](http://help.github.com/)
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
* [WooCommerce Docs](http://wcdocs.woothemes.com/)
* [WooThemes Support](http://support.woothemes.com)
* [WooCommerce Docs](http://docs.woothemes.com/)
* [WooThemes Support](http://support.woothemes.com)

View File

@ -59,7 +59,7 @@ if ( class_exists( 'WP_Importer' ) ) {
else
$file = ABSPATH . $this->file_url;
add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) );
add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) );
if ( function_exists( 'gc_enable' ) )
gc_enable();
@ -149,28 +149,32 @@ if ( class_exists( 'WP_Importer' ) ) {
$postcodes = explode( ';', $postcode );
$postcodes = array_map( 'strtoupper', array_map( 'woocommerce_clean', $postcodes ) );
foreach( $postcodes as $postcode ) {
$wpdb->insert(
$wpdb->prefix . "woocommerce_tax_rate_locations",
array(
'location_code' => $postcode,
'tax_rate_id' => $tax_rate_id,
'location_type' => 'postcode',
)
);
if ( ! empty( $postcode ) && $postcode != '*' ) {
$wpdb->insert(
$wpdb->prefix . "woocommerce_tax_rate_locations",
array(
'location_code' => $postcode,
'tax_rate_id' => $tax_rate_id,
'location_type' => 'postcode',
)
);
}
}
$city = woocommerce_clean( $city );
$cities = explode( ';', $city );
$cities = array_map( 'strtoupper', array_map( 'woocommerce_clean', $cities ) );
foreach( $cities as $city ) {
$wpdb->insert(
$wpdb->prefix . "woocommerce_tax_rate_locations",
array(
'location_code' => $city,
'tax_rate_id' => $tax_rate_id,
'location_type' => 'city',
)
);
if ( ! empty( $city ) && $city != '*' ) {
$wpdb->insert(
$wpdb->prefix . "woocommerce_tax_rate_locations",
array(
'location_code' => $city,
'tax_rate_id' => $tax_rate_id,
'location_type' => 'city',
)
);
}
}
$loop ++;

View File

@ -1,13 +0,0 @@
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<div id="message" class="updated woocommerce-message wc-connect">
<div class="squeezer">
<h4><?php _e( '<strong>WooCommerce has been installed</strong> &#8211; You\'re ready to start selling :)', 'woocommerce' ); ?></h4>
<p class="submit"><a href="<?php echo admin_url('admin.php?page=woocommerce_settings'); ?>" class="button-primary"><?php _e( 'Settings', 'woocommerce' ); ?></a> <a class="docs button-primary" href="http://www.woothemes.com/woocommerce-docs/"><?php _e( 'Docs', 'woocommerce' ); ?></a></p>
<p><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/woocommerce/" data-text="A open-source (free) #ecommerce plugin for #WordPress that helps you sell anything. Beautifully." data-via="WooThemes" data-size="large" data-hashtags="WooCommerce">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></p>
</div>
</div>

View File

@ -0,0 +1,9 @@
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<div id="message" class="updated woocommerce-message wc-connect">
<div class="squeezer">
<h4><?php _e( '<strong>Your theme does not declare WooCommerce support</strong> &#8211; if you encounter layout issues please read our integration guide or choose a WooCommerce theme :)', 'woocommerce' ); ?></h4>
<p class="submit"><a href="http://docs.woothemes.com/document/third-party-custom-theme-compatibility/" class="button-primary"><?php _e( 'Theme Integration Guide', 'woocommerce' ); ?></a> <a class="skip button-primary" href="<?php echo add_query_arg( 'hide_woocommerce_theme_support_check', 'true' ); ?>"><?php _e( 'Hide this notice', 'woocommerce' ); ?></a></p>
</div>
</div>

View File

@ -1,13 +0,0 @@
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<div id="message" class="updated woocommerce-message wc-connect">
<div class="squeezer">
<h4><?php _e( '<strong>WooCommerce has been updated</strong> &#8211; You\'re ready to continue selling :)', 'woocommerce' ); ?></h4>
<p class="submit"><a href="<?php echo admin_url('admin.php?page=woocommerce_settings'); ?>" class="button-primary"><?php _e( 'Settings', 'woocommerce' ); ?></a> <a class="docs button-primary" href="http://www.woothemes.com/woocommerce-docs/"><?php _e( 'Docs', 'woocommerce' ); ?></a></p>
<p><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/woocommerce/" data-text="A open-source (free) #ecommerce plugin for #WordPress that helps you sell anything. Beautifully." data-via="WooThemes" data-size="large" data-hashtags="WooCommerce">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></p>
</div>
</div>

View File

@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $wpdb, $woocommerce;
// Upgrade old style files paths to support multiple file paths
$existing_file_paths = $wpdb->get_results( "SELECT * FROM {$wpdb->postmeta} WHERE meta_key = '_file_path'" );
$existing_file_paths = $wpdb->get_results( "SELECT * FROM {$wpdb->postmeta} WHERE meta_key = '_file_path' AND meta_value != '';" );
if ( $existing_file_paths ) {
@ -22,8 +22,7 @@ if ( $existing_file_paths ) {
$old_file_path = trim( $existing_file_path->meta_value );
if ( ! empty( $old_file_path ) ) {
$file_paths = maybe_serialize( array( md5( $old_file_path ) => $old_file_path ) );
$file_paths = serialize( array( md5( $old_file_path ) => $old_file_path ) );
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_key = '_file_paths', meta_value = %s WHERE meta_id = %d", $file_paths, $existing_file_path->meta_id ) );
@ -176,6 +175,9 @@ update_option( 'woocommerce_local_tax_rates_backup', $local_tax_rates );
delete_option( 'woocommerce_tax_rates' );
delete_option( 'woocommerce_local_tax_rates' );
// Create lost password page
woocommerce_create_page( esc_sql( _x( 'lost-password', 'page_slug', 'woocommerce' ) ), 'woocommerce_lost_password_page_id', __( 'Lost Password', 'woocommerce' ), '[woocommerce_lost_password]', woocommerce_get_page_id( 'myaccount' ) );
// Now its time for the massive update to line items - move them to the new DB tables
// Reverse with UPDATE `wpwc_postmeta` SET meta_key = '_order_items' WHERE meta_key = '_order_items_old'
@ -293,4 +295,24 @@ foreach ( $order_tax_rows as $order_tax_row ) {
unset( $tax_amount );
}
}
}
}
// Grab the pre 2.0 Image options and use to populate the new image options settings,
// cleaning up afterwards like nice people do
foreach ( array( 'catalog', 'single', 'thumbnail' ) as $value ) {
$old_settings = array_filter( array(
'width' => get_option( 'woocommerce_' . $value . '_image_width' ),
'height' => get_option( 'woocommerce_' . $value . '_image_height' ),
'crop' => get_option( 'woocommerce_' . $value . '_image_crop' )
) );
if ( ! empty( $old_settings ) && update_option( 'shop_' . $value . '_image_size', $old_settings ) ){
delete_option( 'woocommerce_' . $value . '_image_width' );
delete_option( 'woocommerce_' . $value . '_image_height' );
delete_option( 'woocommerce_' . $value . '_image_crop' );
}
}

432
admin/includes/welcome.php Normal file
View File

@ -0,0 +1,432 @@
<?php
/**
* Welcome Page Class
*
* Shows a feature overview for the new version (major) and credits.
*
* Adapted from code in EDD (Copyright (c) 2012, Pippin Williamson) and WP.
*
* @author WooThemes
* @category Admin
* @package WooCommerce/Admin
* @version 2.0.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* WC_Welcome_Page class.
*
* @since 2.0
*/
class WC_Welcome_Page {
private $plugin;
/**
* __construct function.
*
* @access public
* @return void
*/
public function __construct() {
$this->plugin = 'woocommerce/woocommerce.php';
add_action( 'admin_menu', array( $this, 'admin_menus') );
add_action( 'admin_head', array( $this, 'admin_head' ) );
add_action( 'admin_init', array( $this, 'welcome' ) );
}
/**
* Add admin menus/screens
*
* @access public
* @return void
*/
public function admin_menus() {
$welcome_page_title = __( 'Welcome to WooCommerce', 'woocommerce' );
// About
$about = add_dashboard_page( $welcome_page_title, $welcome_page_title, 'manage_options', 'wc-about', array( $this, 'about_screen' ) );
// Credits
$credits = add_dashboard_page( $welcome_page_title, $welcome_page_title, 'manage_options', 'wc-credits', array( $this, 'credits_screen' ) );
add_action( 'admin_print_styles-'. $about, array( $this, 'admin_css' ) );
add_action( 'admin_print_styles-'. $credits, array( $this, 'admin_css' ) );
}
/**
* admin_css function.
*
* @access public
* @return void
*/
public function admin_css() {
wp_enqueue_style( 'woocommerce-activation', plugins_url( '/assets/css/activation.css', dirname( dirname( __FILE__ ) ) ) );
}
/**
* Add styles just for this page, and remove dashboard page links.
*
* @access public
* @return void
*/
public function admin_head() {
global $woocommerce;
remove_submenu_page( 'index.php', 'wc-about' );
remove_submenu_page( 'index.php', 'wc-credits' );
// Badge for welcome page
$badge_url = $woocommerce->plugin_url() . '/assets/images/welcome/wc-badge.png';
?>
<style type="text/css">
/*<![CDATA[*/
.wc-badge {
padding-top: 150px;
height: 52px;
width: 185px;
color: #9c5d90;
font-weight: bold;
font-size: 14px;
text-align: center;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
margin: 0 -5px;
background: url('<?php echo $woocommerce->plugin_url() . '/assets/images/welcome/wc-welcome.png'; ?>') no-repeat center center;
}
@media
(-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
.wc-badge {
background-image:url('<?php echo $woocommerce->plugin_url() . '/assets/images/welcome/wc-welcome@2x.png'; ?>');
background-size: 173px 194px;
}
}
.about-wrap .wc-badge {
position: absolute;
top: 0;
right: 0;
}
/*]]>*/
</style>
<?php
}
/**
* Into text/links shown on all about pages.
*
* @access private
* @return void
*/
private function intro() {
global $woocommerce;
// Flush after upgrades
if ( ! empty( $_GET['wc-updated'] ) || ! empty( $_GET['wc-installed'] ) )
flush_rewrite_rules();
// Drop minor version if 0
$major_version = substr( $woocommerce->version, 0, 3 );
?>
<h1><?php printf( __( 'Welcome to WooCommerce %s', 'woocommerce' ), $major_version ); ?></h1>
<div class="about-text woocommerce-about-text">
<?php
if ( ! empty( $_GET['wc-installed'] ) )
$message = __( 'Thanks, all done!', 'woocommerce' );
elseif ( ! empty( $_GET['wc-updated'] ) )
$message = __( 'Thank you for updating to the latest version!', 'woocommerce' );
else
$message = __( 'Thanks for installing!', 'woocommerce' );
printf( __( '%s WooCommerce %s is more powerful, stable, and secure than ever before. We hope you enjoy it.', 'woocommerce' ), $message, $major_version );
?>
</div>
<div class="wc-badge"><?php printf( __( 'Version %s' ), $woocommerce->version ); ?></div>
<p class="woocommerce-actions">
<a href="<?php echo admin_url('admin.php?page=woocommerce_settings'); ?>" class="button button-primary"><?php _e( 'Settings', 'woocommerce' ); ?></a>
<a class="docs button button-primary" href="http://docs.woothemes.com/"><?php _e( 'Docs', 'woocommerce' ); ?></a>
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/woocommerce/" data-text="A open-source (free) #ecommerce plugin for #WordPress that helps you sell anything. Beautifully." data-via="WooThemes" data-size="large" data-hashtags="WooCommerce">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</p>
<h2 class="nav-tab-wrapper">
<a class="nav-tab <?php if ( $_GET['page'] == 'wc-about' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'wc-about' ), 'index.php' ) ) ); ?>">
<?php _e( "What's New", 'woocommerce' ); ?>
</a><a class="nav-tab <?php if ( $_GET['page'] == 'wc-credits' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'wc-credits' ), 'index.php' ) ) ); ?>">
<?php _e( 'Credits', 'woocommerce' ); ?>
</a>
</h2>
<?php
}
/**
* Output the about screen.
*
* @access public
* @return void
*/
public function about_screen() {
global $woocommerce;
?>
<div class="wrap about-wrap">
<?php $this->intro(); ?>
<!--<div class="changelog point-releases"></div>-->
<div class="changelog">
<h3><?php _e( 'Security in mind', 'woocommerce' ); ?></h3>
<div class="feature-section images-stagger-right">
<img src="<?php echo $woocommerce->plugin_url() . '/assets/images/welcome/badge-sucuri.png'; ?>" alt="Sucuri Safe Plugin" style="padding: 1em" />
<h4><?php _e( 'Sucuri Safe Plugin', 'woocommerce' ); ?></h4>
<p><?php _e( 'You will be happy to learn that WooCommerce has been audited and certified by the Sucuri Security team. Whilst there is not much to be seen visually to understand the amount of work that went into this audit, rest assured that your website is powered by one of the most powerful and stable eCommerce plugins available.', 'woocommerce' ); ?></p>
</div>
<h3><?php _e( 'A Smoother Admin Experience', 'woocommerce' ); ?></h3>
<div class="feature-section col three-col">
<div>
<img src="<?php echo $woocommerce->plugin_url() . '/assets/images/welcome/product.png'; ?>" alt="Product panel screenshot" style="width: 99%; margin: 0 0 1em;" />
<h4><?php _e( 'New Product Panel', 'woocommerce' ); ?></h4>
<p><?php _e( 'We have revised the product data panel making it cleaner, more streamlined, and more logical. Adding products is a breeze!', 'woocommerce' ); ?></p>
</div>
<div>
<img src="<?php echo $woocommerce->plugin_url() . '/assets/images/welcome/orders.png'; ?>" alt="Order panel screenshot" style="width: 99%; margin: 0 0 1em;" />
<h4><?php _e( 'Nicer Order Screens', 'woocommerce' ); ?></h4>
<p><?php _e( 'Order pages have had a cleanup, with a more easily scannable interface. We particularly like the new status icons!', 'woocommerce' ); ?></p>
</div>
<div class="last-feature">
<img src="<?php echo $woocommerce->plugin_url() . '/assets/images/welcome/downloads.png'; ?>" alt="Download panel screenshot" style="width: 99%; margin: 0 0 1em;" />
<h4><?php _e( 'Multi-Download Support', 'woocommerce' ); ?></h4>
<p><?php _e( 'Products can have multiple downloadable files - purchasers will get access to all the files added.', 'woocommerce' ); ?></p>
</div>
</div>
<h3><?php _e( 'Less Taxing Taxes', 'woocommerce' ); ?></h3>
<div class="feature-section col two-col">
<img src="<?php echo $woocommerce->plugin_url() . '/assets/images/welcome/taxes.png'; ?>" alt="Tax Options" style="width:99%; margin: 0 0 1em 0;" />
<div>
<h4><?php _e( 'New Tax Input Panel', 'woocommerce' ); ?></h4>
<p><?php _e( 'The tax input pages have been streamlined to make inputting taxes simpler - adding multiple taxes for a single jurisdiction is now much easier using the priority system. There is also CSV import/export support.', 'woocommerce' ); ?></p>
</div>
<div class="last-feature">
<h4><?php _e( 'Improved Tax Options', 'woocommerce' ); ?></h4>
<p><?php _e( 'As requested by some users, we now support taxing the billing address instead of shipping (optional), and we allow you to choose which tax class applies to shipping.', 'woocommerce' ); ?></p>
</div>
</div>
<h3><?php _e( 'Product Listing Improvements Customers Will Love', 'woocommerce' ); ?></h3>
<div class="feature-section col three-col">
<div>
<img src="<?php echo $woocommerce->plugin_url() . '/assets/images/welcome/sorting.png'; ?>" alt="Sorting" style="width: 99%; margin: 0 0 1em;" />
<h4><?php _e( 'New Sorting Options', 'woocommerce' ); ?></h4>
<p><?php _e( 'Customers can now sort products by popularity and ratings.', 'woocommerce' ); ?></p>
</div>
<div>
<img src="<?php echo $woocommerce->plugin_url() . '/assets/images/welcome/pagination.png'; ?>" alt="Pagination" style="width: 99%; margin: 0 0 1em;" />
<h4><?php _e( 'Better Pagination and Result Counts', 'woocommerce' ); ?></h4>
<p><?php _e( 'Numbered pagination has been added to core, and we show the number of results found above the listings.', 'woocommerce' ); ?></p>
</div>
<div class="last-feature">
<img src="<?php echo $woocommerce->plugin_url() . '/assets/images/welcome/rating.png'; ?>" alt="Ratings" style="width: 99%; margin: 0 0 1em;" />
<h4><?php _e( 'Inline Star Rating Display', 'woocommerce' ); ?></h4>
<p><?php _e( 'We have added star ratings to the catalog which are pulled from reviews.', 'woocommerce' ); ?></p>
</div>
</div>
</div>
<div class="changelog">
<h3><?php _e( 'Under the Hood', 'woocommerce' ); ?></h3>
<div class="feature-section col three-col">
<div>
<h4><?php _e( 'New product classes', 'woocommerce' ); ?></h4>
<p><?php _e( 'The product classes have been rewritten and are now factory based. Much more extendable, and easier to query products using the new <code>get_product()</code> function.', 'woocommerce' ); ?></p>
</div>
<div>
<h4><?php _e( 'Capability overhaul', 'woocommerce' ); ?></h4>
<p><?php _e( 'More granular capabilities for admin/shop manager roles covering products, orders and coupons.', 'woocommerce' ); ?></p>
</div>
<div class="last-feature">
<h4><?php _e( 'API Improvements', 'woocommerce' ); ?></h4>
<p><?php _e( '<code>WC-API</code> now has real endpoints, and we\'ve optimised the gateways API significantly by only loading gateways when needed.', 'woocommerce' ); ?></p>
</div>
</div>
<div class="feature-section col three-col">
<div>
<h4><?php _e( 'Cache-friendly cart widgets', 'woocommerce' ); ?></h4>
<p><?php _e( 'Cart widgets and other "fragments" are now pulled in via AJAX - this works wonders with static page caching.', 'woocommerce' ); ?></p>
</div>
<div>
<h4><?php _e( 'Session handling', 'woocommerce' ); ?></h4>
<p><?php _e( 'PHP SESSIONS have been a problem for many users in the past, so we\'ve developed our own handler using cookies and options to make these more reliable.', 'woocommerce' ); ?></p>
</div>
<div class="last-feature">
<h4><?php _e( 'Retina Ready', 'woocommerce' ); ?></h4>
<p><?php _e( 'All graphics within WC have been optimised for HiDPI displays.', 'woocommerce' ); ?></p>
</div>
</div>
<div class="feature-section col three-col">
<div>
<h4><?php _e( 'Better stock handling', 'woocommerce' ); ?></h4>
<p><?php _e( 'We have added an option to hold stock for unpaid orders (defaults to 60mins). When this time limit is reached, and the order is not paid for, stock is released and the order is cancelled.', 'woocommerce' ); ?></p>
</div>
<div>
<h4><?php _e( 'Improved Line-item storage', 'woocommerce' ); ?></h4>
<p><?php _e( 'We have changed how order items get stored making them easier (and faster) to access for reporting. Order items are no longer serialised within an order - they are stored within their own table.', 'woocommerce' ); ?></p>
</div>
<div class="last-feature">
<h4><?php _e( 'Autoload', 'woocommerce' ); ?></h4>
<p><?php _e( 'We have setup autoloading for classes - this has dramatically reduced memory usage in 2.0.', 'woocommerce' ); ?></p>
</div>
</div>
</div>
<div class="return-to-dashboard">
<a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'woocommerce_settings' ), 'admin.php' ) ) ); ?>"><?php _e( 'Go to WooCommerce Settings', 'woocommerce' ); ?></a>
</div>
</div>
<?php
}
/**
* Output the credits.
*
* @access public
* @return void
*/
public function credits_screen() {
?>
<div class="wrap about-wrap">
<?php $this->intro(); ?>
<p class="about-description"><?php _e( 'WooCommerce is developed and maintained by a worldwide team of passionate individuals and backed by an awesome developer community. Want to see your name? <a href="https://github.com/woothemes/woocommerce/blob/master/CONTRIBUTING.md">Contribute to WooCommerce</a>.', 'woocommerce' ); ?></p>
<?php echo $this->contributors(); ?>
</div>
<?php
}
/**
* Render Contributors List
*
* @access public
* @return string $contributor_list HTML formatted list of contributors.
*/
public function contributors() {
$contributors = $this->get_contributors();
if ( empty( $contributors ) )
return '';
$contributor_list = '<ul class="wp-people-group">';
foreach ( $contributors as $contributor ) {
$contributor_list .= '<li class="wp-person">';
$contributor_list .= sprintf( '<a href="%s" title="%s">',
esc_url( 'https://github.com/' . $contributor->login ),
esc_html( sprintf( __( 'View %s', 'woocommerce' ), $contributor->login ) )
);
$contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) );
$contributor_list .= '</a>';
$contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) );
$contributor_list .= '</a>';
$contributor_list .= '</li>';
}
$contributor_list .= '</ul>';
return $contributor_list;
}
/**
* Retreive list of contributors from GitHub.
*
* @access public
* @return void
*/
public function get_contributors() {
$contributors = get_transient( 'woocommerce_contributors' );
if ( false !== $contributors )
return $contributors;
$response = wp_remote_get( 'https://api.github.com/repos/woothemes/woocommerce/contributors', array( 'sslverify' => false ) );
if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
return array();
$contributors = json_decode( wp_remote_retrieve_body( $response ) );
if ( ! is_array( $contributors ) )
return array();
set_transient( 'woocommerce_contributors', $contributors, 3600 );
return $contributors;
}
/**
* Sends user to the welcome page on first activation
*/
public function welcome() {
// Bail if no activation redirect transient is set
if ( ! get_transient( '_wc_activation_redirect' ) )
return;
// Delete the redirect transient
delete_transient( '_wc_activation_redirect' );
// Bail if we are waiting to install or update via the interface update/install links
if ( get_option( '_wc_needs_update' ) == 1 || get_option( '_wc_needs_pages' ) == 1 )
return;
// Bail if activating from network, or bulk, or within an iFrame
if ( is_network_admin() || isset( $_GET['activate-multi'] ) || defined( 'IFRAME_REQUEST' ) )
return;
if ( ( isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action'] ) && ( isset( $_GET['plugin'] ) && strstr( $_GET['plugin'], 'woocommerce.php' ) ) )
return;
wp_safe_redirect( admin_url( 'index.php?page=wc-about' ) );
exit;
}
}
new WC_Welcome_Page();

View File

@ -73,16 +73,17 @@ add_action( 'post_submitbox_start', 'woocommerce_duplicate_product_post_button'
* @param mixed $columns
* @return array
*/
function woocommerce_edit_product_columns( $columns ) {
function woocommerce_edit_product_columns( $existing_columns ) {
global $woocommerce;
if ( empty( $columns ) && ! is_array( $columns ) )
$columns = array();
if ( empty( $existing_columns ) && ! is_array( $existing_columns ) )
$existing_columns = array();
unset( $columns['title'], $columns['comments'], $columns['date'] );
unset( $existing_columns['title'], $existing_columns['comments'], $existing_columns['date'] );
$columns = array();
$columns["cb"] = "<input type=\"checkbox\" />";
$columns["thumb"] = __( 'Image', 'woocommerce' );
$columns["thumb"] = '<img src="' . $woocommerce->plugin_url() . '/assets/images/image.png" alt="' . __( 'Image', 'woocommerce' ) . '" class="tips" data-tip="' . __( 'Image', 'woocommerce' ) . '" width="14" height="14" />';
$columns["name"] = __( 'Name', 'woocommerce' );
@ -100,10 +101,10 @@ function woocommerce_edit_product_columns( $columns ) {
$columns["product_type"] = '<img src="' . $woocommerce->plugin_url() . '/assets/images/product_type_head.png" alt="' . __( 'Type', 'woocommerce' ) . '" class="tips" data-tip="' . __( 'Type', 'woocommerce' ) . '" width="14" height="12" />';
$columns["date"] = __( 'Date', 'woocommerce' );
return $columns;
return array_merge( $columns, $existing_columns );
}
add_filter('manage_edit-product_columns', 'woocommerce_edit_product_columns');
add_filter( 'manage_edit-product_columns', 'woocommerce_edit_product_columns' );
/**
@ -114,12 +115,14 @@ add_filter('manage_edit-product_columns', 'woocommerce_edit_product_columns');
* @return void
*/
function woocommerce_custom_product_columns( $column ) {
global $post, $woocommerce;
$product = get_product($post);
global $post, $woocommerce, $the_product;
if ( empty( $the_product ) || $the_product->id != $post->ID )
$the_product = get_product( $post );
switch ($column) {
case "thumb" :
echo $product->get_image();
echo '<a href="' . get_edit_post_link( $post->ID ) . '">' . $the_product->get_image() . '</a>';
break;
case "name" :
$edit_link = get_edit_post_link( $post->ID );
@ -145,24 +148,26 @@ function woocommerce_custom_product_columns( $column ) {
$actions['id'] = 'ID: ' . $post->ID;
if ( $can_edit_post && 'trash' != $post->post_status ) {
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline', 'woocommerce' ) ) . '">' . __( 'Quick&nbsp;Edit', 'woocommerce' ) . '</a>';
$actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick&nbsp;Edit' ) . '</a>';
}
if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) {
if ( 'trash' == $post->post_status )
$actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash', 'woocommerce' ) ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __( 'Restore', 'woocommerce' ) . "</a>";
$actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
elseif ( EMPTY_TRASH_DAYS )
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash', 'woocommerce' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash', 'woocommerce' ) . "</a>";
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently', 'woocommerce' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently', 'woocommerce' ) . "</a>";
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
}
if ( $post_type_object->public ) {
if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) {
if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
if ( $can_edit_post )
$actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;', 'woocommerce' ), $title ) ) . '" rel="permalink">' . __( 'Preview', 'woocommerce' ) . '</a>';
$actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
} elseif ( 'trash' != $post->post_status ) {
$actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;', 'woocommerce' ), $title ) ) . '" rel="permalink">' . __( 'View', 'woocommerce' ) . '</a>';
$actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
}
}
$actions = apply_filters( 'post_row_actions', $actions, $post );
echo '<div class="row-actions">';
@ -183,51 +188,51 @@ function woocommerce_custom_product_columns( $column ) {
echo '
<div class="hidden" id="woocommerce_inline_' . $post->ID . '">
<div class="menu_order">' . $post->menu_order . '</div>
<div class="sku">' . $product->sku . '</div>
<div class="regular_price">' . $product->regular_price . '</div>
<div class="sale_price">' . $product->sale_price . '</div>
<div class="weight">' . $product->weight . '</div>
<div class="length">' . $product->length . '</div>
<div class="width">' . $product->width . '</div>
<div class="height">' . $product->height . '</div>
<div class="visibility">' . $product->visibility . '</div>
<div class="stock_status">' . $product->stock_status . '</div>
<div class="stock">' . $product->stock . '</div>
<div class="manage_stock">' . $product->manage_stock . '</div>
<div class="featured">' . $product->featured . '</div>
<div class="product_type">' . $product->product_type . '</div>
<div class="product_is_virtual">' . $product->virtual . '</div>
<div class="sku">' . $the_product->sku . '</div>
<div class="regular_price">' . $the_product->regular_price . '</div>
<div class="sale_price">' . $the_product->sale_price . '</div>
<div class="weight">' . $the_product->weight . '</div>
<div class="length">' . $the_product->length . '</div>
<div class="width">' . $the_product->width . '</div>
<div class="height">' . $the_product->height . '</div>
<div class="visibility">' . $the_product->visibility . '</div>
<div class="stock_status">' . $the_product->stock_status . '</div>
<div class="stock">' . $the_product->stock . '</div>
<div class="manage_stock">' . $the_product->manage_stock . '</div>
<div class="featured">' . $the_product->featured . '</div>
<div class="product_type">' . $the_product->product_type . '</div>
<div class="product_is_virtual">' . $the_product->virtual . '</div>
</div>
';
break;
case "sku" :
if ($product->get_sku()) echo $product->get_sku(); else echo '<span class="na">&ndash;</span>';
if ($the_product->get_sku()) echo $the_product->get_sku(); else echo '<span class="na">&ndash;</span>';
break;
case "product_type" :
if( $product->product_type == 'grouped' ):
echo '<span class="product-type tips '.$product->product_type.'" data-tip="' . __( 'Grouped', 'woocommerce' ) . '"></span>';
elseif ( $product->product_type == 'external' ):
echo '<span class="product-type tips '.$product->product_type.'" data-tip="' . __( 'External/Affiliate', 'woocommerce' ) . '"></span>';
elseif ( $product->product_type == 'simple' ):
if( $the_product->product_type == 'grouped' ):
echo '<span class="product-type tips '.$the_product->product_type.'" data-tip="' . __( 'Grouped', 'woocommerce' ) . '"></span>';
elseif ( $the_product->product_type == 'external' ):
echo '<span class="product-type tips '.$the_product->product_type.'" data-tip="' . __( 'External/Affiliate', 'woocommerce' ) . '"></span>';
elseif ( $the_product->product_type == 'simple' ):
if ($product->is_virtual()) {
if ($the_product->is_virtual()) {
echo '<span class="product-type tips virtual" data-tip="' . __( 'Virtual', 'woocommerce' ) . '"></span>';
} elseif ($product->is_downloadable()) {
} elseif ($the_product->is_downloadable()) {
echo '<span class="product-type tips downloadable" data-tip="' . __( 'Downloadable', 'woocommerce' ) . '"></span>';
} else {
echo '<span class="product-type tips '.$product->product_type.'" data-tip="' . __( 'Simple', 'woocommerce' ) . '"></span>';
echo '<span class="product-type tips '.$the_product->product_type.'" data-tip="' . __( 'Simple', 'woocommerce' ) . '"></span>';
}
elseif ( $product->product_type == 'variable' ):
echo '<span class="product-type tips '.$product->product_type.'" data-tip="' . __( 'Variable', 'woocommerce' ) . '"></span>';
elseif ( $the_product->product_type == 'variable' ):
echo '<span class="product-type tips '.$the_product->product_type.'" data-tip="' . __( 'Variable', 'woocommerce' ) . '"></span>';
else:
// Assuming that we have other types in future
echo '<span class="product-type tips '.$product->product_type.'" data-tip="' . ucwords($product->product_type) . '"></span>';
echo '<span class="product-type tips '.$the_product->product_type.'" data-tip="' . ucwords($the_product->product_type) . '"></span>';
endif;
break;
case "price":
if ($product->get_price_html()) echo $product->get_price_html(); else echo '<span class="na">&ndash;</span>';
if ($the_product->get_price_html()) echo $the_product->get_price_html(); else echo '<span class="na">&ndash;</span>';
break;
case "product_cat" :
case "product_tag" :
@ -241,23 +246,26 @@ function woocommerce_custom_product_columns( $column ) {
echo implode( ', ', $termlist );
}
break;
case "featured" :
$url = wp_nonce_url( admin_url('admin-ajax.php?action=woocommerce-feature-product&product_id=' . $post->ID), 'woocommerce-feature-product' );
echo '<a href="'.$url.'" title="'.__( 'Change', 'woocommerce' ) .'">';
if ($product->is_featured()) echo '<a href="'.$url.'"><img src="'.$woocommerce->plugin_url().'/assets/images/featured.png" alt="yes" height="14" width="14" />';
else echo '<img src="'.$woocommerce->plugin_url().'/assets/images/featured-off.png" alt="no" height="14" width="14" />';
case 'featured':
$url = wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce-feature-product&product_id=' . $post->ID ), 'woocommerce-feature-product' );
echo '<a href="' . $url . '" title="'. __( 'Toggle featured', 'woocommerce' ) . '">';
if ( $the_product->is_featured() ) {
echo '<img src="' . $woocommerce->plugin_url() . '/assets/images/featured.png" alt="'. __( 'yes', 'woocommerce' ) . '" height="14" width="14" />';
} else {
echo '<img src="' . $woocommerce->plugin_url() . '/assets/images/featured-off.png" alt="'. __( 'no', 'woocommerce' ) . '" height="14" width="14" />';
}
echo '</a>';
break;
case "is_in_stock" :
if ($product->is_in_stock()) {
if ($the_product->is_in_stock()) {
echo '<mark class="instock">' . __( 'In stock', 'woocommerce' ) . '</mark>';
} else {
echo '<mark class="outofstock">' . __( 'Out of stock', 'woocommerce' ) . '</mark>';
}
if ( $product->managing_stock() ) :
echo ' &times; ' . $product->get_total_stock();
if ( $the_product->managing_stock() ) :
echo ' &times; ' . $the_product->get_total_stock();
endif;
break;
@ -283,7 +291,6 @@ add_action('manage_product_posts_custom_column', 'woocommerce_custom_product_col
*/
function woocommerce_custom_product_sort($columns) {
$custom = array(
'is_in_stock' => 'inventory',
'price' => 'price',
'featured' => 'featured',
'sku' => 'sku',
@ -306,12 +313,6 @@ add_filter( 'manage_edit-product_sortable_columns', 'woocommerce_custom_product_
*/
function woocommerce_custom_product_orderby( $vars ) {
if (isset( $vars['orderby'] )) :
if ( 'inventory' == $vars['orderby'] ) :
$vars = array_merge( $vars, array(
'meta_key' => '_stock',
'orderby' => 'meta_value_num'
) );
endif;
if ( 'price' == $vars['orderby'] ) :
$vars = array_merge( $vars, array(
'meta_key' => '_price',
@ -371,7 +372,7 @@ function woocommerce_products_by_type() {
$output = "<select name='product_type' id='dropdown_product_type'>";
$output .= '<option value="">'.__( 'Show all product types', 'woocommerce' ).'</option>';
foreach($terms as $term) :
$output .="<option value='$term->slug' ";
$output .="<option value='" . sanitize_title( $term->name ) . "' ";
if ( isset( $wp_query->query['product_type'] ) ) $output .=selected($term->slug, $wp_query->query['product_type'], false);
$output .=">";
@ -702,54 +703,54 @@ add_action( 'admin_enqueue_scripts', 'woocommerce_admin_product_quick_edit_scrip
*/
function woocommerce_admin_product_quick_edit_save( $post_id, $post ) {
if ( !$_POST ) return $post_id;
if ( is_int( wp_is_post_revision( $post_id ) ) ) return;
if( is_int( wp_is_post_autosave( $post_id ) ) ) return;
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return $post_id;
if ( !isset($_POST['woocommerce_quick_edit_nonce']) || (isset($_POST['woocommerce_quick_edit_nonce']) && !wp_verify_nonce( $_POST['woocommerce_quick_edit_nonce'], 'woocommerce_quick_edit_nonce' ))) return $post_id;
if ( !current_user_can( 'edit_post', $post_id )) return $post_id;
if ( ! $_POST || is_int( wp_is_post_revision( $post_id ) ) || is_int( wp_is_post_autosave( $post_id ) ) ) return $post_id;
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return $post_id;
if ( ! isset( $_POST['woocommerce_quick_edit_nonce'] ) || ! wp_verify_nonce( $_POST['woocommerce_quick_edit_nonce'], 'woocommerce_quick_edit_nonce' ) ) return $post_id;
if ( ! current_user_can( 'edit_post', $post_id ) ) return $post_id;
if ( $post->post_type != 'product' ) return $post_id;
global $woocommerce, $wpdb;
$product = get_product( $post );
$product = get_product( $post );
$old_regular_price = $product->regular_price;
$old_sale_price = $product->sale_price;
// Save fields
if(isset($_POST['_sku'])) update_post_meta($post_id, '_sku', esc_html(stripslashes($_POST['_sku'])));
if(isset($_POST['_weight'])) update_post_meta($post_id, '_weight', esc_html(stripslashes($_POST['_weight'])));
if(isset($_POST['_length'])) update_post_meta($post_id, '_length', esc_html(stripslashes($_POST['_length'])));
if(isset($_POST['_width'])) update_post_meta($post_id, '_width', esc_html(stripslashes($_POST['_width'])));
if(isset($_POST['_height'])) update_post_meta($post_id, '_height', esc_html(stripslashes($_POST['_height'])));
if(isset($_POST['_stock_status'])) update_post_meta( $post_id, '_stock_status', stripslashes( $_POST['_stock_status'] ) );
if(isset($_POST['_visibility'])) update_post_meta( $post_id, '_visibility', stripslashes( $_POST['_visibility'] ) );
if(isset($_POST['_featured'])) update_post_meta( $post_id, '_featured', 'yes' ); else update_post_meta( $post_id, '_featured', 'no' );
if ( isset( $_POST['_sku'] ) ) update_post_meta( $post_id, '_sku', woocommerce_clean( $_POST['_sku'] ) );
if ( isset( $_POST['_weight'] ) ) update_post_meta( $post_id, '_weight', woocommerce_clean( $_POST['_weight'] ) );
if ( isset( $_POST['_length'] ) ) update_post_meta( $post_id, '_length', woocommerce_clean( $_POST['_length'] ) );
if ( isset( $_POST['_width'] ) ) update_post_meta( $post_id, '_width', woocommerce_clean( $_POST['_width'] ) );
if ( isset( $_POST['_height'] ) ) update_post_meta( $post_id, '_height', woocommerce_clean( $_POST['_height'] ) );
if ( isset( $_POST['_stock_status'] ) ) update_post_meta( $post_id, '_stock_status', woocommerce_clean( $_POST['_stock_status'] ) );
if ( isset( $_POST['_visibility'] ) ) update_post_meta( $post_id, '_visibility', woocommerce_clean( $_POST['_visibility'] ) );
if ( isset( $_POST['_featured'] ) ) update_post_meta( $post_id, '_featured', 'yes' ); else update_post_meta( $post_id, '_featured', 'no' );
if ($product->is_type('simple') || $product->is_type('external')) {
if ( $product->is_type('simple') || $product->is_type('external') ) {
if(isset($_POST['_regular_price'])) update_post_meta( $post_id, '_regular_price', stripslashes( $_POST['_regular_price'] ) );
if(isset($_POST['_sale_price'])) update_post_meta( $post_id, '_sale_price', stripslashes( $_POST['_sale_price'] ) );
if ( isset( $_POST['_regular_price'] ) ) update_post_meta( $post_id, '_regular_price', woocommerce_clean( $_POST['_regular_price'] ) );
if ( isset( $_POST['_sale_price'] ) ) update_post_meta( $post_id, '_sale_price', woocommerce_clean( $_POST['_sale_price'] ) );
// Handle price - remove dates and set to lowest
$price_changed = false;
if(isset($_POST['_regular_price']) && stripslashes( $_POST['_regular_price'] )!=$product->regular_price) $price_changed = true;
if(isset($_POST['_sale_price']) && stripslashes( $_POST['_sale_price'] )!=$product->sale_price) $price_changed = true;
if ( isset( $_POST['_regular_price'] ) && woocommerce_clean( $_POST['_regular_price'] ) != $old_regular_price ) $price_changed = true;
if ( isset( $_POST['_sale_price'] ) && woocommerce_clean( $_POST['_sale_price'] ) != $old_sale_price ) $price_changed = true;
if ($price_changed) {
update_post_meta( $post_id, '_sale_price_dates_from', '');
update_post_meta( $post_id, '_sale_price_dates_to', '');
if ( $price_changed ) {
update_post_meta( $post_id, '_sale_price_dates_from', '' );
update_post_meta( $post_id, '_sale_price_dates_to', '' );
if ($_POST['_sale_price'] != '') {
update_post_meta( $post_id, '_price', stripslashes($_POST['_sale_price']) );
if ( isset( $_POST['_sale_price'] ) && $_POST['_sale_price'] != '' ) {
update_post_meta( $post_id, '_price', woocommerce_clean( $_POST['_sale_price'] ) );
} else {
update_post_meta( $post_id, '_price', stripslashes($_POST['_regular_price']) );
update_post_meta( $post_id, '_price', woocommerce_clean( $_POST['_regular_price'] ) );
}
}
}
// Handle stock
if (!$product->is_type('grouped')) {
if (isset($_POST['_manage_stock'])) {
if ( ! $product->is_type('grouped') ) {
if ( isset( $_POST['_manage_stock'] ) ) {
update_post_meta( $post_id, '_manage_stock', 'yes' );
update_post_meta( $post_id, '_stock', (int) $_POST['_stock'] );
} else {
@ -1003,7 +1004,9 @@ function woocommerce_admin_product_bulk_edit_save( $post_id, $post ) {
global $woocommerce, $wpdb;
$product = get_product( $post );
$product = get_product( $post );
$old_regular_price = $product->regular_price;
$old_sale_price = $product->sale_price;
// Save fields
if ( ! empty( $_REQUEST['change_weight'] ) && isset( $_REQUEST['_weight'] ) )
@ -1034,7 +1037,6 @@ function woocommerce_admin_product_bulk_edit_save( $post_id, $post ) {
if ( ! empty( $_REQUEST['change_regular_price'] ) ) {
$old_price = $product->regular_price;
$change_regular_price = absint( $_REQUEST['change_regular_price'] );
$regular_price = esc_attr( stripslashes( $_REQUEST['_regular_price'] ) );
@ -1045,22 +1047,22 @@ function woocommerce_admin_product_bulk_edit_save( $post_id, $post ) {
case 2 :
if ( strstr( $regular_price, '%' ) ) {
$percent = str_replace( '%', '', $regular_price ) / 100;
$new_price = $old_price + ( $old_price * $percent );
$new_price = $old_regular_price + ( $old_regular_price * $percent );
} else {
$new_price = $old_price + $regular_price;
$new_price = $old_regular_price + $regular_price;
}
break;
case 3 :
if ( strstr( $regular_price, '%' ) ) {
$percent = str_replace( '%', '', $regular_price ) / 100;
$new_price = $old_price - ( $old_price * $percent );
$new_price = $old_regular_price - ( $old_regular_price * $percent );
} else {
$new_price = $old_price - $regular_price;
$new_price = $old_regular_price - $regular_price;
}
break;
}
if ( isset( $new_price ) && $new_price != $product->regular_price ) {
if ( isset( $new_price ) && $new_price != $old_regular_price ) {
$price_changed = true;
update_post_meta( $post_id, '_regular_price', $new_price );
$product->regular_price = $new_price;
@ -1069,7 +1071,6 @@ function woocommerce_admin_product_bulk_edit_save( $post_id, $post ) {
if ( ! empty( $_REQUEST['change_sale_price'] ) ) {
$old_price = $product->sale_price;
$change_sale_price = absint( $_REQUEST['change_sale_price'] );
$sale_price = esc_attr( stripslashes( $_REQUEST['_sale_price'] ) );
@ -1080,17 +1081,17 @@ function woocommerce_admin_product_bulk_edit_save( $post_id, $post ) {
case 2 :
if ( strstr( $sale_price, '%' ) ) {
$percent = str_replace( '%', '', $sale_price ) / 100;
$new_price = $old_price + ( $old_price * $percent );
$new_price = $old_sale_price + ( $old_sale_price * $percent );
} else {
$new_price = $old_price + $sale_price;
$new_price = $old_sale_price + $sale_price;
}
break;
case 3 :
if ( strstr( $sale_price, '%' ) ) {
$percent = str_replace( '%', '', $sale_price ) / 100;
$new_price = $old_price - ( $old_price * $percent );
$new_price = $old_sale_price - ( $old_sale_price * $percent );
} else {
$new_price = $old_price - $sale_price;
$new_price = $old_sale_price - $sale_price;
}
break;
case 4 :
@ -1103,7 +1104,7 @@ function woocommerce_admin_product_bulk_edit_save( $post_id, $post ) {
break;
}
if ( isset( $new_price ) && $new_price != $product->sale_price ) {
if ( isset( $new_price ) && $new_price != $old_sale_price ) {
$price_changed = true;
update_post_meta( $post_id, '_sale_price', $new_price );
$product->sale_price = $new_price;
@ -1197,3 +1198,24 @@ function woocommerce_disable_checked_ontop( $args ) {
}
add_filter( 'wp_terms_checklist_args', 'woocommerce_disable_checked_ontop' );
/**
* Change label for insert buttons.
*
* @access public
* @param mixed $translation
* @param mixed $original
* @return void
*/
function woocommerce_change_insert_into_post( $strings ) {
global $post_type;
if ( $post_type == 'product' ) {
$strings['insertIntoPost'] = __( 'Insert into product', 'woocommerce' );
$strings['uploadedToThisPost'] = __( 'Uploaded to this product', 'woocommerce' );
}
return $strings;
}
add_filter( 'media_view_strings', 'woocommerce_change_insert_into_post' );

View File

@ -62,11 +62,11 @@ function woocommerce_custom_coupon_columns( $column ) {
if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) {
if ( 'trash' == $post->post_status )
$actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash', 'woocommerce' ) ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __( 'Restore', 'woocommerce' ) . "</a>";
$actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
elseif ( EMPTY_TRASH_DAYS )
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash', 'woocommerce' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash', 'woocommerce' ) . "</a>";
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently', 'woocommerce' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently', 'woocommerce' ) . "</a>";
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
}
$actions = apply_filters( 'post_row_actions', $actions, $post );

View File

@ -64,20 +64,21 @@ add_filter('manage_edit-shop_order_columns', 'woocommerce_edit_order_columns');
* @return void
*/
function woocommerce_custom_order_columns( $column ) {
global $post, $woocommerce, $the_order;
global $post, $woocommerce;
$order = new WC_Order( $post->ID );
if ( empty( $the_order ) || $the_order->id != $post->ID )
$the_order = new WC_Order( $post->ID );
switch ( $column ) {
case "order_status" :
printf( '<mark class="%s">%s</mark>', sanitize_title( $order->status ), esc_html__( $order->status, 'woocommerce' ) );
printf( '<mark class="%s tips" data-tip="%s">%s</mark>', sanitize_title( $the_order->status ), esc_html__( $the_order->status, 'woocommerce' ), esc_html__( $the_order->status, 'woocommerce' ) );
break;
case "order_title" :
if ( $order->user_id )
$user_info = get_userdata( $order->user_id );
if ( $the_order->user_id )
$user_info = get_userdata( $the_order->user_id );
if ( ! empty( $user_info ) ) {
@ -94,35 +95,35 @@ function woocommerce_custom_order_columns( $column ) {
$user = __( 'Guest', 'woocommerce' );
}
echo '<a href="' . admin_url( 'post.php?post=' . absint( $post->ID ) . '&action=edit' ) . '"><strong>' . sprintf( __( 'Order %s', 'woocommerce' ), esc_attr( $order->get_order_number() ) ) . '</strong></a> ' . __( 'made by', 'woocommerce' ) . ' ' . $user;
echo '<a href="' . admin_url( 'post.php?post=' . absint( $post->ID ) . '&action=edit' ) . '"><strong>' . sprintf( __( 'Order %s', 'woocommerce' ), esc_attr( $the_order->get_order_number() ) ) . '</strong></a> ' . __( 'made by', 'woocommerce' ) . ' ' . $user;
if ( $order->billing_email )
echo '<small class="meta">' . __( 'Email:', 'woocommerce' ) . ' ' . '<a href="' . esc_url( 'mailto:' . $order->billing_email ) . '">' . esc_html( $order->billing_email ) . '</a></small>';
if ( $the_order->billing_email )
echo '<small class="meta">' . __( 'Email:', 'woocommerce' ) . ' ' . '<a href="' . esc_url( 'mailto:' . $the_order->billing_email ) . '">' . esc_html( $the_order->billing_email ) . '</a></small>';
if ( $order->billing_phone )
echo '<small class="meta">' . __( 'Tel:', 'woocommerce' ) . ' ' . esc_html( $order->billing_phone ) . '</small>';
if ( $the_order->billing_phone )
echo '<small class="meta">' . __( 'Tel:', 'woocommerce' ) . ' ' . esc_html( $the_order->billing_phone ) . '</small>';
break;
case "billing_address" :
if ( $order->get_formatted_billing_address() )
echo '<a target="_blank" href="' . esc_url( 'http://maps.google.com/maps?&q=' . urlencode( $order->get_billing_address() ) . '&z=16' ) . '">' . esc_html( preg_replace( '#<br\s*/?>#i', ', ', $order->get_formatted_billing_address() ) ) .'</a>';
if ( $the_order->get_formatted_billing_address() )
echo '<a target="_blank" href="' . esc_url( 'http://maps.google.com/maps?&q=' . urlencode( $the_order->get_billing_address() ) . '&z=16' ) . '">' . esc_html( preg_replace( '#<br\s*/?>#i', ', ', $the_order->get_formatted_billing_address() ) ) .'</a>';
else
echo '&ndash;';
if ( $order->payment_method_title )
echo '<small class="meta">' . __( 'Via', 'woocommerce' ) . ' ' . esc_html( $order->payment_method_title ) . '</small>';
if ( $the_order->payment_method_title )
echo '<small class="meta">' . __( 'Via', 'woocommerce' ) . ' ' . esc_html( $the_order->payment_method_title ) . '</small>';
break;
case "shipping_address" :
if ( $order->get_formatted_shipping_address() )
echo '<a target="_blank" href="' . esc_url( 'http://maps.google.com/maps?&q=' . urlencode( $order->get_shipping_address() ) . '&z=16' ) . '">'. esc_html( preg_replace('#<br\s*/?>#i', ', ', $order->get_formatted_shipping_address() ) ) .'</a>';
if ( $the_order->get_formatted_shipping_address() )
echo '<a target="_blank" href="' . esc_url( 'http://maps.google.com/maps?&q=' . urlencode( $the_order->get_shipping_address() ) . '&z=16' ) . '">'. esc_html( preg_replace('#<br\s*/?>#i', ', ', $the_order->get_formatted_shipping_address() ) ) .'</a>';
else
echo '&ndash;';
if ( $order->shipping_method_title )
echo '<small class="meta">' . __( 'Via', 'woocommerce' ) . ' ' . esc_html( $order->shipping_method_title ) . '</small>';
if ( $the_order->shipping_method_title )
echo '<small class="meta">' . __( 'Via', 'woocommerce' ) . ' ' . esc_html( $the_order->shipping_method_title ) . '</small>';
break;
case "total_cost" :
echo esc_html( strip_tags( $order->get_formatted_order_total() ) );
echo esc_html( strip_tags( $the_order->get_formatted_order_total() ) );
break;
case "order_date" :
@ -147,45 +148,45 @@ function woocommerce_custom_order_columns( $column ) {
?><p>
<?php
do_action( 'woocommerce_admin_order_actions_start', $order );
do_action( 'woocommerce_admin_order_actions_start', $the_order );
$actions = array();
if ( in_array( $order->status, array( 'pending', 'on-hold' ) ) )
$actions[] = array(
if ( in_array( $the_order->status, array( 'pending', 'on-hold' ) ) )
$actions['processing'] = array(
'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce-mark-order-processing&order_id=' . $post->ID ), 'woocommerce-mark-order-processing' ),
'name' => __( 'Processing', 'woocommerce' ),
'action' => "processing"
);
if ( in_array( $order->status, array( 'pending', 'on-hold', 'processing' ) ) )
$actions[] = array(
if ( in_array( $the_order->status, array( 'pending', 'on-hold', 'processing' ) ) )
$actions['complete'] = array(
'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce-mark-order-complete&order_id=' . $post->ID ), 'woocommerce-mark-order-complete' ),
'name' => __( 'Complete', 'woocommerce' ),
'action' => "complete"
);
$actions[] = array(
'url' => admin_url( 'post.php?post=' . $post->ID . '&action=edit' ),
'name' => __( 'View', 'woocommerce' ),
'action' => "view"
);
$actions['view'] = array(
'url' => admin_url( 'post.php?post=' . $post->ID . '&action=edit' ),
'name' => __( 'View', 'woocommerce' ),
'action' => "view"
);
$actions = apply_filters( 'woocommerce_admin_order_actions', $actions, $order );
$actions = apply_filters( 'woocommerce_admin_order_actions', $actions, $the_order );
foreach ( $actions as $action ) {
$image = ( isset( $action['image_url'] ) ) ? $action['image_url'] : $woocommerce->plugin_url() . '/assets/images/icons/' . $action['action'] . '.png';
printf( '<a class="button tips" href="%s" data-tip="%s"><img src="%s" alt="%s" width="14" /></a>', esc_url( $action['url'] ), esc_attr( $action['name'] ), esc_attr( $image ), esc_attr( $action['name'] ) );
}
do_action( 'woocommerce_admin_order_actions_end', $order );
do_action( 'woocommerce_admin_order_actions_end', $the_order );
?>
</p><?php
break;
case "note" :
if ( $order->customer_note )
if ( $the_order->customer_note )
echo '<img src="'.$woocommerce->plugin_url().'/assets/images/note.png" alt="yes" class="tips" data-tip="' . __( 'Yes', 'woocommerce' ) . '" width="14" height="14" />';
else
echo '<img src="'.$woocommerce->plugin_url().'/assets/images/note-off.png" alt="no" class="tips" data-tip="' . __( 'No', 'woocommerce' ) . '" width="14" height="14" />';
@ -423,9 +424,8 @@ add_filter( 'request', 'woocommerce_custom_shop_order_orderby' );
function woocommerce_shop_order_search_custom_fields( $wp ) {
global $pagenow, $wpdb;
if ( 'edit.php' != $pagenow ) return $wp;
if ( ! isset( $wp->query_vars['s'] ) || ! $wp->query_vars['s'] ) return $wp;
if ( $wp->query_vars['post_type'] != 'shop_order' ) return $wp;
if ( 'edit.php' != $pagenow || empty( $wp->query_vars['s'] ) || $wp->query_vars['post_type'] != 'shop_order' )
return $wp;
$search_fields = array_map( 'esc_attr', apply_filters( 'woocommerce_shop_order_search_fields', array(
'_order_key',
@ -442,42 +442,54 @@ function woocommerce_shop_order_search_custom_fields( $wp ) {
'_billing_phone'
) ) );
// Query matching custom fields - this seems faster than meta_query
$post_ids = $wpdb->get_col(
$wpdb->prepare(
"SELECT post_id FROM " . $wpdb->postmeta . " WHERE meta_key IN ('" . implode( "','", $search_fields ) . "') AND meta_value LIKE '%%%s%%'", esc_attr( $_GET['s'] )
)
);
// Query matching excerpts and titles
$post_ids = array_merge( $post_ids, $wpdb->get_col( $wpdb->prepare('
SELECT ' . $wpdb->posts . '.ID
FROM ' . $wpdb->posts . '
LEFT JOIN ' . $wpdb->postmeta . ' ON ' . $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id
LEFT JOIN ' . $wpdb->users . ' ON ' . $wpdb->postmeta . '.meta_value = ' . $wpdb->users . '.ID
WHERE
post_excerpt LIKE "%%%1$s%%" OR
post_title LIKE "%%%1$s%%" OR
(
meta_key = "_customer_user" AND
(
user_login LIKE "%%%1$s%%" OR
user_nicename LIKE "%%%1$s%%" OR
user_email LIKE "%%%1$s%%" OR
display_name LIKE "%%%1$s%%"
)
)
',
esc_attr($_GET['s'])
) ) );
// Add ID
$search_order_id = str_replace( 'Order #', '', $_GET['s'] );
if ( is_numeric( $search_order_id ) )
$post_ids[] = $search_order_id;
if ( ! is_numeric( $search_order_id ) )
$search_order_id = 0;
// Add blank ID so not all results are returned if the search finds nothing
$post_ids[] = 0;
// Search orders
$post_ids = array_merge(
$wpdb->get_col(
$wpdb->prepare( "
SELECT post_id
FROM {$wpdb->postmeta}
WHERE meta_key IN ('" . implode( "','", $search_fields ) . "')
AND meta_value LIKE '%%%s%%'",
esc_attr( $_GET['s'] )
)
),
$wpdb->get_col(
$wpdb->prepare( "
SELECT order_id
FROM {$wpdb->prefix}woocommerce_order_items as order_items
WHERE order_item_name LIKE '%%%s%%'
",
esc_attr( $_GET['s'] )
)
),
$wpdb->get_col(
$wpdb->prepare( "
SELECT posts.ID
FROM {$wpdb->posts} as posts
LEFT JOIN {$wpdb->postmeta} as postmeta ON posts.ID = postmeta.post_id
LEFT JOIN {$wpdb->users} as users ON postmeta.meta_value = users.ID
WHERE
post_excerpt LIKE '%%%1\$s%%' OR
post_title LIKE '%%%1\$s%%' OR
(
meta_key = '_customer_user' AND
(
user_login LIKE '%%%1\$s%%' OR
user_nicename LIKE '%%%1\$s%%' OR
user_email LIKE '%%%1\$s%%' OR
display_name LIKE '%%%1\$s%%'
)
)
",
esc_attr( $_GET['s'] )
)
),
array( $search_order_id )
);
// Remove s - we don't want to search order name
unset( $wp->query_vars['s'] );
@ -526,4 +538,27 @@ function woocommerce_add_custom_query_var($public_query_vars) {
return $public_query_vars;
}
add_filter('query_vars', 'woocommerce_add_custom_query_var');
add_filter('query_vars', 'woocommerce_add_custom_query_var');
/**
* Remove item meta on permanent deletion
*
* @access public
* @return void
**/
function woocommerce_delete_order_items( $postid )
{
global $wpdb;
if ( get_post_type( $postid ) == 'shop_order' )
{
$wpdb->query( "
DELETE {$wpdb->prefix}woocommerce_order_items, {$wpdb->prefix}woocommerce_order_itemmeta
FROM {$wpdb->prefix}woocommerce_order_items
JOIN {$wpdb->prefix}woocommerce_order_itemmeta ON {$wpdb->prefix}woocommerce_order_items.order_item_id = {$wpdb->prefix}woocommerce_order_itemmeta.order_item_id
WHERE {$wpdb->prefix}woocommerce_order_items.order_id = '{$postid}';
" );
}
}
add_action( 'before_delete_post', 'woocommerce_delete_order_items' );

View File

@ -11,6 +11,8 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<input type="hidden" class="order_item_id" name="order_item_id[]" value="<?php echo esc_attr( $item_id ); ?>" />
</td>
<?php if ( get_option( 'woocommerce_calc_taxes' ) == 'yes' ) : ?>
<td class="tax_class" width="1%">
<select class="tax_class" name="order_item_tax_class[<?php echo absint( $item_id ); ?>]" title="<?php _e( 'Tax class', 'woocommerce' ); ?>">
<?php $tax_class = isset( $item['tax_class'] ) ? sanitize_title( $item['tax_class'] ) : ''; ?>
@ -33,14 +35,20 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
</select>
</td>
<?php endif; ?>
<td class="quantity" width="1%">1</td>
<td class="line_cost" width="1%">
<label><?php _e( 'Total', 'woocommerce' ); ?>: <input type="text" name="line_total[<?php echo absint( $item_id ); ?>]" placeholder="0.00" value="<?php if ( isset( $item['line_total'] ) ) echo esc_attr( $item['line_total'] ); ?>" class="line_total" /></label>
</td>
<?php if ( get_option( 'woocommerce_calc_taxes' ) == 'yes' ) : ?>
<td class="line_tax" width="1%">
<input type="text" name="line_tax[<?php echo absint( $item_id ); ?>]" placeholder="0.00" value="<?php if ( isset( $item['line_tax'] ) ) echo esc_attr( $item['line_tax'] ); ?>" class="line_tax" />
</td>
<?php endif; ?>
</tr>

View File

@ -48,7 +48,6 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
'_line_subtotal_tax',
'_line_total',
'_line_tax',
'_refunded'
) ) ) ) continue;
// Handle serialised fields
@ -79,6 +78,8 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<?php do_action( 'woocommerce_admin_order_item_values', $_product, $item, absint( $item_id ) ); ?>
<?php if ( get_option( 'woocommerce_calc_taxes' ) == 'yes' ) : ?>
<td class="tax_class" width="1%">
<select class="tax_class" name="order_item_tax_class[<?php echo absint( $item_id ); ?>]" title="<?php _e( 'Tax class', 'woocommerce' ); ?>">
<?php
@ -99,6 +100,8 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
</select>
</td>
<?php endif; ?>
<td class="quantity" width="1%">
<input type="number" step="<?php echo apply_filters( 'woocommerce_quantity_input_step', '1', $_product ); ?>" min="0" autocomplete="off" name="order_item_qty[<?php echo absint( $item_id ); ?>]" placeholder="0" value="<?php echo esc_attr( $item['qty'] ); ?>" size="4" class="quantity" />
</td>
@ -109,10 +112,14 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<span class="subtotal"><label><?php _e( 'Subtotal', 'woocommerce' ); ?>: <input type="number" step="any" min="0" name="line_subtotal[<?php echo absint( $item_id ); ?>]" placeholder="0.00" value="<?php if ( isset( $item['line_subtotal'] ) ) echo esc_attr( $item['line_subtotal'] ); ?>" class="line_subtotal" /></label></span>
</td>
<?php if ( get_option( 'woocommerce_calc_taxes' ) == 'yes' ) : ?>
<td class="line_tax" width="1%">
<input type="number" step="any" min="0" name="line_tax[<?php echo absint( $item_id ); ?>]" placeholder="0.00" value="<?php if ( isset( $item['line_tax'] ) ) echo esc_attr( $item['line_tax'] ); ?>" class="line_tax" />
<span class="subtotal"><input type="number" step="any" min="0" name="line_subtotal_tax[<?php echo absint( $item_id ); ?>]" placeholder="0.00" value="<?php if ( isset( $item['line_subtotal_tax'] ) ) echo esc_attr( $item['line_subtotal_tax'] ); ?>" class="line_subtotal_tax" /></span>
</td>
<?php endif; ?>
</tr>

View File

@ -21,15 +21,21 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
// Get terms for attribute taxonomy or value if its a custom attribute
if ( $attribute['is_taxonomy'] ) {
$post_terms = wp_get_post_terms( $parent_data['id'], $attribute['name'] );
foreach ( $post_terms as $term ) {
echo '<option ' . selected( $variation_selected_value, $term->slug, false ) . ' value="' . esc_attr( $term->slug ) . '">' . apply_filters( 'woocommerce_variation_option_name', esc_html( $term->name ) ) . '</option>';
}
} else {
$options = explode( '|', $attribute['value'] );
$options = array_map( 'trim', explode( '|', $attribute['value'] ) );
foreach ( $options as $option ) {
echo '<option ' . selected( $variation_selected_value, $option, false ) . ' value="' . esc_attr( $option ) . '">' . ucfirst( apply_filters( 'woocommerce_variation_option_name', esc_html( $option ) ) ) . '</option>';
echo '<option ' . selected( sanitize_title( $variation_selected_value ), sanitize_title( $option ), false ) . ' value="' . esc_attr( sanitize_title( $option ) ) . '">' . esc_html( apply_filters( 'woocommerce_variation_option_name', $option ) ) . '</option>';
}
}
echo '</select>';
@ -50,11 +56,11 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<?php endif; ?>
</td>
<td class="data" rowspan="2">
<table cellspacing="0" cellpadding="0">
<table cellspacing="0" cellpadding="0" class="data_table">
<?php if ( get_option( 'woocommerce_manage_stock' ) == 'yes' ) : ?>
<tr>
<td>
<label><?php _e( 'Stock Qty:', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enter a quantity to enable stock management for this variation, or leave blank to use the variable product stock options.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<label><?php _e( 'Stock Qty:', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enter a quantity to enable stock management at variation level, or leave blank to use the parent product\'s options.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<input type="number" size="5" name="variable_stock[<?php echo $loop; ?>]" value="<?php if ( isset( $_stock ) ) echo esc_attr( $_stock ); ?>" step="any" />
</td>
<td>&nbsp;</td>
@ -63,11 +69,11 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<tr>
<td>
<label><?php _e( 'Price:', 'woocommerce' ); ?></label>
<input type="number" size="5" name="variable_regular_price[<?php echo $loop; ?>]" value="<?php if ( isset( $_regular_price ) ) echo esc_attr( $_regular_price ); ?>" step="any" min="0" />
<label><?php echo __( 'Regular Price:', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol().')'; ?></label>
<input type="number" size="5" name="variable_regular_price[<?php echo $loop; ?>]" value="<?php if ( isset( $_regular_price ) ) echo esc_attr( $_regular_price ); ?>" step="any" min="0" placeholder="<?php _e( 'Variation price (required)', 'woocommerce' ); ?>" />
</td>
<td>
<label><?php _e( 'Sale Price:', 'woocommerce' ); ?> <a href="#" class="sale_schedule"><?php _e( 'Schedule', 'woocommerce' ); ?></a><a href="#" class="cancel_sale_schedule" style="display:none"><?php _e( 'Cancel schedule', 'woocommerce' ); ?></a></label>
<label><?php echo __( 'Sale Price:', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol().')'; ?> <a href="#" class="sale_schedule"><?php _e( 'Schedule', 'woocommerce' ); ?></a><a href="#" class="cancel_sale_schedule" style="display:none"><?php _e( 'Cancel schedule', 'woocommerce' ); ?></a></label>
<input type="number" size="5" name="variable_sale_price[<?php echo $loop; ?>]" value="<?php if ( isset( $_sale_price ) ) echo esc_attr( $_sale_price ); ?>" step="any" min="0" />
</td>
</tr>
@ -110,7 +116,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$args = array(
'taxonomy' => 'product_shipping_class',
'hide_empty' => 0,
'show_option_all' => __( 'Same as parent', 'woocommerce' ),
'show_option_none' => __( 'Same as parent', 'woocommerce' ),
'name' => 'variable_shipping_class[' . $loop . ']',
'id' => '',
'selected' => isset( $shipping_class ) ? esc_attr( $shipping_class ) : '',
@ -120,11 +126,13 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
echo wp_dropdown_categories( $args );
?></td>
<td>
<?php if ( get_option( 'woocommerce_calc_taxes' ) == 'yes' ) : ?>
<label><?php _e( 'Tax class:', 'woocommerce' ); ?></label>
<select name="variable_tax_class[<?php echo $loop; ?>]"><?php
foreach ( $parent_data['tax_class_options'] as $key => $value )
echo '<option value="' . esc_attr( $key ) . '" ' . selected( $key, $_tax_class, false ) . '>' . esc_html( $value ) . '</option>';
?></select>
<?php endif; ?>
</td>
</tr>
<tr class="show_if_variation_downloadable">
@ -132,7 +140,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<div class="file_path_field">
<label><?php _e( 'File paths:', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enter one or more File Paths, one per line, to make this variation a downloadable product, or leave blank.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<textarea style="float:left;" class="short file_paths" cols="20" rows="2" placeholder="<?php _e( 'File paths/URLs, one per line', 'woocommerce' ); ?>" name="variable_file_paths[<?php echo $loop; ?>]" wrap="off"><?php if ( isset( $_file_paths ) ) echo esc_textarea( $_file_paths ); ?></textarea>
<input type="button" class="upload_file_button button" value="<?php _e( 'Upload a file', 'woocommerce' ); ?>" title="<?php _e( 'Upload', 'woocommerce' ); ?>" />
<input type="button" class="upload_file_button button" value="<?php _e( 'Choose a file', 'woocommerce' ); ?>" title="<?php _e( 'Upload', 'woocommerce' ); ?>" data-choose="<?php _e( 'Choose a file', 'woocommerce' ); ?>" data-update="<?php _e( 'Insert file URL', 'woocommerce' ); ?>" value="<?php _e( 'Choose a file', 'woocommerce' ); ?>" />
</div>
</td>
<td>
@ -150,7 +158,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
</div>
</td>
</tr>
<?php do_action( 'woocommerce_product_after_variable_attributes', $loop, $variation_data ); ?>
<?php do_action( 'woocommerce_product_after_variable_attributes', $loop, $variation_data, $variation ); ?>
</table>
</td>
</tr>
@ -165,7 +173,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<label><input type="checkbox" class="checkbox variable_is_virtual" name="variable_is_virtual[<?php echo $loop; ?>]" <?php checked( isset( $_virtual ) ? $_virtual : '', 'yes' ); ?> /> <?php _e( 'Virtual', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enable this option if a product is not shipped or there is no shipping cost', 'woocommerce' ); ?>" href="#">[?]</a></label>
<?php do_action( 'woocommerce_variation_options', $loop, $variation_data ); ?>
<?php do_action( 'woocommerce_variation_options', $loop, $variation_data, $variation ); ?>
</td>
</tr>
</tbody>

View File

@ -42,13 +42,13 @@ function woocommerce_coupon_data_meta_box( $post ) {
woocommerce_wp_select( array( 'id' => 'discount_type', 'label' => __( 'Discount type', 'woocommerce' ), 'options' => $woocommerce->get_coupon_discount_types() ) );
// Amount
woocommerce_wp_text_input( array( 'id' => 'coupon_amount', 'label' => __( 'Coupon amount', 'woocommerce' ), 'placeholder' => '0.00', 'description' => __( 'Enter an amount e.g. 2.99', 'woocommerce' ), 'type' => 'number', 'custom_attributes' => array(
woocommerce_wp_text_input( array( 'id' => 'coupon_amount', 'label' => __( 'Coupon amount', 'woocommerce' ), 'placeholder' => '0.00', 'description' => __( 'Value of the coupon.', 'woocommerce' ), 'type' => 'number', 'custom_attributes' => array(
'step' => 'any',
'min' => '0'
) ) );
// Free Shipping
woocommerce_wp_checkbox( array( 'id' => 'free_shipping', 'label' => __( 'Enable free shipping', 'woocommerce' ), 'description' => sprintf(__( 'Check this box if the coupon grants free shipping. The <a href="%s">free shipping method</a> must be enabled with the "must use coupon" setting checked.', 'woocommerce' ), admin_url('admin.php?page=woocommerce_settings&tab=shipping&section=WC_Free_Shipping')) ) );
woocommerce_wp_checkbox( array( 'id' => 'free_shipping', 'label' => __( 'Enable free shipping', 'woocommerce' ), 'description' => sprintf(__( 'Check this box if the coupon grants free shipping. The <a href="%s">free shipping method</a> must be enabled with the "must use coupon" setting checked.', 'woocommerce' ), admin_url('admin.php?page=woocommerce_settings&tab=shipping&section=WC_Shipping_Free_Shipping')) ) );
// Individual use
woocommerce_wp_checkbox( array( 'id' => 'individual_use', 'label' => __( 'Individual use', 'woocommerce' ), 'description' => __( 'Check this box if the coupon cannot be used in conjunction with other coupons.', 'woocommerce' ) ) );
@ -56,6 +56,9 @@ function woocommerce_coupon_data_meta_box( $post ) {
// Apply before tax
woocommerce_wp_checkbox( array( 'id' => 'apply_before_tax', 'label' => __( 'Apply before tax', 'woocommerce' ), 'description' => __( 'Check this box if the coupon should be applied before calculating cart tax.', 'woocommerce' ) ) );
// Exclude Sale Products
woocommerce_wp_checkbox( array( 'id' => 'exclude_sale_items', 'label' => __( 'Exclude sale items', 'woocommerce' ), 'description' => __( 'Check this box if the coupon should not apply to items on sale. Per-item coupons will only work if the item is not on sale. Per-cart coupons will only work if there are no sale items in the cart.', 'woocommerce' ) ) );
echo '</div><div class="options_group">';
// minimum spend
@ -75,16 +78,11 @@ function woocommerce_coupon_data_meta_box( $post ) {
if ( $product_ids ) {
$product_ids = array_map( 'absint', explode( ',', $product_ids ) );
foreach ( $product_ids as $product_id ) {
$title = get_the_title( $product_id );
$sku = get_post_meta( $product_id, '_sku', true );
if ( ! $title )
continue;
$product = get_product( $product_id );
$product_name = woocommerce_get_formatted_product_name( $product );
if ( ! empty( $sku ) )
$sku = ' (SKU: ' . $sku . ')';
echo '<option value="' . esc_attr( $product_id ) . '" selected="selected">' . esc_html( $title . $sku ) . '</option>';
echo '<option value="' . esc_attr( $product_id ) . '" selected="selected">' . wp_kses_post( $product_name ) . '</option>';
}
}
?>
@ -100,16 +98,11 @@ function woocommerce_coupon_data_meta_box( $post ) {
if ( $product_ids ) {
$product_ids = array_map( 'absint', explode( ',', $product_ids ) );
foreach ( $product_ids as $product_id ) {
$title = get_the_title( $product_id );
$sku = get_post_meta( $product_id, '_sku', true );
if ( ! $title )
continue;
$product = get_product( $product_id );
$product_name = woocommerce_get_formatted_product_name( $product );
if ( ! empty( $sku ) )
$sku = ' (SKU: ' . $sku . ')';
echo '<option value="' . esc_attr( $product_id ) . '" selected="selected">' . esc_html( $title . $sku ) . '</option>';
echo '<option value="' . esc_attr( $product_id ) . '" selected="selected">' . esc_html( $product_name ) . '</option>';
}
}
?>
@ -209,6 +202,7 @@ function woocommerce_process_shop_coupon_meta( $post_id, $post ) {
$expiry_date = woocommerce_clean( $_POST['expiry_date'] );
$apply_before_tax = isset( $_POST['apply_before_tax'] ) ? 'yes' : 'no';
$free_shipping = isset( $_POST['free_shipping'] ) ? 'yes' : 'no';
$exclude_sale_items = isset( $_POST['exclude_sale_items'] ) ? 'yes' : 'no';
$minimum_amount = woocommerce_clean( $_POST['minimum_amount'] );
$customer_email = array_filter( array_map( 'trim', explode( ',', woocommerce_clean( $_POST['customer_email'] ) ) ) );
@ -237,6 +231,7 @@ function woocommerce_process_shop_coupon_meta( $post_id, $post ) {
update_post_meta( $post_id, 'expiry_date', $expiry_date );
update_post_meta( $post_id, 'apply_before_tax', $apply_before_tax );
update_post_meta( $post_id, 'free_shipping', $free_shipping );
update_post_meta( $post_id, 'exclude_sale_items', $exclude_sale_items );
update_post_meta( $post_id, 'product_categories', $product_categories );
update_post_meta( $post_id, 'exclude_product_categories', $exclude_product_categories );
update_post_meta( $post_id, 'minimum_amount', $minimum_amount );

View File

@ -49,82 +49,95 @@ function woocommerce_order_data_meta_box($post) {
$order_title = $post->post_title;
?>
<style type="text/css">
#titlediv, #major-publishing-actions, #minor-publishing-actions, #visibility, #submitdiv { display:none }
#post-body-content, #titlediv, #major-publishing-actions, #minor-publishing-actions, #visibility, #submitdiv { display:none }
</style>
<div class="panel-wrap woocommerce">
<input name="post_title" type="hidden" value="<?php echo esc_attr( $order_title ); ?>" />
<input name="post_status" type="hidden" value="publish" />
<div id="order_data" class="panel">
<div class="order_data_left">
<h2><?php _e( 'Order Details', 'woocommerce' ); ?></h2>
<p class="order_number"><?php
<h2><?php _e( 'Order Details', 'woocommerce' ); ?> &mdash; <?php echo esc_html( $order->get_order_number() ); ?></h2>
echo __( 'Order number', 'woocommerce' ) . ' ' . esc_html( $order->get_order_number() ) . '. ';
<p class="form-field"><label for="order_status"><?php _e( 'Order status:', 'woocommerce' ) ?></label>
<select id="order_status" name="order_status" class="chosen_select">
<?php
$statuses = (array) get_terms( 'shop_order_status', array( 'hide_empty' => 0, 'orderby' => 'id' ) );
foreach ( $statuses as $status ) {
echo '<option value="' . esc_attr( $status->slug ) . '" ' . selected( $status->slug, $order_status, false ) . '>' . esc_html__( $status->name, 'woocommerce' ) . '</option>';
}
?>
</select></p>
$ip_address = get_post_meta( $post->ID, '_customer_ip_address', true );
<p class="form-field last"><label for="order_date"><?php _e( 'Order Date:', 'woocommerce' ) ?></label>
<input type="text" class="date-picker-field" name="order_date" id="order_date" maxlength="10" value="<?php echo date_i18n( 'Y-m-d', strtotime( $post->post_date ) ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" /> @ <input type="text" class="hour" placeholder="<?php _e( 'h', 'woocommerce' ) ?>" name="order_date_hour" id="order_date_hour" maxlength="2" size="2" value="<?php echo date_i18n( 'H', strtotime( $post->post_date ) ); ?>" pattern="\-?\d+(\.\d{0,})?" />:<input type="text" class="minute" placeholder="<?php _e( 'm', 'woocommerce' ) ?>" name="order_date_minute" id="order_date_minute" maxlength="2" size="2" value="<?php echo date_i18n( 'i', strtotime( $post->post_date ) ); ?>" pattern="\-?\d+(\.\d{0,})?" />
</p>
if ( $ip_address )
echo __( 'Customer IP:', 'woocommerce' ) . ' ' . esc_html( $ip_address );
<p class="form-field form-field-wide">
<label for="customer_user"><?php _e( 'Customer:', 'woocommerce' ) ?></label>
<select id="customer_user" name="customer_user" class="ajax_chosen_select_customer">
<option value=""><?php _e( 'Guest', 'woocommerce' ) ?></option>
?></p>
<div class="order_data_column_container">
<div class="order_data_column">
<h4><?php _e( 'General Details', 'woocommerce' ); ?></h4>
<p class="form-field"><label for="order_status"><?php _e( 'Order status:', 'woocommerce' ) ?></label>
<select id="order_status" name="order_status" class="chosen_select">
<?php
if ( $customer_user ) {
$user = get_user_by( 'id', $customer_user );
echo '<option value="' . esc_attr( $user->ID ) . '" ' . selected( 1, 1, false ) . '>' . esc_html( $user->display_name ) . ' (#' . absint( $user->ID ) . ' &ndash; ' . esc_html( $user->user_email ) . ')</option>';
$statuses = (array) get_terms( 'shop_order_status', array( 'hide_empty' => 0, 'orderby' => 'id' ) );
foreach ( $statuses as $status ) {
echo '<option value="' . esc_attr( $status->slug ) . '" ' . selected( $status->slug, $order_status, false ) . '>' . esc_html__( $status->name, 'woocommerce' ) . '</option>';
}
?>
</select>
<?php
</select></p>
// Ajax Chosen Customer Selectors JS
$woocommerce->add_inline_js( "
jQuery('select.ajax_chosen_select_customer').ajaxChosen({
method: 'GET',
url: '" . admin_url('admin-ajax.php') . "',
dataType: 'json',
afterTypeDelay: 100,
minTermLength: 1,
data: {
action: 'woocommerce_json_search_customers',
security: '" . wp_create_nonce("search-customers") . "'
}
}, function (data) {
<p class="form-field last"><label for="order_date"><?php _e( 'Order Date:', 'woocommerce' ) ?></label>
<input type="text" class="date-picker-field" name="order_date" id="order_date" maxlength="10" value="<?php echo date_i18n( 'Y-m-d', strtotime( $post->post_date ) ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" /> @ <input type="text" class="hour" placeholder="<?php _e( 'h', 'woocommerce' ) ?>" name="order_date_hour" id="order_date_hour" maxlength="2" size="2" value="<?php echo date_i18n( 'H', strtotime( $post->post_date ) ); ?>" pattern="\-?\d+(\.\d{0,})?" />:<input type="text" class="minute" placeholder="<?php _e( 'm', 'woocommerce' ) ?>" name="order_date_minute" id="order_date_minute" maxlength="2" size="2" value="<?php echo date_i18n( 'i', strtotime( $post->post_date ) ); ?>" pattern="\-?\d+(\.\d{0,})?" />
</p>
var terms = {};
<p class="form-field form-field-wide">
<label for="customer_user"><?php _e( 'Customer:', 'woocommerce' ) ?></label>
<select id="customer_user" name="customer_user" class="ajax_chosen_select_customer">
<option value=""><?php _e( 'Guest', 'woocommerce' ) ?></option>
<?php
if ( $customer_user ) {
$user = get_user_by( 'id', $customer_user );
echo '<option value="' . esc_attr( $user->ID ) . '" ' . selected( 1, 1, false ) . '>' . esc_html( $user->display_name ) . ' (#' . absint( $user->ID ) . ' &ndash; ' . esc_html( $user->user_email ) . ')</option>';
}
?>
</select>
<?php
$.each(data, function (i, val) {
terms[i] = val;
});
// Ajax Chosen Customer Selectors JS
$woocommerce->add_inline_js( "
jQuery('select.ajax_chosen_select_customer').ajaxChosen({
method: 'GET',
url: '" . admin_url('admin-ajax.php') . "',
dataType: 'json',
afterTypeDelay: 100,
minTermLength: 1,
data: {
action: 'woocommerce_json_search_customers',
security: '" . wp_create_nonce("search-customers") . "'
}
}, function (data) {
return terms;
});
" );
var terms = {};
?>
</p>
$.each(data, function (i, val) {
terms[i] = val;
});
<?php if( get_option( 'woocommerce_enable_order_comments' ) != 'no' ) : ?>
<p class="form-field form-field-wide"><label for="excerpt"><?php _e( 'Customer Note:', 'woocommerce' ) ?></label>
<textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt" placeholder="<?php _e( 'Customer\'s notes about the order', 'woocommerce' ); ?>"><?php echo wp_kses_post( $post->post_excerpt ); ?></textarea></p>
<?php endif; ?>
return terms;
});
" );
?>
</p>
<?php do_action( 'woocommerce_admin_order_data_after_order_details', $order ); ?>
<?php if ( get_option( 'woocommerce_enable_order_comments' ) != 'no' ) : ?>
</div>
<div class="order_data_right">
<div class="order_data">
<h2><?php _e( 'Billing Details', 'woocommerce' ); ?> <a class="edit_address" href="#">(<?php _e( 'Edit', 'woocommerce' ) ;?>)</a></h2>
<p class="form-field form-field-wide"><label for="excerpt"><?php _e( 'Customer Note:', 'woocommerce' ) ?></label>
<textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt" placeholder="<?php _e( 'Customer\'s notes about the order', 'woocommerce' ); ?>"><?php echo wp_kses_post( $post->post_excerpt ); ?></textarea></p>
<?php endif; ?>
<?php do_action( 'woocommerce_admin_order_data_after_order_details', $order ); ?>
</div>
<div class="order_data_column">
<h4><?php _e( 'Billing Details', 'woocommerce' ); ?> <a class="edit_address" href="#">(<?php _e( 'Edit', 'woocommerce' ) ;?>)</a></h4>
<?php
$billing_data = apply_filters('woocommerce_admin_billing_fields', array(
'first_name' => array(
@ -182,7 +195,7 @@ function woocommerce_order_data_meta_box($post) {
echo '<p class="none_set"><strong>' . __( 'Address', 'woocommerce' ) . ':</strong> ' . __( 'No billing address set.', 'woocommerce' ) . '</p>';
foreach ( $billing_data as $key => $field ) {
if ( empty( $field['show'] ) )
if ( isset( $field['show'] ) && $field['show'] === false )
continue;
$field_name = 'billing_' . $key;
if ( $order->$field_name )
@ -212,9 +225,9 @@ function woocommerce_order_data_meta_box($post) {
do_action( 'woocommerce_admin_order_data_after_billing_address', $order );
?>
</div>
<div class="order_data order_data_alt">
<div class="order_data_column">
<h2><?php _e( 'Shipping Details', 'woocommerce' ); ?> <a class="edit_address" href="#">(<?php _e( 'Edit', 'woocommerce' ) ;?>)</a></h2>
<h4><?php _e( 'Shipping Details', 'woocommerce' ); ?> <a class="edit_address" href="#">(<?php _e( 'Edit', 'woocommerce' ) ;?>)</a></h4>
<?php
$shipping_data = apply_filters('woocommerce_admin_shipping_fields', array(
'first_name' => array(
@ -266,7 +279,7 @@ function woocommerce_order_data_meta_box($post) {
echo '<p class="none_set"><strong>' . __( 'Address', 'woocommerce' ) . ':</strong> ' . __( 'No shipping address set.', 'woocommerce' ) . '</p>';
if ( $shipping_data ) foreach ( $shipping_data as $key => $field ) {
if ( empty( $field['show'] ) )
if ( isset( $field['show'] ) && $field['show'] === false )
continue;
$field_name = 'shipping_' . $key;
if ( $order->$field_name )
@ -316,7 +329,7 @@ function woocommerce_order_items_meta_box( $post ) {
$order = $theorder;
$data = get_post_custom( $post->ID );
$data = get_post_meta( $post->ID );
?>
<div class="woocommerce_order_items_wrapper">
<table cellpadding="0" cellspacing="0" class="woocommerce_order_items">
@ -327,13 +340,17 @@ function woocommerce_order_items_meta_box( $post ) {
<?php do_action( 'woocommerce_admin_order_item_headers' ); ?>
<th class="tax_class"><?php _e( 'Tax Class', 'woocommerce' ); ?>&nbsp;<a class="tips" data-tip="<?php _e( 'Tax class for the line item', 'woocommerce' ); ?>." href="#">[?]</a></th>
<?php if ( get_option( 'woocommerce_calc_taxes' ) == 'yes' ) : ?>
<th class="tax_class"><?php _e( 'Tax Class', 'woocommerce' ); ?>&nbsp;<a class="tips" data-tip="<?php _e( 'Tax class for the line item', 'woocommerce' ); ?>." href="#">[?]</a></th>
<?php endif; ?>
<th class="quantity"><?php _e( 'Qty', 'woocommerce' ); ?></th>
<th class="line_cost"><?php _e( 'Cost', 'woocommerce' ); ?>&nbsp;<a class="tips" data-tip="<?php _e( 'Line subtotals are before pre-tax discounts, totals are after.', 'woocommerce' ); ?>" href="#">[?]</a></th>
<th class="line_tax"><?php _e( 'Tax', 'woocommerce' ); ?></th>
<?php if ( get_option( 'woocommerce_calc_taxes' ) == 'yes' ) : ?>
<th class="line_tax"><?php _e( 'Tax', 'woocommerce' ); ?></th>
<?php endif; ?>
</tr>
</thead>
<tbody id="order_items_list">
@ -344,14 +361,13 @@ function woocommerce_order_items_meta_box( $post ) {
foreach ( $order_items as $item_id => $item ) {
$class = ( isset( $item['refunded'] ) ) ? 'refunded' : '';
switch ( $item['type'] ) {
case 'line_item' :
$_product = $order->get_product_from_item( $item );
$item_meta = $order->get_item_meta( $item_id );
include( 'order-item-html.php' );
if ( $_product )
include( 'order-item-html.php' );
break;
case 'fee' :
include( 'order-fee-html.php' );
@ -371,23 +387,6 @@ function woocommerce_order_items_meta_box( $post ) {
<option value=""><?php _e( 'Actions', 'woocommerce' ); ?></option>
<optgroup label="<?php _e( 'Edit', 'woocommerce' ); ?>">
<option value="delete"><?php _e( 'Delete Lines', 'woocommerce' ); ?></option>
<?php
$gateways = $woocommerce->payment_gateways->payment_gateways();
if ( isset( $gateways[ $order->payment_method ] ) ) {
$gateway = $gateways[ $order->payment_method ];
if ( ! in_array( 'refunds', $gateway->supports ) || ! method_exists( $gateway, 'refund' ) ) {
$supports_refunds = false;
} else {
$supports_refunds = true;
}
echo '<option value="refund" ' . disabled( $supports_refunds, false ) . '>' . sprintf( __( 'Refund Lines via %s', 'woocommerce' ), $order->payment_method ) . '</option>';
}
echo '<option value="manual_refund">' . __( 'Mark Lines Refunded', 'woocommerce' ) . '</option>';
?>
</optgroup>
<optgroup label="<?php _e( 'Stock Actions', 'woocommerce' ); ?>">
<option value="reduce_stock"><?php _e( 'Reduce Line Stock', 'woocommerce' ); ?></option>
@ -395,7 +394,7 @@ function woocommerce_order_items_meta_box( $post ) {
</optgroup>
</select>
<button type="button" class="button do_bulk_action"><?php _e( 'Apply', 'woocommerce' ); ?></button>
<button type="button" class="button do_bulk_action wc-reload" title="<?php _e( 'Apply', 'woocommerce' ); ?>"><span><?php _e( 'Apply', 'woocommerce' ); ?></span></button>
</p>
<p class="add_items">
@ -450,27 +449,12 @@ function woocommerce_order_actions_meta_box( $post ) {
}
?>
</optgroup>
<optgroup label="<?php _e( 'Refund Order', 'woocommerce' ); ?>">
<?php
$gateways = $woocommerce->payment_gateways->payment_gateways();
if ( isset( $gateways[ $order->payment_method ] ) ) {
$gateway = $gateways[ $order->payment_method ];
if ( ! in_array( 'refunds', $gateway->supports ) || ! method_exists( $gateway, 'refund' ) ) {
$supports_refunds = false;
} else {
$supports_refunds = true;
}
echo '<option value="refund_order" ' . disabled( $supports_refunds, false ) . '>' . sprintf( __( 'Refund Order via %s', 'woocommerce' ), $order->payment_method ) . '</option>';
}
echo '<option value="manual_refund_order">' . __( 'Mark Order Refunded', 'woocommerce' ) . '</option>';
?>
</optgroup>
<?php foreach( apply_filters( 'woocommerce_order_actions', array() ) as $action => $title ) { ?>
<option value="<?php echo $action; ?>"><?php echo $title; ?></option>
<?php } ?>
</select>
<button class="button"><?php _e( 'Apply', 'woocommerce' ); ?></button>
<button class="button wc-reload" title="<?php _e( 'Apply', 'woocommerce' ); ?>"><span><?php _e( 'Apply', 'woocommerce' ); ?></span></button>
</li>
<li class="wide">
@ -506,7 +490,7 @@ function woocommerce_order_totals_meta_box( $post ) {
$order = $theorder;
$data = get_post_custom( $post->ID );
$data = get_post_meta( $post->ID );
?>
<div class="totals_group">
<h4><span class="discount_total_display inline_total"></span><?php _e( 'Discounts', 'woocommerce' ); ?></h4>
@ -574,10 +558,10 @@ function woocommerce_order_totals_meta_box( $post ) {
<select name="_shipping_method" id="_shipping_method" class="first">
<option value=""><?php _e( 'N/A', 'woocommerce' ); ?></option>
<?php
$chosen_method = $data['_shipping_method'][0];
$chosen_method = ! empty( $data['_shipping_method'][0] ) ? $data['_shipping_method'][0] : '';
$found_method = false;
if ( $woocommerce->shipping ) {
if ( $woocommerce->shipping() ) {
foreach ( $woocommerce->shipping->load_shipping_methods() as $method ) {
if ( strpos( $chosen_method, $method->id ) === 0 )
@ -604,6 +588,9 @@ function woocommerce_order_totals_meta_box( $post ) {
<?php do_action( 'woocommerce_admin_order_totals_after_shipping', $post->ID ) ?>
<div class="clear"></div>
</div>
<?php if ( get_option( 'woocommerce_calc_taxes' ) == 'yes' ) : ?>
<div class="totals_group tax_rows_group">
<h4><?php _e( 'Tax Rows', 'woocommerce' ); ?></h4>
<div id="tax_rows" class="total_rows">
@ -656,6 +643,9 @@ function woocommerce_order_totals_meta_box( $post ) {
</ul>
<div class="clear"></div>
</div>
<?php endif; ?>
<div class="totals_group">
<h4><?php _e( 'Order Totals', 'woocommerce' ); ?></h4>
<ul class="totals">
@ -669,22 +659,14 @@ function woocommerce_order_totals_meta_box( $post ) {
</li>
<li class="right">
<label><?php _e( 'Refund Total:', 'woocommerce' ); ?></label>
<input type="number" step="any" min="0" id="_order_refund_total" name="_order_refund_total" placeholder="0.00" value="<?php
if ( isset( $data['_refund_total'][0] ) )
echo esc_attr( $data['_refund_total'][0] );
?>" />
</li>
<li class="wide">
<label><?php _e( 'Payment Method:', 'woocommerce' ); ?></label>
<select name="_payment_method" id="_payment_method" class="first">
<option value=""><?php _e( 'N/A', 'woocommerce' ); ?></option>
<?php
$chosen_method = $data['_payment_method'][0];
$chosen_method = ! empty( $data['_payment_method'][0] ) ? $data['_payment_method'][0] : '';
$found_method = false;
if ( $woocommerce->payment_gateways ) {
if ( $woocommerce->payment_gateways() ) {
foreach ( $woocommerce->payment_gateways->payment_gateways() as $gateway ) {
if ( $gateway->enabled == "yes" ) {
echo '<option value="' . esc_attr( $gateway->id ) . '" ' . selected( $chosen_method, $gateway->id, false ) . '>' . esc_html( $gateway->get_title() ) . '</option>';
@ -707,7 +689,9 @@ function woocommerce_order_totals_meta_box( $post ) {
<div class="clear"></div>
</div>
<p class="buttons">
<button type="button" class="button calc_line_taxes"><?php _e( 'Calc taxes', 'woocommerce' ); ?></button>
<?php if ( get_option( 'woocommerce_calc_taxes' ) == 'yes' ) : ?>
<button type="button" class="button calc_line_taxes"><?php _e( 'Calc taxes', 'woocommerce' ); ?></button>
<?php endif; ?>
<button type="button" class="button calc_totals button-primary"><?php _e( 'Calc totals', 'woocommerce' ); ?></button>
</p>
<?php
@ -753,10 +737,13 @@ function woocommerce_process_shop_order_meta( $post_id, $post ) {
update_post_meta( $post_id, '_cart_discount', woocommerce_clean( $_POST['_cart_discount'] ) );
update_post_meta( $post_id, '_order_discount', woocommerce_clean( $_POST['_order_discount'] ) );
update_post_meta( $post_id, '_order_total', woocommerce_clean( $_POST['_order_total'] ) );
update_post_meta( $post_id, '_refund_total', woocommerce_clean( $_POST['_order_refund_total'] ) );
update_post_meta( $post_id, '_customer_user', absint( $_POST['customer_user'] ) );
update_post_meta( $post_id, '_order_tax', woocommerce_clean( $_POST['_order_tax'] ) );
update_post_meta( $post_id, '_order_shipping_tax', woocommerce_clean( $_POST['_order_shipping_tax'] ) );
if ( isset( $_POST['_order_tax'] ) )
update_post_meta( $post_id, '_order_tax', woocommerce_clean( $_POST['_order_tax'] ) );
if ( isset( $_POST['_order_shipping_tax'] ) )
update_post_meta( $post_id, '_order_shipping_tax', woocommerce_clean( $_POST['_order_shipping_tax'] ) );
// Shipping method handling
if ( get_post_meta( $post_id, '_shipping_method', true ) !== stripslashes( $_POST['_shipping_method'] ) ) {
@ -895,6 +882,9 @@ function woocommerce_process_shop_order_meta( $post_id, $post ) {
if ( isset( $line_tax[ $item_id ] ) )
woocommerce_update_order_item_meta( $item_id, '_line_tax', woocommerce_clean( $line_tax[ $item_id ] ) );
// Clear meta cache
wp_cache_delete( $item_id, 'order_item_meta' );
}
}
@ -902,12 +892,13 @@ function woocommerce_process_shop_order_meta( $post_id, $post ) {
$meta_keys = isset( $_POST['meta_key'] ) ? $_POST['meta_key'] : array();
$meta_values = isset( $_POST['meta_value'] ) ? $_POST['meta_value'] : array();
foreach ( $meta_keys as $id => $value ) {
foreach ( $meta_keys as $id => $meta_key ) {
$meta_value = ( empty( $meta_values[ $id ] ) && ! is_numeric( $meta_values[ $id ] ) ) ? '' : $meta_values[ $id ];
$wpdb->update(
$wpdb->prefix . "woocommerce_order_itemmeta",
array(
'meta_key' => $value,
'meta_value' => empty( $meta_values[ $id ] ) ? '' : $meta_values[ $id ]
'meta_key' => $meta_key,
'meta_value' => $meta_value
),
array( 'meta_id' => $id ),
array( '%s', '%s' ),
@ -944,15 +935,7 @@ function woocommerce_process_shop_order_meta( $post_id, $post ) {
}
}
do_action( 'woocommerce_after_resend_order_emails', $order, $resend_emails );
} elseif ( $action == 'refund_order' ) {
$order->refund_order( true );
} elseif ( $action == 'manual_refund_order' ) {
$order->refund_order( false );
do_action( 'woocommerce_after_resend_order_email', $order, $email_to_send );
} else {

View File

@ -75,12 +75,10 @@ function woocommerce_order_downloads_meta_box() {
if ( $products ) foreach ( $products as $product ) {
$sku = get_post_meta( $product->ID, '_sku', true );
$product_object = get_product( $product->ID );
$product_name = woocommerce_get_formatted_product_name( $product_object );
if ( $sku )
$sku = ' SKU: ' . $sku;
echo '<option value="' . esc_attr( $product->ID ) . '">' . esc_html( $product->post_title . ' (#' . $product->ID . '' . $sku . ')' ) . '</option>';
echo '<option value="' . esc_attr( $product->ID ) . '">' . esc_html( $product_name ) . '</option>';
}
?>
@ -124,7 +122,7 @@ function woocommerce_order_downloads_meta_box() {
} else {
alert('<?php _e( 'Could not grant access - the user may already have permission for this file.', 'woocommerce' ); ?>');
alert('<?php _e( 'Could not grant access - the user may already have permission for this file or billing email is not set. Ensure the billing email is set, and the order has been saved.', 'woocommerce' ); ?>');
}

View File

@ -67,7 +67,9 @@ function woocommerce_order_notes_meta_box() {
</div>
<script type="text/javascript">
jQuery('a.add_note').click(function(){
jQuery('#woocommerce-order-notes')
.on( 'click', 'a.add_note', function() {
if (!jQuery('textarea#add_order_note').val()) return;
@ -91,9 +93,9 @@ function woocommerce_order_notes_meta_box() {
return false;
});
})
jQuery('a.delete_note').live('click', function(){
.on( 'click', 'a.delete_note', function() {
var note = jQuery(this).closest('li.note');

View File

@ -64,7 +64,7 @@ function variable_product_type_options() {
<div class="squeezer">
<h4><?php _e( 'Before adding variations, add and save some attributes on the <strong>Attributes</strong> tab.', 'woocommerce' ); ?></h4>
<p class="submit"><a class="button-primary" href="http://www.woothemes.com/woocommerce-docs/user-guide/product-variations/" target="_blank"><?php _e( 'Learn more', 'woocommerce' ); ?></a></p>
<p class="submit"><a class="button-primary" href="http://docs.woothemes.com/document/product-variations/" target="_blank"><?php _e( 'Learn more', 'woocommerce' ); ?></a></p>
</div>
</div>
@ -74,6 +74,10 @@ function variable_product_type_options() {
<a href="#" class="close_all"><?php _e( 'Close all', 'woocommerce' ); ?></a><a href="#" class="expand_all"><?php _e( 'Expand all', 'woocommerce' ); ?></a>
<strong><?php _e( 'Bulk edit:', 'woocommerce' ); ?></strong>
<select id="field_to_edit">
<option value="toggle_enabled"><?php _e( 'Toggle &quot;Enabled&quot;', 'woocommerce' ); ?></option>
<option value="toggle_downloadable"><?php _e( 'Toggle &quot;Downloadable&quot;', 'woocommerce' ); ?></option>
<option value="toggle_virtual"><?php _e( 'Toggle &quot;Virtual&quot;', 'woocommerce' ); ?></option>
<option value="delete_all"><?php _e( 'Delete all variations', 'woocommerce' ); ?></option>
<option value="variable_regular_price"><?php _e( 'Prices', 'woocommerce' ); ?></option>
<option value="variable_sale_price"><?php _e( 'Sale prices', 'woocommerce' ); ?></option>
<option value="variable_stock"><?php _e( 'Stock', 'woocommerce' ); ?></option>
@ -84,9 +88,9 @@ function variable_product_type_options() {
<option value="variable_file_paths" rel="textarea"><?php _e( 'File Path', 'woocommerce' ); ?></option>
<option value="variable_download_limit"><?php _e( 'Download limit', 'woocommerce' ); ?></option>
<option value="variable_download_expiry"><?php _e( 'Download Expiry', 'woocommerce' ); ?></option>
<?php do_action( 'woocommerce_variable_product_bulk_edit_actions' ); ?>
</select>
<a class="button bulk_edit plus"><?php _e( 'Edit', 'woocommerce' ); ?></a>
<a class="button toggle toggle_downloadable" href="#"><?php _e( 'Downloadable', 'woocommerce' ); ?></a> <a class="button toggle toggle_virtual" href="#"><?php _e( 'Virtual', 'woocommerce' ); ?></a> <a class="button toggle toggle_enabled" href="#"><?php _e( 'Enabled', 'woocommerce' ); ?></a> <a href="#" class="button delete_variations"><?php _e( 'Delete all', 'woocommerce' ); ?></a>
<a class="button bulk_edit"><?php _e( 'Go', 'woocommerce' ); ?></a>
</p>
<div class="woocommerce_variations wc-metaboxes">
@ -131,7 +135,7 @@ function variable_product_type_options() {
$variation_id = absint( $variation->ID );
$variation_post_status = esc_attr( $variation->post_status );
$variation_data = get_post_custom( $variation_id );
$variation_data = get_post_meta( $variation_id );
$variation_data['variation_post_id'] = $variation_id;
// Grab shipping classes
@ -207,13 +211,19 @@ function variable_product_type_options() {
// Get terms for attribute taxonomy or value if its a custom attribute
if ( $attribute['is_taxonomy'] ) {
$post_terms = wp_get_post_terms( $post->ID, $attribute['name'] );
foreach ( $post_terms as $term )
echo '<option ' . selected( $variation_selected_value, $term->slug, false ) . ' value="' . esc_attr( $term->slug ) . '">' . esc_html( $term->name ) . '</option>';
echo '<option ' . selected( $variation_selected_value, $term->slug, false ) . ' value="' . esc_attr( $term->slug ) . '">' . apply_filters( 'woocommerce_variation_option_name', esc_html( $term->name ) ) . '</option>';
} else {
$options = explode( '|', $attribute['value'] );
$options = array_map( 'trim', explode( '|', $attribute['value'] ) );
foreach ( $options as $option )
echo '<option ' . selected( $variation_selected_value, $option, false ) . ' value="' . esc_attr( $option ) . '">' . ucfirst( esc_html( $option ) ) . '</option>';
echo '<option ' . selected( sanitize_title( $variation_selected_value ), sanitize_title( $option ), false ) . ' value="' . esc_attr( sanitize_title( $option ) ) . '">' . esc_html( apply_filters( 'woocommerce_variation_option_name', $option ) ) . '</option>';
}
echo '</select>';
@ -231,6 +241,25 @@ function variable_product_type_options() {
?>
jQuery(function(){
var variation_sortable_options = {
items:'.woocommerce_variation',
cursor:'move',
axis:'y',
handle: 'h3',
scrollSensitivity:40,
forcePlaceholderSize: true,
helper: 'clone',
opacity: 0.65,
placeholder: 'wc-metabox-sortable-placeholder',
start:function(event,ui){
ui.item.css('background-color','#f6f6f6');
},
stop:function(event,ui){
ui.item.removeAttr('style');
variation_row_indexes();
}
};
// Add a variation
jQuery('#variable_product_options').on('click', 'button.add_variation', function(){
@ -258,7 +287,7 @@ function variable_product_type_options() {
jQuery('input.variable_is_downloadable, input.variable_is_virtual').change();
jQuery('.woocommerce_variations').unblock();
jQuery('#variable_product_options').trigger('woocommerce_variations_added');
});
return false;
@ -298,6 +327,7 @@ function variable_product_type_options() {
$('#variable_product_options').load( this_page + ' #variable_product_options_inner', function() {
$('#variable_product_options').unblock();
jQuery('#variable_product_options').trigger('woocommerce_variations_added');
} );
} else {
$('#variable_product_options').unblock();
@ -344,71 +374,73 @@ function variable_product_type_options() {
return false;
});
jQuery('#variable_product_options').on('click', 'a.delete_variations', function(){
var answer = confirm('<?php _e( 'Are you sure you want to delete all variations? This cannot be undone.', 'woocommerce' ); ?>');
if (answer){
jQuery('.wc-metaboxes-wrapper').on('click', 'a.bulk_edit', function(event){
var field_to_edit = jQuery('select#field_to_edit').val();
var answer = confirm('<?php _e( 'Last warning, are you sure?', 'woocommerce' ); ?>');
if ( field_to_edit == 'toggle_enabled' ) {
var checkbox = jQuery('input[name^="variable_enabled"]');
checkbox.attr('checked', !checkbox.attr('checked'));
return false;
}
else if ( field_to_edit == 'toggle_downloadable' ) {
var checkbox = jQuery('input[name^="variable_is_downloadable"]');
checkbox.attr('checked', !checkbox.attr('checked'));
jQuery('input.variable_is_downloadable').change();
return false;
}
else if ( field_to_edit == 'toggle_virtual' ) {
var checkbox = jQuery('input[name^="variable_is_virtual"]');
checkbox.attr('checked', !checkbox.attr('checked'));
jQuery('input.variable_is_virtual').change();
return false;
}
else if ( field_to_edit == 'delete_all' ) {
if (answer) {
var answer = confirm('<?php _e( 'Are you sure you want to delete all variations? This cannot be undone.', 'woocommerce' ); ?>');
if (answer){
var variation_ids = [];
var answer = confirm('<?php _e( 'Last warning, are you sure?', 'woocommerce' ); ?>');
jQuery('.woocommerce_variations .woocommerce_variation').block({ message: null, overlayCSS: { background: '#fff url(<?php echo $woocommerce->plugin_url(); ?>/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } });
if (answer) {
jQuery('.woocommerce_variations .woocommerce_variation .remove_variation').each(function(){
var variation_ids = [];
var variation = jQuery(this).attr('rel');
if (variation>0) {
variation_ids.push(variation);
}
});
jQuery('.woocommerce_variations .woocommerce_variation').block({ message: null, overlayCSS: { background: '#fff url(<?php echo $woocommerce->plugin_url(); ?>/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } });
var data = {
action: 'woocommerce_remove_variations',
variation_ids: variation_ids,
security: '<?php echo wp_create_nonce("delete-variations"); ?>'
};
jQuery('.woocommerce_variations .woocommerce_variation .remove_variation').each(function(){
jQuery.post('<?php echo admin_url('admin-ajax.php'); ?>', data, function(response) {
jQuery('.woocommerce_variations .woocommerce_variation').fadeOut('300', function(){
jQuery('.woocommerce_variations .woocommerce_variation').remove();
var variation = jQuery(this).attr('rel');
if (variation>0) {
variation_ids.push(variation);
}
});
});
var data = {
action: 'woocommerce_remove_variations',
variation_ids: variation_ids,
security: '<?php echo wp_create_nonce("delete-variations"); ?>'
};
jQuery.post('<?php echo admin_url('admin-ajax.php'); ?>', data, function(response) {
jQuery('.woocommerce_variations .woocommerce_variation').fadeOut('300', function(){
jQuery('.woocommerce_variations .woocommerce_variation').remove();
});
});
}
}
return false;
}
else {
var input_tag = jQuery('select#field_to_edit :selected').attr('rel') ? jQuery('select#field_to_edit :selected').attr('rel') : 'input';
var value = prompt("<?php _e( 'Enter a value', 'woocommerce' ); ?>");
jQuery(input_tag + '[name^="' + field_to_edit + '["]').val( value ).change();
return false;
}
return false;
});
jQuery('a.bulk_edit').click(function() {
var field_to_edit = jQuery('select#field_to_edit').val();
var input_tag = jQuery('select#field_to_edit :selected').attr('rel') ? jQuery('select#field_to_edit :selected').attr('rel') : 'input';
var value = prompt("<?php _e( 'Enter a value', 'woocommerce' ); ?>");
jQuery(input_tag + '[name^="' + field_to_edit + '"]').val( value );
return false;
});
jQuery('a.toggle_virtual').click(function(){
var checkbox = jQuery('input[name^="variable_is_virtual"]');
checkbox.attr('checked', !checkbox.attr('checked'));
jQuery('input.variable_is_virtual').change();
return false;
});
jQuery('a.toggle_downloadable').click(function(){
var checkbox = jQuery('input[name^="variable_is_downloadable"]');
checkbox.attr('checked', !checkbox.attr('checked'));
jQuery('input.variable_is_downloadable').change();
return false;
});
jQuery('a.toggle_enabled').click(function(){
var checkbox = jQuery('input[name^="variable_enabled"]');
checkbox.attr('checked', !checkbox.attr('checked'));
return false;
});
jQuery('#variable_product_options').on('change', 'input.variable_is_downloadable', function(){
@ -434,24 +466,11 @@ function variable_product_type_options() {
jQuery('input.variable_is_downloadable, input.variable_is_virtual').change();
// Ordering
$('.woocommerce_variations').sortable({
items:'.woocommerce_variation',
cursor:'move',
axis:'y',
handle: 'h3',
scrollSensitivity:40,
forcePlaceholderSize: true,
helper: 'clone',
opacity: 0.65,
placeholder: 'wc-metabox-sortable-placeholder',
start:function(event,ui){
ui.item.css('background-color','#f6f6f6');
},
stop:function(event,ui){
ui.item.removeAttr('style');
variation_row_indexes();
}
});
$('#variable_product_options').on( 'woocommerce_variations_added', function() {
$('.woocommerce_variations').sortable( variation_sortable_options );
} );
$('.woocommerce_variations').sortable( variation_sortable_options );
function variation_row_indexes() {
$('.woocommerce_variations .woocommerce_variation').each(function(index, el){
@ -459,53 +478,69 @@ function variable_product_type_options() {
});
};
var current_field_wrapper;
// Uploader
var variable_image_frame;
var setting_variation_image_id;
var setting_variation_image;
var wp_media_post_id = wp.media.model.settings.post.id;
window.send_to_editor_default = window.send_to_editor;
jQuery('#variable_product_options').on('click', '.upload_image_button', function( event ) {
jQuery('#variable_product_options').on('click', '.upload_image_button', function(){
var $button = jQuery( this );
var post_id = $button.attr('rel');
var $parent = $button.closest('.upload_image');
setting_variation_image = $parent;
setting_variation_image_id = post_id;
var post_id = jQuery(this).attr('rel');
var parent = jQuery(this).parent();
current_field_wrapper = parent;
event.preventDefault();
if (jQuery(this).is('.remove')) {
if ( $button.is('.remove') ) {
jQuery('.upload_image_id', current_field_wrapper).val('');
jQuery('img', current_field_wrapper).attr('src', '<?php echo woocommerce_placeholder_img_src(); ?>');
jQuery(this).removeClass('remove');
setting_variation_image.find( '.upload_image_id' ).val( '' );
setting_variation_image.find( 'img' ).attr( 'src', '<?php echo woocommerce_placeholder_img_src(); ?>' );
setting_variation_image.find( '.upload_image_button' ).removeClass( 'remove' );
} else {
window.send_to_editor = window.send_to_cproduct;
formfield = jQuery('.upload_image_id', parent).attr('name');
tb_show('', 'media-upload.php?post_id=' + post_id + '&amp;type=image&amp;TB_iframe=true');
// If the media frame already exists, reopen it.
if ( variable_image_frame ) {
variable_image_frame.uploader.uploader.param( 'post_id', setting_variation_image_id );
variable_image_frame.open();
return;
} else {
wp.media.model.settings.post.id = setting_variation_image_id;
}
// Create the media frame.
variable_image_frame = wp.media.frames.variable_image = wp.media({
// Set the title of the modal.
title: '<?php _e( 'Choose an image', 'woocommerce' ); ?>',
button: {
text: '<?php _e( 'Set variation image', 'woocommerce' ); ?>'
}
});
// When an image is selected, run a callback.
variable_image_frame.on( 'select', function() {
attachment = variable_image_frame.state().get('selection').first().toJSON();
setting_variation_image.find( '.upload_image_id' ).val( attachment.id );
setting_variation_image.find( '.upload_image_button' ).addClass( 'remove' );
setting_variation_image.find( 'img' ).attr( 'src', attachment.url );
wp.media.model.settings.post.id = wp_media_post_id;
});
// Finally, open the modal.
variable_image_frame.open();
}
return false;
});
window.send_to_cproduct = function(html) {
jQuery('body').append('<div id="temp_image">' + html + '</div>');
var img = jQuery('#temp_image').find('img');
imgurl = img.attr('src');
imgclass = img.attr('class');
imgid = parseInt(imgclass.replace(/\D/g, ''), 10);
jQuery('.upload_image_id', current_field_wrapper).val(imgid);
jQuery('.upload_image_button', current_field_wrapper).addClass('remove');
jQuery('img', current_field_wrapper).attr('src', imgurl);
tb_remove();
jQuery('#temp_image').remove();
window.send_to_editor = window.send_to_editor_default;
}
// Restore ID
jQuery('a.add_media').on('click', function() {
wp.media.model.settings.post.id = wp_media_post_id;
} );
});
<?php
@ -661,7 +696,7 @@ function process_product_meta_variable( $post_id ) {
else
update_post_meta( $variation_id, '_price', $regular_price );
if ( $date_from && strtotime( $date_from ) < strtotime( 'NOW', current_time( 'timestamp' ) ) )
if ( $sale_price != '' && $date_from && strtotime( $date_from ) < strtotime( 'NOW', current_time( 'timestamp' ) ) )
update_post_meta( $variation_id, '_price', $sale_price );
if ( $date_to && strtotime( $date_to ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) {
@ -686,7 +721,7 @@ function process_product_meta_variable( $post_id ) {
$file_paths = explode( "\n", $file_paths );
foreach ( $file_paths as $file_path ) {
$file_path = woocommerce_clean( $file_path );
$file_path = trim( $file_path );
$_file_paths[ md5( $file_path ) ] = $file_path;
}
}
@ -702,19 +737,22 @@ function process_product_meta_variable( $post_id ) {
}
// Save shipping class
$variable_shipping_class[ $i ] = ( $variable_shipping_class[ $i ] ) ? (int) $variable_shipping_class[ $i ] : '';
$variable_shipping_class[ $i ] = $variable_shipping_class[ $i ] > 0 ? (int) $variable_shipping_class[ $i ] : '';
wp_set_object_terms( $variation_id, $variable_shipping_class[ $i ], 'product_shipping_class');
// Remove old taxonomies attributes so data is kept up to date
if ( $variation_id )
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key LIKE %s AND post_id = %d;", 'attribute_%', $variation_id ) );
if ( $variation_id ) {
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE 'attribute_%%' AND post_id = %d;", $variation_id ) );
wp_cache_delete( $variation_id, 'post_meta');
}
// Update taxonomies
foreach ( $attributes as $attribute ) {
if ( $attribute['is_variation'] ) {
$value = woocommerce_clean( $_POST[ 'attribute_' . sanitize_title( $attribute['name'] ) ][ $i ] );
// Don't use woocommerce_clean as it destroys sanitized characters
$value = sanitize_title( trim( stripslashes( $_POST[ 'attribute_' . sanitize_title( $attribute['name'] ) ][ $i ] ) ) );
update_post_meta( $variation_id, 'attribute_' . sanitize_title( $attribute['name'] ), $value );
}
@ -781,7 +819,10 @@ function process_product_meta_variable( $post_id ) {
foreach ( $attributes as $attribute ) {
if ( $attribute['is_variation'] ) {
$value = woocommerce_clean( $_POST[ 'default_attribute_' . sanitize_title( $attribute['name'] ) ] );
// Don't use woocommerce_clean as it destroys sanitized characters
$value = sanitize_title( trim( stripslashes( $_POST[ 'default_attribute_' . sanitize_title( $attribute['name'] ) ] ) ) );
if ( $value )
$default_attributes[ sanitize_title( $attribute['name'] ) ] = $value;
}

View File

@ -30,7 +30,7 @@ function woocommerce_product_data_box() {
$thepostid = $post->ID;
if ( $terms = wp_get_object_terms( $post->ID, 'product_type' ) )
$product_type = current( $terms )->slug;
$product_type = sanitize_title( current( $terms )->name );
else
$product_type = 'simple';
@ -151,7 +151,7 @@ function woocommerce_product_data_box() {
echo '<p class="form-field"><label for="_file_paths">' . __( 'File paths (one per line)', 'woocommerce' ) . ':</label>
<textarea style="float:left;height:5em;" id="_file_paths" class="short file_paths" cols="20" rows="3" placeholder="' . __( 'File paths/URLs, one per line', 'woocommerce' ) . '" name="_file_paths" wrap="off">' . esc_textarea( $file_paths ) . '</textarea>
<input type="button" class="upload_file_button button" value="' . __( 'Upload a file', 'woocommerce' ) . '" />
<input type="button" class="upload_file_button button" data-choose="' . __( 'Choose a file', 'woocommerce' ) . '" data-update="' . __( 'Insert file URL', 'woocommerce' ) . '" value="' . __( 'Choose a file', 'woocommerce' ) . '" />
</p>';
// Download Limit
@ -170,27 +170,31 @@ function woocommerce_product_data_box() {
echo '</div>';
echo '<div class="options_group show_if_simple show_if_external show_if_variable">';
if ( get_option( 'woocommerce_calc_taxes' ) == 'yes' ) {
// Tax
woocommerce_wp_select( array( 'id' => '_tax_status', 'label' => __( 'Tax Status', 'woocommerce' ), 'options' => array(
'taxable' => __( 'Taxable', 'woocommerce' ),
'shipping' => __( 'Shipping only', 'woocommerce' ),
'none' => __( 'None', 'woocommerce' )
) ) );
echo '<div class="options_group show_if_simple show_if_external show_if_variable">';
$tax_classes = array_filter( array_map( 'trim', explode( "\n", get_option( 'woocommerce_tax_classes' ) ) ) );
$classes_options = array();
$classes_options[''] = __( 'Standard', 'woocommerce' );
if ( $tax_classes )
foreach ( $tax_classes as $class )
$classes_options[ sanitize_title( $class ) ] = esc_html( $class );
// Tax
woocommerce_wp_select( array( 'id' => '_tax_status', 'label' => __( 'Tax Status', 'woocommerce' ), 'options' => array(
'taxable' => __( 'Taxable', 'woocommerce' ),
'shipping' => __( 'Shipping only', 'woocommerce' ),
'none' => __( 'None', 'woocommerce' )
) ) );
woocommerce_wp_select( array( 'id' => '_tax_class', 'label' => __( 'Tax Class', 'woocommerce' ), 'options' => $classes_options ) );
$tax_classes = array_filter( array_map( 'trim', explode( "\n", get_option( 'woocommerce_tax_classes' ) ) ) );
$classes_options = array();
$classes_options[''] = __( 'Standard', 'woocommerce' );
if ( $tax_classes )
foreach ( $tax_classes as $class )
$classes_options[ sanitize_title( $class ) ] = esc_html( $class );
do_action( 'woocommerce_product_options_tax' );
woocommerce_wp_select( array( 'id' => '_tax_class', 'label' => __( 'Tax Class', 'woocommerce' ), 'options' => $classes_options ) );
echo '</div>';
do_action( 'woocommerce_product_options_tax' );
echo '</div>';
}
do_action( 'woocommerce_product_options_general_product_data' );
?>
@ -205,7 +209,7 @@ function woocommerce_product_data_box() {
if (get_option('woocommerce_manage_stock')=='yes') {
// manage stock
woocommerce_wp_checkbox( array( 'id' => '_manage_stock', 'wrapper_class' => 'show_if_simple show_if_variable', 'label' => __('Manage stock?', 'woocommerce' ) ) );
woocommerce_wp_checkbox( array( 'id' => '_manage_stock', 'wrapper_class' => 'show_if_simple show_if_variable', 'label' => __('Manage stock?', 'woocommerce' ), 'description' => __( 'Enable stock management at product level', 'woocommerce' ) ) );
do_action('woocommerce_product_options_stock');
@ -277,7 +281,7 @@ function woocommerce_product_data_box() {
// Size fields
if( get_option( 'woocommerce_enable_dimensions', true ) !== 'no' ) :
?><p class="form-field dimensions_field">
<label for"product_length"><?php echo __( 'Dimensions', 'woocommerce' ) . ' (' . get_option( 'woocommerce_dimension_unit' ) . ')'; ?></label>
<label for="product_length"><?php echo __( 'Dimensions', 'woocommerce' ) . ' (' . get_option( 'woocommerce_dimension_unit' ) . ')'; ?></label>
<span class="wrap">
<input id="product_length" placeholder="<?php _e( 'Length', 'woocommerce' ); ?>" class="input-text" size="6" type="number" name="_length" value="<?php echo esc_attr( get_post_meta( $thepostid, '_length', true ) ); ?>" step="any" min="0" />
<input placeholder="<?php _e( 'Width', 'woocommerce' ); ?>" class="input-text" size="6" type="number" name="_width" value="<?php echo esc_attr( get_post_meta( $thepostid, '_width', true ) ); ?>" step="any" min="0" />
@ -328,8 +332,11 @@ function woocommerce_product_data_box() {
<div class="woocommerce_attributes wc-metaboxes">
<?php
$attribute_taxonomies = $woocommerce->get_attribute_taxonomies(); // Array of defined attribute taxonomies
$attributes = maybe_unserialize( get_post_meta( $thepostid, '_product_attributes', true ) ); // Product attributes - taxonomies and custom, ordered, with visibility and variation attributes set
// Array of defined attribute taxonomies
$attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
// Product attributes - taxonomies and custom, ordered, with visibility and variation attributes set
$attributes = maybe_unserialize( get_post_meta( $thepostid, '_product_attributes', true ) );
$i = -1;
@ -380,7 +387,7 @@ function woocommerce_product_data_box() {
$all_terms = get_terms( $attribute_taxonomy_name, 'orderby=name&hide_empty=0' );
if ( $all_terms ) {
foreach ( $all_terms as $term ) {
$has_term = has_term( $term->slug, $attribute_taxonomy_name, $thepostid ) ? 1 : 0;
$has_term = has_term( $term->term_id, $attribute_taxonomy_name, $thepostid ) ? 1 : 0;
echo '<option value="' . $term->slug . '" ' . selected( $has_term, 1, false ) . '>' . $term->name . '</option>';
}
}
@ -399,22 +406,37 @@ function woocommerce_product_data_box() {
$values = array();
foreach ( $post_terms as $term )
$values[] = $term->name;
echo implode( '|', $values );
echo implode( ' | ', $values );
}
?>" placeholder="<?php _e( 'Pipe separate terms', 'woocommerce' ); ?>" />
?>" placeholder="<?php _e( 'Pipe (|) separate terms', 'woocommerce' ); ?>" />
<?php endif; ?>
<?php do_action( 'woocommerce_product_option_terms', $tax, $i ); ?>
</td>
</tr>
<tr>
<td>
<label><input type="checkbox" class="checkbox" <?php if ( ! empty( $attribute['is_visible'] ) ) checked( $attribute['is_visible'], 1 ); ?> name="attribute_visibility[<?php echo $i; ?>]" value="1" /> <?php _e( 'Visible on the product page', 'woocommerce' ); ?></label>
<label><input type="checkbox" class="checkbox" <?php
if ( isset( $attribute['is_visible'] ) )
checked( $attribute['is_visible'], 1 );
else
checked( apply_filters( 'default_attribute_visibility', false, $tax ), true );
?> name="attribute_visibility[<?php echo $i; ?>]" value="1" /> <?php _e( 'Visible on the product page', 'woocommerce' ); ?></label>
</td>
</tr>
<tr>
<td>
<div class="enable_variation show_if_variable">
<label><input type="checkbox" class="checkbox" <?php if ( ! empty( $attribute['is_variation'] ) ) checked( $attribute['is_variation'], 1 ); ?> name="attribute_variation[<?php echo $i; ?>]" value="1" /> <?php _e( 'Used for variations', 'woocommerce' ); ?></label>
<label><input type="checkbox" class="checkbox" <?php
if ( isset( $attribute['is_variation'] ) )
checked( $attribute['is_variation'], 1 );
else
checked( apply_filters( 'default_attribute_variation', false, $tax ), true );
?> name="attribute_variation[<?php echo $i; ?>]" value="1" /> <?php _e( 'Used for variations', 'woocommerce' ); ?></label>
</div>
</td>
</tr>
@ -427,7 +449,8 @@ function woocommerce_product_data_box() {
// Custom Attributes
if ( ! empty( $attributes ) ) foreach ( $attributes as $attribute ) {
if ( $attribute['is_taxonomy'] ) continue;
if ( $attribute['is_taxonomy'] )
continue;
$i++;
@ -498,19 +521,15 @@ function woocommerce_product_data_box() {
<p class="form-field"><label for="upsell_ids"><?php _e( 'Up-Sells', 'woocommerce' ); ?></label>
<select id="upsell_ids" name="upsell_ids[]" class="ajax_chosen_select_products" multiple="multiple" data-placeholder="<?php _e( 'Search for a product&hellip;', 'woocommerce' ); ?>">
<?php
$product_ids = array_map( 'absint', get_post_meta( $post->ID, '_upsell_ids', true ) );
$upsell_ids = get_post_meta( $post->ID, '_upsell_ids', true );
$product_ids = ! empty( $upsell_ids ) ? array_map( 'absint', $upsell_ids ) : null;
if ( $product_ids ) {
foreach ( $product_ids as $product_id ) {
$title = get_the_title( $product_id );
$sku = get_post_meta( $product_id, '_sku', true );
if ( ! $title )
continue;
$product = get_product( $product_id );
$product_name = woocommerce_get_formatted_product_name( $product );
if ( ! empty( $sku ) )
$sku = ' (SKU: ' . $sku . ')';
echo '<option value="' . esc_attr( $product_id ) . '" selected="selected">' . esc_html( $title . $sku ) . '</option>';
echo '<option value="' . esc_attr( $product_id ) . '" selected="selected">' . esc_html( $product_name ) . '</option>';
}
}
?>
@ -519,19 +538,15 @@ function woocommerce_product_data_box() {
<p class="form-field"><label for="crosssell_ids"><?php _e( 'Cross-Sells', 'woocommerce' ); ?></label>
<select id="crosssell_ids" name="crosssell_ids[]" class="ajax_chosen_select_products" multiple="multiple" data-placeholder="<?php _e( 'Search for a product&hellip;', 'woocommerce' ); ?>">
<?php
$product_ids = array_map( 'absint', get_post_meta( $post->ID, '_crosssell_ids', true ) );
$crosssell_ids = get_post_meta( $post->ID, '_crosssell_ids', true );
$product_ids = ! empty( $crosssell_ids ) ? array_map( 'absint', $crosssell_ids ) : null;
if ( $product_ids ) {
foreach ( $product_ids as $product_id ) {
$title = get_the_title( $product_id );
$sku = get_post_meta( $product_id, '_sku', true );
if ( ! $title )
continue;
$product = get_product( $product_id );
$product_name = woocommerce_get_formatted_product_name( $product );
if ( ! empty( $sku ) )
$sku = ' (SKU: ' . $sku . ')';
echo '<option value="' . esc_attr( $product_id ) . '" selected="selected">' . esc_html( $title . $sku ) . '</option>';
echo '<option value="' . esc_attr( $product_id ) . '" selected="selected">' . esc_html( $product_name ) . '</option>';
}
}
?>
@ -648,8 +663,9 @@ function woocommerce_process_product_meta( $post_id, $post ) {
update_post_meta( $post_id, '_downloadable', $is_downloadable );
update_post_meta( $post_id, '_virtual', $is_virtual );
// Set transient for product type
set_transient( 'wc_product_type_' . $post_id, $product_type );
// Gallery Images
$attachment_ids = array_filter( explode( ',', woocommerce_clean( $_POST['product_image_gallery'] ) ) );
update_post_meta( $post_id, '_product_image_gallery', implode( ',', $attachment_ids ) );
// Update post meta
update_post_meta( $post_id, '_regular_price', stripslashes( $_POST['_regular_price'] ) );
@ -735,12 +751,10 @@ function woocommerce_process_product_meta( $post_id, $post ) {
// Format values
if ( is_array( $attribute_values[ $i ] ) ) {
$values = array_map('htmlspecialchars', array_map('stripslashes', $attribute_values[ $i ]));
$values = array_map( 'woocommerce_clean', $attribute_values[ $i ] );
} else {
// Text based, separate by pipe
$values = htmlspecialchars( stripslashes( $attribute_values[ $i ] ) );
$values = explode( '|', $values );
$values = array_map( 'trim', $values );
$values = array_map( 'woocommerce_clean', explode( '|', $attribute_values[ $i ] ) );
}
// Remove empty items in the array
@ -757,7 +771,7 @@ function woocommerce_process_product_meta( $post_id, $post ) {
if ( $values ) {
// Add attribute to array, but don't set values
$attributes[ sanitize_title( $attribute_names[ $i ] ) ] = array(
'name' => htmlspecialchars( stripslashes( $attribute_names[ $i ] ) ),
'name' => woocommerce_clean( $attribute_names[ $i ] ),
'value' => '',
'position' => $attribute_position[ $i ],
'is_visible' => $is_visible,
@ -766,18 +780,14 @@ function woocommerce_process_product_meta( $post_id, $post ) {
);
}
} else {
if ( ! $attribute_values[ $i ] ) continue;
// Format values
$values = esc_html( stripslashes( $attribute_values[ $i ] ) );
} elseif ( isset( $attribute_values[ $i ] ) ) {
// Text based, separate by pipe
$values = explode( '|', $values );
$values = array_map( 'trim', $values );
$values = implode( '|', $values );
$values = implode( ' | ', array_map( 'woocommerce_clean', explode( '|', $attribute_values[ $i ] ) ) );
// Custom attribute - Add attribute to array and set the values
$attributes[ sanitize_title( $attribute_names[ $i ] ) ] = array(
'name' => htmlspecialchars( stripslashes( $attribute_names[ $i ] ) ),
'name' => woocommerce_clean( $attribute_names[ $i ] ),
'value' => $values,
'position' => $attribute_position[ $i ],
'is_visible' => $is_visible,
@ -1015,29 +1025,6 @@ function woocommerce_process_product_meta( $post_id, $post ) {
add_action('woocommerce_process_product_meta', 'woocommerce_process_product_meta', 1, 2);
/**
* Change label for insert buttons.
*
* @access public
* @param mixed $translation
* @param mixed $original
* @return void
*/
function woocommerce_change_insert_into_post( $translation, $original ) {
if ( ! isset( $_REQUEST['from'] ) )
return $translation;
$original = strtolower( $original );
if ( $_REQUEST['from'] == 'wc01' && ( $original == 'insert into post' || $original == 'use this image' ) )
return __( 'Use this file', 'woocommerce' );
return $translation;
}
add_filter( 'gettext', 'woocommerce_change_insert_into_post', null, 2 );
/**
* Output product visibility options.
*
@ -1073,7 +1060,7 @@ function woocommerce_product_data_visibility() {
<div id="catalog-visibility-select" class="hide-if-js">
<input type="hidden" name="current_visibilty" id="current_visibilty" value="<?php echo esc_attr( $current_visibility ); ?>" />
<input type="hidden" name="current_visibility" id="current_visibility" value="<?php echo esc_attr( $current_visibility ); ?>" />
<input type="hidden" name="current_featured" id="current_featured" value="<?php echo esc_attr( $current_featured ); ?>" />
<?php
@ -1098,4 +1085,4 @@ function woocommerce_product_data_visibility() {
<?php
}
add_action( 'post_submitbox_misc_actions', 'woocommerce_product_data_visibility' );
add_action( 'post_submitbox_misc_actions', 'woocommerce_product_data_visibility' );

View File

@ -24,259 +24,138 @@ function woocommerce_product_images_box() {
<div id="product_images_container">
<ul class="product_images">
<?php
$thumbnail_id = get_post_thumbnail_id( $post->ID );
if ( $thumbnail_id )
echo '<li class="image" data-post_id="' . $thumbnail_id . '">
' . wp_get_attachment_image( $thumbnail_id, 'full' ) . '
<span class="loading"></span>
<ul class="actions">
<li><a href="#" class="delete">' . __( 'Delete', 'woocommerce' ) . '</a></li>
<li><a href="' . admin_url( 'media-upload.php?post_id=' . $post->ID . '&attachment_id=' . $thumbnail_id . '&tab=library&width=640&height=553&TB_iframe=1' ) . '" class="view thickbox" onclick="return false;">' . __( 'View', 'woocommerce' ) . '</a></li>
</ul>
</li>';
$attachments =& get_children( 'post_parent=' . $post->ID . '&numberposts=-1&post_type=attachment&orderby=menu_order&order=ASC&post_mime_type=image' );
foreach ( $attachments as $attachment_id => $attachment ) {
if ( $thumbnail_id == $attachment_id )
continue;
$exclude_class = get_post_meta( $attachment_id, '_woocommerce_exclude_image', true ) == 1 ? 'excluded' : '';
echo '<li class="image ' . $exclude_class . '" data-post_id="' . $attachment_id . '">
' . wp_get_attachment_image( $attachment_id, 'full' ) . '
<span class="loading"></span>
<ul class="actions">
<li><a href="#" class="delete">' . __( 'Delete', 'woocommerce' ) . '</a></li>
<li><a href="' . admin_url( 'media-upload.php?post_id=' . $post->ID . '&attachment_id=' . $attachment_id . '&tab=library&width=640&height=553&TB_iframe=1' ) . '" class="view thickbox" onclick="return false;">' . __( 'View', 'woocommerce' ) . '</a></li>
</ul>
</li>';
if ( metadata_exists( 'post', $post->ID, '_product_image_gallery' ) ) {
$product_image_gallery = get_post_meta( $post->ID, '_product_image_gallery', true );
} else {
// Backwards compat
$attachment_ids = array_filter( array_diff( get_posts( 'post_parent=' . $post->ID . '&numberposts=-1&post_type=attachment&orderby=menu_order&order=ASC&post_mime_type=image&fields=ids' ), array( get_post_thumbnail_id() ) ) );
$product_image_gallery = implode( ',', $attachment_ids );
}
$attachments = array_filter( explode( ',', $product_image_gallery ) );
if ( $attachments )
foreach ( $attachments as $attachment_id ) {
echo '<li class="image" data-attachment_id="' . $attachment_id . '">
' . wp_get_attachment_image( $attachment_id, 'full' ) . '
<ul class="actions">
<li><a href="#" class="delete" title="' . __( 'Delete image', 'woocommerce' ) . '">' . __( 'Delete', 'woocommerce' ) . '</a></li>
</ul>
</li>';
}
?>
</ul>
</div>
<!-- Uploader section -->
<div id="plupload-upload-ui" class="hide-if-no-js">
<div id="drag-drop-area">
<p class="drag-drop-info"><?php _e('Drop files here'); ?></p>
<p><?php _ex('or', 'Uploader: Drop files here - or - Select Files'); ?></p>
<p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php esc_attr_e('Select Files'); ?>" class="button" /></p>
</div>
</div>
<?php
// Drag and drop code adapted from Drag & Drop Featured Image by Jonathan Lundström
$plupload_init = array(
'runtimes' => 'html5,silverlight,flash,html4',
'browse_button' => 'plupload-browse-button',
'container' => 'plupload-upload-ui',
'drop_element' => 'drag-drop-area',
'file_data_name' => 'async-upload',
'multiple_queues' => true,
'max_file_size' => wp_max_upload_size() . 'b',
'url' => admin_url('admin-ajax.php'),
'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
'filters' => array( array( 'title' => __( 'Allowed Files' ), 'extensions' => '*') ),
'multipart' => true,
'urlstream_upload' => true,
'multipart_params' => array(
'_ajax_nonce' => wp_create_nonce( 'product-images-box-upload' ),
'action' => 'woocommerce_product_images_box_upload',
'post_id' => $post->ID
)
);
<input type="hidden" id="product_image_gallery" name="product_image_gallery" value="<?php echo esc_attr( $product_image_gallery ); ?>" />
// Apply filters to initiate plupload:
$plupload_init = apply_filters( 'plupload_init', $plupload_init );
?>
</div>
<p class="add_product_images hide-if-no-js">
<a href="#"><?php _e( 'Add product gallery images', 'woocommerce' ); ?></a>
</p>
<script type="text/javascript">
jQuery(document).ready(function($){
function product_images_container_init() {
// Attribute ordering
$('#product_images_container ul.product_images').sortable({
items: 'li.image',
cursor: 'move',
scrollSensitivity:40,
forcePlaceholderSize: true,
forceHelperSize: false,
helper: 'clone',
opacity: 0.65,
placeholder: 'wc-metabox-sortable-placeholder',
start:function(event,ui){
ui.item.css('background-color','#f6f6f6');
},
stop:function(event,ui){
ui.item.removeAttr('style');
},
update: function(event, ui) {
$('#product_images_container ul li.image').css('cursor','default');
$('#product_images_container ul.product_images').sortable('disable');
// Uploading files
var product_gallery_frame;
var $image_gallery_ids = $('#product_image_gallery');
var $product_images = $('#product_images_container ul.product_images');
var post_id = <?php echo $post->ID; ?>;
var attachment_id = ui.item.attr( 'data-post_id' );
var prev_attachment_id = ui.item.prev().attr( 'data-post_id' );
var next_attachment_id = ui.item.next().attr( 'data-post_id' );
jQuery('.add_product_images').on( 'click', 'a', function( event ) {
// show spinner
ui.item.addClass('loading');
var $el = $(this);
var attachment_ids = $image_gallery_ids.val();
// go do the sorting stuff via ajax
jQuery.post( ajaxurl, {
action: 'woocommerce_product_image_ordering',
post_id: post_id,
attachment_id: attachment_id,
prev_attachment_id: prev_attachment_id,
next_attachment_id: next_attachment_id,
_ajax_nonce: '<?php echo wp_create_nonce( 'product-image-ordering' ); ?>'
}, function( response ) {
ui.item.removeClass('loading');
$('#product_images_container ul li.image').css('cursor','move');
$('#product_images_container ul.product_images').sortable('enable');
}
);
}
});
}
event.preventDefault();
product_images_container_init();
// Delete images
$('#product_images_container').on( 'click', 'a.delete', function() {
$image = $(this).closest('li.image');
var attachment_id = $image.attr('data-post_id');
if ( attachment_id ) {
$image.addClass('loading');
var answer = confirm('<?php _e( 'Are you sure you want to remove this attachment?', 'woocommerce' ); ?>');
if ( answer ) {
jQuery.post( ajaxurl, {
action: 'woocommerce_product_image_delete',
post_id: <?php echo $post->ID; ?>,
attachment_id: attachment_id,
_ajax_nonce: '<?php echo wp_create_nonce( 'product-image-delete' ); ?>'
}, function( response ) {
$image.remove();
}
);
} else {
$image.removeClass('loading');
}
}
return false;
} );
// Drag and drop uploading of images
var uploader = new plupload.Uploader(<?php echo json_encode( $plupload_init ); ?>);
// Check for drag'n'drop functionality:
uploader.bind('Init', function(up){
var uploaddiv = $('#plupload-upload-ui');
// Add classes and bind actions:
if(up.features.dragdrop){
uploaddiv.addClass('drag-drop');
$('#drag-drop-area')
.bind('dragover.wp-uploader', function() { uploaddiv.addClass('drag-over'); })
.bind('dragleave.wp-uploader, drop.wp-uploader', function(){ uploaddiv.removeClass('drag-over'); });
} else{
uploaddiv.removeClass('drag-drop');
$('#drag-drop-area').unbind('.wp-uploader');
}
});
// Initiate uploading script:
uploader.init();
// File queue handler
uploader.bind('FilesAdded', function(up, files){
var hundredmb = 100 * 1024 * 1024, max = parseInt(up.settings.max_file_size, 10);
// Loop through files:
plupload.each(files, function(file){
if ( max > hundredmb && file.size > hundredmb && up.runtime != 'html5' ) {
alert( "<?php _e( 'The file you selected exceeds the maximum filesize specified in this installation.', 'woocommerce' ); ?>" );
}
});
// Refresh and start:
up.refresh();
up.start();
// Block the UI
$('#product_images_container').block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_writepanel_params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } });
});
// Handle new uploads
uploader.bind( 'FileUploaded', function( up, file, response ) {
response = $.parseJSON( response.response );
if ( response.error ) {
alert( response.error );
} else {
$('#product_images_container ul').append('<li class="image" data-post_id="' + response.post_id + '">\
<img src="' + response.src + '" />\
<span class="loading"></span>\
<ul class="actions">\
<li><a href="#" class="delete"><?php _e( 'Delete', 'woocommerce' ) ?></a></li>\
<li><a href="' + response.edit_url + '" class="view thickbox" onclick="return false;"><?php _e( 'View', 'woocommerce' ) ?></a></li>\
</ul>\
</li>');
}
$('#product_images_container').unblock();
});
// Refresh images when a thickbox (images) closes
var loading_product_images = false;
jQuery(document).bind( 'tb_unload', function() {
if ( loading_product_images )
// If the media frame already exists, reopen it.
if ( product_gallery_frame ) {
product_gallery_frame.open();
return;
}
loading_product_images = true;
// Create the media frame.
product_gallery_frame = wp.media.frames.downloadable_file = wp.media({
// Set the title of the modal.
title: '<?php _e( 'Add Images to Product Gallery', 'woocommerce' ); ?>',
button: {
text: '<?php _e( 'Add to gallery', 'woocommerce' ); ?>',
},
multiple: true
});
// Block
$('#product_images_container').block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_writepanel_params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } });
// When an image is selected, run a callback.
product_gallery_frame.on( 'select', function() {
// Re-load images
jQuery.post( ajaxurl, {
action: 'woocommerce_product_image_refresh',
post_id: <?php echo $post->ID; ?>,
_ajax_nonce: '<?php echo wp_create_nonce( 'product-image-refresh' ); ?>'
}, function( response ) {
if ( response ) {
$("#product_images_container").html(response);
var selection = product_gallery_frame.state().get('selection');
selection.map( function( attachment ) {
attachment = attachment.toJSON();
if ( attachment.id ) {
attachment_ids = attachment_ids ? attachment_ids + "," + attachment.id : attachment.id;
$product_images.append('\
<li class="image" data-attachment_id="' + attachment.id + '">\
<img src="' + attachment.url + '" />\
<ul class="actions">\
<li><a href="#" class="delete" title="<?php _e( 'Delete image', 'woocommerce' ); ?>"><?php _e( 'Delete', 'woocommerce' ); ?></a></li>\
</ul>\
</li>');
}
// Re-init
product_images_container_init();
} );
// Unblock
$('#product_images_container').unblock();
$image_gallery_ids.val( attachment_ids );
});
loading_product_images = false;
}
);
// Finally, open the modal.
product_gallery_frame.open();
});
// Image ordering
$product_images.sortable({
items: 'li.image',
cursor: 'move',
scrollSensitivity:40,
forcePlaceholderSize: true,
forceHelperSize: false,
helper: 'clone',
opacity: 0.65,
placeholder: 'wc-metabox-sortable-placeholder',
start:function(event,ui){
ui.item.css('background-color','#f6f6f6');
},
stop:function(event,ui){
ui.item.removeAttr('style');
},
update: function(event, ui) {
var attachment_ids = '';
$('#product_images_container ul li.image').css('cursor','default').each(function() {
var attachment_id = jQuery(this).attr( 'data-attachment_id' );
attachment_ids = attachment_ids + attachment_id + ',';
});
$image_gallery_ids.val( attachment_ids );
}
});
// Remove images
$('#product_images_container').on( 'click', 'a.delete', function() {
$(this).closest('li.image').remove();
var attachment_ids = '';
$('#product_images_container ul li.image').css('cursor','default').each(function() {
var attachment_id = jQuery(this).attr( 'data-attachment_id' );
attachment_ids = attachment_ids + attachment_id + ',';
});
$image_gallery_ids.val( attachment_ids );
return false;
} );
});

View File

@ -44,11 +44,10 @@ function woocommerce_meta_boxes() {
// Products
add_meta_box( 'woocommerce-product-data', __( 'Product Data', 'woocommerce' ), 'woocommerce_product_data_box', 'product', 'normal', 'high' );
add_meta_box( 'woocommerce-product-images', __( 'Product Images', 'woocommerce' ), 'woocommerce_product_images_box', 'product', 'side' );
add_meta_box( 'woocommerce-product-images', __( 'Product Gallery', 'woocommerce' ), 'woocommerce_product_images_box', 'product', 'side' );
remove_meta_box( 'product_shipping_classdiv', 'product', 'side' );
remove_meta_box( 'pageparentdiv', 'product', 'side' );
remove_meta_box( 'postimagediv', 'product', 'side' );
// Excerpt
if ( function_exists('wp_editor') ) {

View File

@ -12,23 +12,31 @@
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$localisation_setting = ( defined('WPLANG') ) ? array(
global $woocommerce;
$localisation_setting = defined( 'WPLANG' ) && file_exists( $woocommerce->plugin_path() . '/i18n/languages/informal/woocommerce-' . WPLANG . '.mo' ) ? array(
'title' => __( 'Localisation', 'woocommerce' ),
'desc' => __( 'Use informal localisation file if it exists', 'woocommerce' ),
'desc' => sprintf( __( 'Use informal localisation for %s', 'woocommerce' ), WPLANG ),
'id' => 'woocommerce_informal_localisation_type',
'type' => 'checkbox',
'default' => 'no',
) : array();
$currency_code_options = get_woocommerce_currencies();
foreach ( $currency_code_options as $code => $name ) {
$currency_code_options[ $code ] = $name . ' (' . get_woocommerce_currency_symbol( $code ) . ')';
}
$woocommerce_settings['general'] = apply_filters('woocommerce_general_settings', array(
array( 'title' => __( 'General Options', 'woocommerce' ), 'type' => 'title', 'desc' => '', 'id' => 'general_options' ),
array(
'title' => __( 'Base Country/Region', 'woocommerce' ),
'desc' => __( 'This is the base country for your business. Tax rates will be based on this country.', 'woocommerce' ),
'title' => __( 'Base Location', 'woocommerce' ),
'desc' => __( 'This is the base location for your business. Tax rates will be based on this country.', 'woocommerce' ),
'id' => 'woocommerce_default_country',
'css' => 'min-width:300px;',
'css' => 'min-width:350px;',
'default' => 'GB',
'type' => 'single_select_country',
'desc_tip' => true,
@ -36,43 +44,14 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
array(
'title' => __( 'Currency', 'woocommerce' ),
'desc' => __("This controls what currency prices are listed at in the catalog and which currency gateways will take payments in.", 'woocommerce' ),
'desc' => __( "This controls what currency prices are listed at in the catalog and which currency gateways will take payments in.", 'woocommerce' ),
'id' => 'woocommerce_currency',
'css' => 'min-width:300px;',
'css' => 'min-width:350px;',
'default' => 'GBP',
'type' => 'select',
'class' => 'chosen_select',
'desc_tip' => true,
'options' => array_unique( apply_filters( 'woocommerce_currencies', array(
'USD' => __( 'US Dollars (&#36;)', 'woocommerce' ),
'EUR' => __( 'Euros (&euro;)', 'woocommerce' ),
'GBP' => __( 'Pounds Sterling (&pound;)', 'woocommerce' ),
'AUD' => __( 'Australian Dollars (&#36;)', 'woocommerce' ),
'BRL' => __( 'Brazilian Real (&#36;)', 'woocommerce' ),
'CAD' => __( 'Canadian Dollars (&#36;)', 'woocommerce' ),
'CZK' => __( 'Czech Koruna (&#75;&#269;)', 'woocommerce' ),
'DKK' => __( 'Danish Krone', 'woocommerce' ),
'HKD' => __( 'Hong Kong Dollar (&#36;)', 'woocommerce' ),
'HUF' => __( 'Hungarian Forint', 'woocommerce' ),
'ILS' => __( 'Israeli Shekel', 'woocommerce' ),
'RMB' => __( 'Chinese Yuan (&yen;)', 'woocommerce' ),
'JPY' => __( 'Japanese Yen (&yen;)', 'woocommerce' ),
'MYR' => __( 'Malaysian Ringgits (RM)', 'woocommerce' ),
'MXN' => __( 'Mexican Peso (&#36;)', 'woocommerce' ),
'NZD' => __( 'New Zealand Dollar (&#36;)', 'woocommerce' ),
'NOK' => __( 'Norwegian Krone', 'woocommerce' ),
'PHP' => __( 'Philippine Pesos', 'woocommerce' ),
'PLN' => __( 'Polish Zloty', 'woocommerce' ),
'SGD' => __( 'Singapore Dollar (&#36;)', 'woocommerce' ),
'SEK' => __( 'Swedish Krona', 'woocommerce' ),
'CHF' => __( 'Swiss Franc', 'woocommerce' ),
'TWD' => __( 'Taiwan New Dollars', 'woocommerce' ),
'THB' => __( 'Thai Baht', 'woocommerce' ),
'TRY' => __( 'Turkish Lira (TL)', 'woocommerce' ),
'ZAR' => __( 'South African rand (R)', 'woocommerce' ),
'RON' => __( 'Romanian Leu (RON)', 'woocommerce' ),
) )
)
'options' => $currency_code_options
),
array(
@ -82,7 +61,7 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
'default' => 'all',
'type' => 'select',
'class' => 'chosen_select',
'css' => 'min-width:300px;',
'css' => 'min-width:350px;',
'desc_tip' => true,
'options' => array(
'all' => __( 'All Countries', 'woocommerce' ),
@ -101,9 +80,35 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
$localisation_setting,
array(
'title' => __( 'Store Notice', 'woocommerce' ),
'desc' => __( 'Enable site-wide store notice text', 'woocommerce' ),
'id' => 'woocommerce_demo_store',
'default' => 'no',
'type' => 'checkbox'
),
array(
'title' => __( 'Store Notice Text', 'woocommerce' ),
'desc' => '',
'id' => 'woocommerce_demo_store_notice',
'default' => __( 'This is a demo store for testing purposes &mdash; no orders shall be fulfilled.', 'woocommerce' ),
'type' => 'text',
'css' => 'min-width:300px;',
),
array( 'type' => 'sectionend', 'id' => 'general_options'),
array( 'title' => __( 'Checkout and Accounts', 'woocommerce' ), 'type' => 'title','desc' => __( 'The following options control the behaviour of the checkout process and customer accounts.', 'woocommerce' ), 'id' => 'checkout_account_options' ),
array( 'title' => __( 'Cart, Checkout and Accounts', 'woocommerce' ), 'type' => 'title', 'id' => 'checkout_account_options' ),
array(
'title' => __( 'Coupons', 'woocommerce' ),
'desc' => __( 'Enable the use of coupons', 'woocommerce' ),
'id' => 'woocommerce_enable_coupons',
'default' => 'yes',
'type' => 'checkbox',
'desc_tip' => __( 'Coupons can be applied from the cart and checkout pages.', 'woocommerce' ),
),
array(
'title' => __( 'Checkout', 'woocommerce' ),
@ -115,22 +120,21 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
),
array(
'desc' => __( 'Show order comments section', 'woocommerce' ),
'desc' => __( 'Enable customer note field on checkout', 'woocommerce' ),
'id' => 'woocommerce_enable_order_comments',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'end'
'checkboxgroup' => ''
),
array(
'title' => __( 'Security', 'woocommerce' ),
'desc' => __( 'Force secure checkout', 'woocommerce' ),
'id' => 'woocommerce_force_ssl_checkout',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'checkboxgroup' => '',
'show_if_checked' => 'option',
'desc_tip' => __( 'Force SSL (HTTPS) on the checkout pages (an SSL Certificate is required)', 'woocommerce' ),
'desc_tip' => __( 'Force SSL (HTTPS) on the checkout pages (an SSL Certificate is required).', 'woocommerce' ),
),
array(
@ -142,34 +146,6 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
'show_if_checked' => 'yes',
),
array(
'title' => __( 'Coupons', 'woocommerce' ),
'desc' => __( 'Enable coupons', 'woocommerce' ),
'id' => 'woocommerce_enable_coupons',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'show_if_checked' => 'option'
),
array(
'desc' => __( 'Enable coupon form on cart', 'woocommerce' ),
'id' => 'woocommerce_enable_coupon_form_on_cart',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => '',
'show_if_checked' => 'yes'
),
array(
'desc' => __( 'Enable coupon form on checkout', 'woocommerce' ),
'id' => 'woocommerce_enable_coupon_form_on_checkout',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'end',
'show_if_checked' => 'yes'
),
array(
'title' => __( 'Registration', 'woocommerce' ),
'desc' => __( 'Allow registration on the checkout page', 'woocommerce' ),
@ -213,7 +189,7 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
),
array(
'desc' => __( 'Allow customers to repurchase past orders', 'woocommerce' ),
'desc' => __( 'Allow customers to repurchase orders from their account page', 'woocommerce' ),
'id' => 'woocommerce_allow_customers_to_reorder',
'default' => 'no',
'type' => 'checkbox',
@ -222,11 +198,11 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
array( 'type' => 'sectionend', 'id' => 'checkout_account_options'),
array( 'title' => __( 'Styles and Scripts', 'woocommerce' ), 'type' => 'title', 'desc' => __( 'The following options affect the styling of your store, as well as how certain features behave.', 'woocommerce' ), 'id' => 'script_styling_options' ),
array( 'title' => __( 'Styles and Scripts', 'woocommerce' ), 'type' => 'title', 'id' => 'script_styling_options' ),
array(
'title' => __( 'Styling', 'woocommerce' ),
'desc' => __( 'Enable WooCommerce CSS styles', 'woocommerce' ),
'desc' => __( 'Enable WooCommerce CSS', 'woocommerce' ),
'id' => 'woocommerce_frontend_css',
'default' => 'yes',
'type' => 'checkbox'
@ -236,38 +212,14 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
'type' => 'frontend_styles'
),
array(
'title' => __( 'Store Notice', 'woocommerce' ),
'desc' => __( 'Enable the "Demo Store" notice on your site', 'woocommerce' ),
'id' => 'woocommerce_demo_store',
'default' => 'no',
'type' => 'checkbox'
),
array(
'title' => __( 'Store Notice Text', 'woocommerce' ),
'desc' => '',
'id' => 'woocommerce_demo_store_notice',
'default' => __( 'This is a demo store for testing purposes &mdash; no orders shall be fulfilled.', 'woocommerce' ),
'type' => 'text',
'css' => 'min-width:300px;',
),
array(
'title' => __( 'Scripts', 'woocommerce' ),
'desc' => __( 'Enable AJAX add to cart buttons on product archives', 'woocommerce' ),
'id' => 'woocommerce_enable_ajax_add_to_cart',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start'
),
array(
'desc' => __( 'Enable WooCommerce lightbox on the product page', 'woocommerce' ),
'desc' => __( 'Enable Lightbox', 'woocommerce' ),
'id' => 'woocommerce_enable_lightbox',
'default' => 'yes',
'desc_tip' => __( 'Include WooCommerce\'s lightbox. Product gallery images and the add review form will open in a lightbox.', 'woocommerce' ),
'type' => 'checkbox',
'checkboxgroup' => ''
'checkboxgroup' => 'start'
),
array(
@ -275,12 +227,13 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
'id' => 'woocommerce_enable_chosen',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'end'
'checkboxgroup' => 'end',
'desc_tip' => __( 'This will enable a script allowing the country fields to be searchable.', 'woocommerce' ),
),
array( 'type' => 'sectionend', 'id' => 'script_styling_options'),
array( 'title' => __( 'Digital Downloads', 'woocommerce' ), 'type' => 'title','desc' => __( 'The following options are specific to downloadable products.', 'woocommerce' ), 'id' => 'digital_download_options' ),
array( 'title' => __( 'Downloadable Products', 'woocommerce' ), 'type' => 'title', 'id' => 'digital_download_options' ),
array(
'title' => __( 'File Download Method', 'woocommerce' ),
@ -299,12 +252,12 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
),
array(
'title' => __( 'Access Restrictions', 'woocommerce' ),
'desc' => __( 'Must be logged in to download files', 'woocommerce' ),
'title' => __( 'Access Restriction', 'woocommerce' ),
'desc' => __( 'Downloads require login', 'woocommerce' ),
'id' => 'woocommerce_downloads_require_login',
'type' => 'checkbox',
'default' => 'no',
'desc_tip' => __( 'This setting does not apply to guest downloads.', 'woocommerce' ),
'desc_tip' => __( 'This setting does not apply to guest purchases.', 'woocommerce' ),
'checkboxgroup' => 'start'
),
@ -313,18 +266,10 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
'id' => 'woocommerce_downloads_grant_access_after_payment',
'type' => 'checkbox',
'default' => 'yes',
'desc_tip' => __( 'Turn this option off to only grant access when an order is "complete", rather than "processing"', 'woocommerce' ),
'desc_tip' => __( 'Enable this option to grant access to downloads when orders are "processing", rather than "completed".', 'woocommerce' ),
'checkboxgroup' => 'end'
),
array(
'title' => __( 'Limit Quantity', 'woocommerce' ),
'desc' => __( 'Limit the purchasable quantity of downloadable-virtual items to 1', 'woocommerce' ),
'id' => 'woocommerce_limit_downloadable_product_qty',
'default' => 'yes',
'type' => 'checkbox'
),
array( 'type' => 'sectionend', 'id' => 'digital_download_options' ),
)); // End general settings
@ -359,16 +304,6 @@ $woocommerce_settings['pages'] = apply_filters('woocommerce_page_settings', arra
'desc_tip' => true
),
array(
'title' => __( 'Base Page Title', 'woocommerce' ),
'desc' => __( 'This title to show on the shop base page. Leave blank to use the page title.', 'woocommerce' ),
'id' => 'woocommerce_shop_page_title',
'type' => 'text',
'css' => 'min-width:300px;',
'default' => 'All Products', // Default value for the page title - changed in settings
'desc_tip' => true,
),
array(
'title' => __( 'Terms Page ID', 'woocommerce' ),
'desc' => __( 'If you define a "Terms" page the customer will be asked if they accept them when checking out.', 'woocommerce' ),
@ -380,14 +315,6 @@ $woocommerce_settings['pages'] = apply_filters('woocommerce_page_settings', arra
'desc_tip' => true,
),
array(
'title' => __( 'Logout link', 'woocommerce' ),
'desc' => sprintf(__( 'Append a logout link to menus containing "My Account"', 'woocommerce' ), $base_slug),
'id' => 'woocommerce_menu_logout_link',
'default' => 'yes',
'type' => 'checkbox',
),
array( 'type' => 'sectionend', 'id' => 'page_options' ),
array( 'title' => __( 'Shop Pages', 'woocommerce' ), 'type' => 'title', 'desc' => __( 'The following pages need selecting so that WooCommerce knows where they are. These pages should have been created upon installation of the plugin, if not you will need to create them.', 'woocommerce' ) ),
@ -480,6 +407,17 @@ $woocommerce_settings['pages'] = apply_filters('woocommerce_page_settings', arra
'desc_tip' => true,
),
array(
'title' => __( 'Logout Page', 'woocommerce' ),
'desc' => __( 'Parent: "My Account"', 'woocommerce' ),
'id' => 'woocommerce_logout_page_id',
'type' => 'single_select_page',
'default' => '',
'class' => 'chosen_select_nostd',
'css' => 'min-width:300px;',
'desc_tip' => true,
),
array(
'title' => __( 'Lost Password Page', 'woocommerce' ),
'desc' => __( 'Page contents: [woocommerce_lost_password] Parent: "My Account"', 'woocommerce' ),
@ -508,10 +446,12 @@ $woocommerce_settings['catalog'] = apply_filters('woocommerce_catalog_settings',
'default' => 'title',
'type' => 'select',
'options' => apply_filters('woocommerce_default_catalog_orderby_options', array(
'menu_order' => __( 'Default sorting', 'woocommerce' ),
'title' => __( 'Sort alphabetically', 'woocommerce' ),
'date' => __( 'Sort by most recent', 'woocommerce' ),
'price' => __( 'Sort by price', 'woocommerce' ),
'menu_order' => __( 'Default sorting (custom ordering + name)', 'woocommerce' ),
'popularity' => __( 'Popularity (sales)', 'woocommerce' ),
'rating' => __( 'Average Rating', 'woocommerce' ),
'date' => __( 'Sort by most recent', 'woocommerce' ),
'price' => __( 'Sort by price (asc)', 'woocommerce' ),
'price-desc' => __( 'Sort by price (desc)', 'woocommerce' ),
)),
'desc_tip' => true,
),
@ -547,8 +487,8 @@ $woocommerce_settings['catalog'] = apply_filters('woocommerce_catalog_settings',
),
array(
'title' => __( 'Redirects', 'woocommerce' ),
'desc' => __( 'Redirect to cart after adding a product to the cart (on single product pages)', 'woocommerce' ),
'title' => __( 'Add to cart', 'woocommerce' ),
'desc' => __( 'Redirect to the cart page after successful addition', 'woocommerce' ),
'id' => 'woocommerce_cart_redirect_after_add',
'default' => 'no',
'type' => 'checkbox',
@ -556,9 +496,9 @@ $woocommerce_settings['catalog'] = apply_filters('woocommerce_catalog_settings',
),
array(
'desc' => __( 'Redirect to the product page on a single matching search result', 'woocommerce' ),
'id' => 'woocommerce_redirect_on_single_search_result',
'default' => 'no',
'desc' => __( 'Enable AJAX add to cart buttons on archives', 'woocommerce' ),
'id' => 'woocommerce_enable_ajax_add_to_cart',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'end'
),
@ -569,7 +509,7 @@ $woocommerce_settings['catalog'] = apply_filters('woocommerce_catalog_settings',
array(
'title' => __( 'Product Fields', 'woocommerce' ),
'desc' => __( 'Enable the SKU field for products', 'woocommerce' ),
'desc' => __( 'Enable the <strong>SKU</strong> field for products', 'woocommerce' ),
'id' => 'woocommerce_enable_sku',
'default' => 'yes',
'type' => 'checkbox',
@ -577,7 +517,7 @@ $woocommerce_settings['catalog'] = apply_filters('woocommerce_catalog_settings',
),
array(
'desc' => __( 'Enable the weight field for products', 'woocommerce' ),
'desc' => __( 'Enable the <strong>weight</strong> field for products (some shipping methods may require this)', 'woocommerce' ),
'id' => 'woocommerce_enable_weight',
'default' => 'yes',
'type' => 'checkbox',
@ -585,7 +525,7 @@ $woocommerce_settings['catalog'] = apply_filters('woocommerce_catalog_settings',
),
array(
'desc' => __( 'Enable the dimension fields for products', 'woocommerce' ),
'desc' => __( 'Enable the <strong>dimension</strong> fields for products (some shipping methods may require this)', 'woocommerce' ),
'id' => 'woocommerce_enable_dimensions',
'default' => 'yes',
'type' => 'checkbox',
@ -593,7 +533,7 @@ $woocommerce_settings['catalog'] = apply_filters('woocommerce_catalog_settings',
),
array(
'desc' => __( 'Show weight and dimension fields in product attributes tab', 'woocommerce' ),
'desc' => __( 'Show <strong>weight and dimension</strong> values on the <strong>Additional Information</strong> tab', 'woocommerce' ),
'id' => 'woocommerce_enable_dimension_product_attributes',
'default' => 'yes',
'type' => 'checkbox',
@ -635,7 +575,7 @@ $woocommerce_settings['catalog'] = apply_filters('woocommerce_catalog_settings',
array(
'title' => __( 'Product Ratings', 'woocommerce' ),
'desc' => __( 'Enable the rating field on the review form', 'woocommerce' ),
'desc' => __( 'Enable ratings on reviews', 'woocommerce' ),
'id' => 'woocommerce_enable_review_rating',
'default' => 'yes',
'type' => 'checkbox',
@ -786,6 +726,19 @@ $woocommerce_settings['inventory'] = apply_filters('woocommerce_inventory_settin
'type' => 'checkbox'
),
array(
'title' => __( 'Hold Stock (minutes)', 'woocommerce' ),
'desc' => __( 'Hold stock (for unpaid orders) for x minutes. When this limit is reached, the pending order will be cancelled. Leave blank to disable.', 'woocommerce' ),
'id' => 'woocommerce_hold_stock_minutes',
'type' => 'number',
'custom_attributes' => array(
'min' => 0,
'step' => 1
),
'css' => 'width:50px;',
'default' => '60'
),
array(
'title' => __( 'Notifications', 'woocommerce' ),
'desc' => __( 'Enable low stock notifications', 'woocommerce' ),
@ -803,6 +756,14 @@ $woocommerce_settings['inventory'] = apply_filters('woocommerce_inventory_settin
'checkboxgroup' => 'end'
),
array(
'title' => __( 'Notification Recipient', 'woocommerce' ),
'desc' => '',
'id' => 'woocommerce_stock_email_recipient',
'type' => 'email',
'default' => get_option( 'admin_email' )
),
array(
'title' => __( 'Low Stock Threshold', 'woocommerce' ),
'desc' => '',
@ -983,12 +944,24 @@ $woocommerce_settings['tax'] = apply_filters('woocommerce_tax_settings', array(
'default' => 'shipping',
'type' => 'select',
'options' => array(
'shipping' => __( 'Shipping address', 'woocommerce' ),
'billing' => __( 'Billing address', 'woocommerce' ),
'shipping' => __( 'Customer shipping address', 'woocommerce' ),
'billing' => __( 'Customer billing address', 'woocommerce' ),
'base' => __( 'Shop base address', 'woocommerce' )
),
),
array(
'title' => __( 'Default Customer Address:', 'woocommerce' ),
'id' => 'woocommerce_default_customer_address',
'desc_tip' => __( 'This option determines the customers default address (before they input their own).', 'woocommerce' ),
'default' => 'base',
'type' => 'select',
'options' => array(
'' => __( 'No address', 'woocommerce' ),
'base' => __( 'Shop base address', 'woocommerce' ),
),
),
array(
'title' => __( 'Shipping Tax Class:', 'woocommerce' ),
'desc' => __( 'Optionally control which tax class shipping gets, or leave it so shipping tax is based on the cart items themselves.', 'woocommerce' ),
@ -996,7 +969,7 @@ $woocommerce_settings['tax'] = apply_filters('woocommerce_tax_settings', array(
'css' => 'min-width:150px;',
'default' => 'title',
'type' => 'select',
'options' => array( '' => 'Shipping tax class based on cart items', 'standard' => __( 'Standard', 'woocommerce' ) ) + $classes_options,
'options' => array( '' => __( 'Shipping tax class based on cart items', 'woocommerce' ), 'standard' => __( 'Standard', 'woocommerce' ) ) + $classes_options,
'desc_tip' => true,
),

View File

@ -47,9 +47,9 @@ function woocommerce_payment_gateways_setting() {
<td>';
if ( $gateway->enabled == 'yes' )
echo '<img src="' . $woocommerce->plugin_url() . '/assets/images/success.png" width="16" height="14" alt="yes" />';
echo '<img src="' . $woocommerce->plugin_url() . '/assets/images/success@2x.png" width="16" height="14" alt="yes" />';
else
echo '<img src="' . $woocommerce->plugin_url() . '/assets/images/success-off.png" width="16" height="14" alt="no" />';
echo '<img src="' . $woocommerce->plugin_url() . '/assets/images/success-off@2x.png" width="16" height="14" alt="no" />';
echo '</td>
</tr>';

View File

@ -66,6 +66,7 @@ function woocommerce_update_options( $options ) {
case 'number':
case "select" :
case "color" :
case 'password' :
case "single_select_page" :
case "single_select_country" :
case 'radio' :
@ -76,7 +77,7 @@ function woocommerce_update_options( $options ) {
if ( isset( $_POST[ $value['id'] ] ) ) {
$option_value = esc_attr( $_POST[ $value['id'] ] );
} else {
$option_value = '';
$option_value = '';
}
} elseif ( $value['id'] == 'woocommerce_price_num_decimals' ) {
@ -88,6 +89,19 @@ function woocommerce_update_options( $options ) {
$option_value = 2;
}
} elseif ( $value['id'] == 'woocommerce_hold_stock_minutes' ) {
if ( isset( $_POST[ $value['id'] ] ) ) {
$option_value = esc_attr( $_POST[ $value['id'] ] );
} else {
$option_value = '';
}
wp_clear_scheduled_hook( 'woocommerce_cancel_unpaid_orders' );
if ( $option_value != '' )
wp_schedule_single_event( time() + ( absint( $option_value ) * 60 ), 'woocommerce_cancel_unpaid_orders' );
} else {
if ( isset( $_POST[$value['id']] ) ) {
@ -101,6 +115,7 @@ function woocommerce_update_options( $options ) {
break;
// Special types
case "multiselect" :
case "multi_select_countries" :
// Get countries array
@ -175,7 +190,7 @@ function woocommerce_update_options( $options ) {
// Now save the options
foreach( $update_options as $name => $value )
update_option( $name, $value, true );
update_option( $name, $value );
return true;
}

View File

@ -48,9 +48,9 @@ function woocommerce_shipping_methods_setting() {
<td>';
if ($method->enabled == 'yes')
echo '<img src="' . $woocommerce->plugin_url() . '/assets/images/success.png" width="16 height="14" alt="yes" />';
echo '<img src="' . $woocommerce->plugin_url() . '/assets/images/success@2x.png" width="16 height="14" alt="yes" />';
else
echo '<img src="' . $woocommerce->plugin_url() . '/assets/images/success-off.png" width="16" height="14" alt="no" />';
echo '<img src="' . $woocommerce->plugin_url() . '/assets/images/success-off@2x.png" width="16" height="14" alt="no" />';
echo '</td>
</tr>';

View File

@ -27,7 +27,7 @@ function woocommerce_tax_rates_setting() {
$current_class = $class;
?>
<h3><?php printf( __( 'Tax Rates for the "%s" Class', 'woocommerce' ), $current_class ? esc_html( $current_class ) : __( 'Standard', 'woocommerce' ) ); ?></h3>
<p><?php printf( __( 'Define tax rates for countries and states below. <a href="%s">See here</a> for available country/state codes.', 'woocommerce' ), 'http://wcdocs.woothemes.com/?p=2163' ); ?></p>
<p><?php printf( __( 'Define tax rates for countries and states below. <a href="%s">See here</a> for available alpha-2 country codes.', 'woocommerce' ), 'http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes' ); ?></p>
<table class="wc_tax_rates widefat">
<thead>
<tr>
@ -70,7 +70,7 @@ function woocommerce_tax_rates_setting() {
"SELECT * FROM {$wpdb->prefix}woocommerce_tax_rates
WHERE tax_rate_class = %s
ORDER BY tax_rate_order
" , $current_class ) );
" , sanitize_title( $current_class ) ) );
foreach ( $rates as $rate ) {
?>
@ -165,16 +165,51 @@ function woocommerce_tax_rates_setting() {
return false;
});
var controlled = false;
var shifted = false;
var hasFocus = false;
jQuery(document).bind('keyup keydown', function(e){shifted = e.shiftKey} );
jQuery(document).bind('keyup keydown', function(e){ shifted = e.shiftKey; controlled = e.ctrlKey || e.metaKey } );
jQuery('#rates').on( 'focus click', 'input', function( e ) {
$this_row = jQuery(this).closest('tr');
if ( ( e.type == 'focus' && hasFocus != $this_row.index() ) || ( e.type == 'click' && jQuery(this).is(':focus') ) ) {
hasFocus = $this_row.index();
if ( ! shifted && ! controlled ) {
jQuery('#rates tr').removeClass('current').removeClass('last_selected');
$this_row.addClass('current').addClass('last_selected');
} else if ( shifted ) {
jQuery('#rates tr').removeClass('current');
$this_row.addClass('selected_now').addClass('current');
if ( jQuery('#rates tr.last_selected').size() > 0 ) {
if ( $this_row.index() > jQuery('#rates tr.last_selected').index() ) {
jQuery('#rates tr').slice( jQuery('#rates tr.last_selected').index(), $this_row.index() ).addClass('current');
} else {
jQuery('#rates tr').slice( $this_row.index(), jQuery('#rates tr.last_selected').index() + 1 ).addClass('current');
}
}
jQuery('#rates tr').removeClass('last_selected');
$this_row.addClass('last_selected');
} else {
jQuery('#rates tr').removeClass('last_selected');
if ( controlled && jQuery(this).closest('tr').is('.current') ) {
$this_row.removeClass('current');
} else {
$this_row.addClass('current').addClass('last_selected');
}
}
jQuery('#rates tr').removeClass('selected_now');
jQuery('.wc_tax_rates input').live( 'click focus', function( e ) {
if ( ! shifted ) {
jQuery('.wc_tax_rates tr').removeClass('current');
}
jQuery(this).closest('tr').addClass('current');
}).on( 'blur', 'input', function( e ) {
hasFocus = false;
});
jQuery('.wc_tax_rates .export').click(function() {
@ -368,7 +403,7 @@ function woocommerce_tax_rates_setting_save() {
'tax_rate_compound' => $compound,
'tax_rate_shipping' => $shipping,
'tax_rate_order' => $i,
'tax_rate_class' => $current_class
'tax_rate_class' => sanitize_title( $current_class )
)
);
@ -377,16 +412,25 @@ function woocommerce_tax_rates_setting_save() {
if ( ! empty( $postcode ) ) {
$postcodes = explode( ';', $postcode );
$postcodes = array_map( 'strtoupper', array_map( 'woocommerce_clean', $postcodes ) );
foreach( $postcodes as $postcode ) {
$wpdb->insert(
$wpdb->prefix . "woocommerce_tax_rate_locations",
array(
'location_code' => $postcode,
'tax_rate_id' => $tax_rate_id,
'location_type' => 'postcode',
)
);
}
$postcode_query = array();
foreach( $postcodes as $postcode )
if ( strstr( $postcode, '-' ) ) {
$postcode_parts = explode( '-', $postcode );
if ( is_numeric( $postcode_parts[0] ) && is_numeric( $postcode_parts[1] ) && $postcode_parts[1] > $postcode_parts[0] ) {
for ( $i = $postcode_parts[0]; $i <= $postcode_parts[1]; $i ++ ) {
if ( $i )
$postcode_query[] = "( '$i', $tax_rate_id, 'postcode' )";
}
}
} else {
if ( $postcode )
$postcode_query[] = "( '$postcode', $tax_rate_id, 'postcode' )";
}
$wpdb->query( "INSERT INTO {$wpdb->prefix}woocommerce_tax_rate_locations ( location_code, tax_rate_id, location_type ) VALUES " . implode( ',', $postcode_query ) );
}
if ( ! empty( $city ) ) {
@ -447,7 +491,7 @@ function woocommerce_tax_rates_setting_save() {
'tax_rate_compound' => $compound,
'tax_rate_shipping' => $shipping,
'tax_rate_order' => $i,
'tax_rate_class' => $current_class
'tax_rate_class' => sanitize_title( $current_class )
),
array(
'tax_rate_id' => $tax_rate_id
@ -471,11 +515,13 @@ function woocommerce_tax_rates_setting_save() {
if ( is_numeric( $postcode_parts[0] ) && is_numeric( $postcode_parts[1] ) && $postcode_parts[1] > $postcode_parts[0] ) {
for ( $i = $postcode_parts[0]; $i <= $postcode_parts[1]; $i ++ ) {
$postcode_query[] = "( '$i', $tax_rate_id, 'postcode' )";
if ( $i )
$postcode_query[] = "( '$i', $tax_rate_id, 'postcode' )";
}
}
} else {
$postcode_query[] = "( '$postcode', $tax_rate_id, 'postcode' )";
if ( $postcode )
$postcode_query[] = "( '$postcode', $tax_rate_id, 'postcode' )";
}
$wpdb->query( "INSERT INTO {$wpdb->prefix}woocommerce_tax_rate_locations ( location_code, tax_rate_id, location_type ) VALUES " . implode( ',', $postcode_query ) );
@ -491,14 +537,16 @@ function woocommerce_tax_rates_setting_save() {
$cities = explode( ';', $city );
$cities = array_map( 'strtoupper', array_map( 'woocommerce_clean', $cities ) );
foreach( $cities as $city ) {
$wpdb->insert(
$wpdb->prefix . "woocommerce_tax_rate_locations",
array(
'location_code' => $city,
'tax_rate_id' => $tax_rate_id,
'location_type' => 'city',
)
);
if ( $city ) {
$wpdb->insert(
$wpdb->prefix . "woocommerce_tax_rate_locations",
array(
'location_code' => $city,
'tax_rate_id' => $tax_rate_id,
'location_type' => 'city',
)
);
}
}
}

View File

@ -15,7 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Attributes admin panel
*
* Shows the created attributes and lets you add new ones.
* Shows the created attributes and lets you add new ones or edit existing ones.
* The added attributes are stored in the database and can be used for layered navigation.
*
* @access public
@ -24,159 +24,180 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
function woocommerce_attributes() {
global $wpdb, $woocommerce;
// Action to perform: add, edit, delete or none
$action = '';
if ( ! empty( $_POST['add_new_attribute'] ) ) {
check_admin_referer( 'woocommerce-add-new_attribute' );
$attribute_name = woocommerce_sanitize_taxonomy_name( stripslashes( $_POST['attribute_name'] ) );
$attribute_type = esc_attr( $_POST['attribute_type'] );
$attribute_label = esc_attr( $_POST['attribute_label'] );
$attribute_orderby = esc_attr( $_POST['attribute_orderby'] );
if ( ! $attribute_label )
$attribute_label = ucwords( $attribute_name );
if ( ! $attribute_name )
$attribute_name = sanitize_title( $attribute_label );
if ( strlen( $attribute_name ) >= 30 )
echo '<div id="woocommerce_errors" class="error fade"><p>' . sprintf( __( 'Slug %s is too long', 'woocommerce' ), sanitize_title( $attribute_name ) ) . '</p></div>';
if ( $attribute_name && strlen( $attribute_name ) < 30 && $attribute_type && ! taxonomy_exists( $woocommerce->attribute_taxonomy_name( $attribute_name ) ) ) {
$wpdb->insert(
$wpdb->prefix . "woocommerce_attribute_taxonomies",
array(
'attribute_name' => $attribute_name,
'attribute_label' => $attribute_label,
'attribute_type' => $attribute_type,
'attribute_orderby' => $attribute_orderby
)
);
wp_safe_redirect( get_admin_url() . 'edit.php?post_type=product&page=woocommerce_attributes' );
exit;
}
$action = 'add';
} elseif ( ! empty( $_POST['save_attribute'] ) && ! empty( $_GET['edit'] ) ) {
$edit = absint( $_GET['edit'] );
check_admin_referer( 'woocommerce-save-attribute_' . $edit );
$attribute_name = woocommerce_sanitize_taxonomy_name( stripslashes( $_POST['attribute_name'] ) );
$attribute_type = esc_attr( $_POST['attribute_type'] );
$attribute_label = esc_attr( $_POST['attribute_label'] );
$attribute_orderby = esc_attr( $_POST['attribute_orderby'] );
if ( ! $attribute_label )
$attribute_label = ucwords( $attribute_name );
if ( ! $attribute_name )
$attribute_name = sanitize_title( $attribute_label );
$old_attribute_name = woocommerce_sanitize_taxonomy_name( $wpdb->get_var( "SELECT attribute_name FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_id = $edit" ) );
if ( $old_attribute_name != $attribute_name && taxonomy_exists( $woocommerce->attribute_taxonomy_name( $attribute_name ) ) ) {
echo '<div id="woocommerce_errors" class="error fade"><p>' . __( 'Taxonomy exists - please change the slug', 'woocommerce' ) . '</p></div>';
} elseif ( $attribute_name && strlen( $attribute_name ) < 30 && $attribute_type ) {
$wpdb->update(
$wpdb->prefix . "woocommerce_attribute_taxonomies",
array(
'attribute_name' => $attribute_name,
'attribute_label' => $attribute_label,
'attribute_type' => $attribute_type,
'attribute_orderby' => $attribute_orderby
),
array(
'attribute_id' => $edit
)
);
if ( $old_attribute_name != $attribute_name && ! empty( $old_attribute_name ) ) {
// Update taxonomies in the wp term taxonomy table
$wpdb->update(
$wpdb->term_taxonomy,
array(
'taxonomy' => $woocommerce->attribute_taxonomy_name( $attribute_name )
),
array(
'taxonomy' => $woocommerce->attribute_taxonomy_name( $old_attribute_name )
)
);
// Update taxonomy ordering term meta
$wpdb->update(
$wpdb->prefix . "woocommerce_termmeta",
array(
'meta_key' => 'order_pa_' . sanitize_title( $attribute_name )
),
array(
'meta_key' => 'order_pa_' . sanitize_title( $old_attribute_name )
)
);
// Update product attributes which use this taxonomy
$old_attribute_name_length = strlen($old_attribute_name) + 3;
$attribute_name_length = strlen($attribute_name) + 3;
$wpdb->query( "
UPDATE {$wpdb->postmeta}
SET meta_value = replace( meta_value, 's:{$old_attribute_name_length}:\"pa_{$old_attribute_name}\"', 's:{$attribute_name_length}:\"pa_{$attribute_name}\"' )
WHERE meta_key = '_product_attributes'"
);
// Update variations which use this taxonomy
$wpdb->update(
$wpdb->postmeta,
array(
'meta_key' => 'attribute_pa_' . sanitize_title( $attribute_name )
),
array(
'meta_key' => 'attribute_pa_' . sanitize_title( $old_attribute_name )
)
);
}
wp_safe_redirect( get_admin_url() . 'edit.php?post_type=product&page=woocommerce_attributes' );
exit;
}
$action = 'edit';
} elseif ( ! empty( $_GET['delete'] ) ) {
$delete = absint( $_GET['delete'] );
check_admin_referer( 'woocommerce-delete-attribute_' . $delete );
$att_name = $wpdb->get_var( "SELECT attribute_name FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_id = $delete" );
if ( $att_name && $wpdb->query( "DELETE FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_id = $delete" ) ) {
$taxonomy = $woocommerce->attribute_taxonomy_name( $att_name );
if ( taxonomy_exists( $taxonomy ) ) {
$terms = get_terms( $taxonomy, 'orderby=name&hide_empty=0');
foreach ( $terms as $term )
wp_delete_term( $term->term_id, $taxonomy );
}
wp_safe_redirect( get_admin_url() . 'edit.php?post_type=product&page=woocommerce_attributes' );
exit;
}
$action = 'delete';
}
if ( ! empty( $_GET['edit'] ) && $_GET['edit'] > 0 )
// Add or edit an attribute
if ( 'add' === $action || 'edit' === $action ) {
// Security check
if ( 'add' === $action ) {
check_admin_referer( 'woocommerce-add-new_attribute' );
}
if ( 'edit' === $action ) {
$attribute_id = absint( $_GET['edit'] );
check_admin_referer( 'woocommerce-save-attribute_' . $attribute_id );
}
// Grab the submitted data
$attribute_label = ( isset( $_POST['attribute_label'] ) ) ? (string) $_POST['attribute_label'] : '';
$attribute_name = ( isset( $_POST['attribute_name'] ) ) ? woocommerce_sanitize_taxonomy_name( stripslashes( (string) $_POST['attribute_name'] ) ) : '';
$attribute_type = ( isset( $_POST['attribute_type'] ) ) ? (string) $_POST['attribute_type'] : '';
$attribute_orderby = ( isset( $_POST['attribute_orderby'] ) ) ? (string) $_POST['attribute_orderby'] : '';
// Auto-generate the label or slug if only one of both was provided
if ( ! $attribute_label ) {
$attribute_label = ucwords( $attribute_name );
} elseif ( ! $attribute_name ) {
$attribute_name = woocommerce_sanitize_taxonomy_name( stripslashes( $attribute_label ) );
}
// Forbidden attribute names
// http://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms
$reserved_terms = array(
'attachment', 'attachment_id', 'author', 'author_name', 'calendar', 'cat', 'category', 'category__and',
'category__in', 'category__not_in', 'category_name', 'comments_per_page', 'comments_popup', 'cpage', 'day',
'debug', 'error', 'exact', 'feed', 'hour', 'link_category', 'm', 'minute', 'monthnum', 'more', 'name',
'nav_menu', 'nopaging', 'offset', 'order', 'orderby', 'p', 'page', 'page_id', 'paged', 'pagename', 'pb', 'perm',
'post', 'post__in', 'post__not_in', 'post_format', 'post_mime_type', 'post_status', 'post_tag', 'post_type',
'posts', 'posts_per_archive_page', 'posts_per_page', 'preview', 'robots', 's', 'search', 'second', 'sentence',
'showposts', 'static', 'subpost', 'subpost_id', 'tag', 'tag__and', 'tag__in', 'tag__not_in', 'tag_id',
'tag_slug__and', 'tag_slug__in', 'taxonomy', 'tb', 'term', 'type', 'w', 'withcomments', 'withoutcomments', 'year',
);
// Error checking
if ( ! $attribute_name || ! $attribute_name || ! $attribute_type ) {
$error = __( 'Please, provide an attribute name, slug and type.', 'woocommerce' );
} elseif ( strlen( $attribute_name ) >= 28 ) {
$error = sprintf( __( 'Slug “%s” is too long (28 characters max). Shorten it, please.', 'woocommerce' ), sanitize_title( $attribute_name ) );
} elseif ( in_array( $attribute_name, $reserved_terms ) ) {
$error = sprintf( __( 'Slug “%s” is not allowed because it is a reserved term. Change it, please.', 'woocommerce' ), sanitize_title( $attribute_name ) );
} else {
$taxonomy_exists = taxonomy_exists( $woocommerce->attribute_taxonomy_name( $attribute_name ) );
if ( 'add' === $action && $taxonomy_exists ) {
$error = sprintf( __( 'Slug “%s” is already in use. Change it, please.', 'woocommerce' ), sanitize_title( $attribute_name ) );
}
if ( 'edit' === $action ) {
$old_attribute_name = woocommerce_sanitize_taxonomy_name( $wpdb->get_var( "SELECT attribute_name FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_id = $attribute_id" ) );
if ( $old_attribute_name != $attribute_name && $taxonomy_exists ) {
$error = sprintf( __( 'Slug “%s” is already in use. Change it, please.', 'woocommerce' ), sanitize_title( $attribute_name ) );
}
}
}
// Show the error message if any
if ( ! empty( $error ) ) {
echo '<div id="woocommerce_errors" class="error fade"><p>' . $error . '</p></div>';
} else {
// Add new attribute
if ( 'add' === $action ) {
$wpdb->insert(
$wpdb->prefix . 'woocommerce_attribute_taxonomies',
array(
'attribute_label' => $attribute_label,
'attribute_name' => $attribute_name,
'attribute_type' => $attribute_type,
'attribute_orderby' => $attribute_orderby,
)
);
$action_completed = true;
}
// Edit existing attribute
if ( 'edit' === $action ) {
$wpdb->update(
$wpdb->prefix . 'woocommerce_attribute_taxonomies',
array(
'attribute_label' => $attribute_label,
'attribute_name' => $attribute_name,
'attribute_type' => $attribute_type,
'attribute_orderby' => $attribute_orderby,
),
array( 'attribute_id' => $attribute_id )
);
if ( $old_attribute_name != $attribute_name && ! empty( $old_attribute_name ) ) {
// Update taxonomies in the wp term taxonomy table
$wpdb->update(
$wpdb->term_taxonomy,
array( 'taxonomy' => $woocommerce->attribute_taxonomy_name( $attribute_name ) ),
array( 'taxonomy' => $woocommerce->attribute_taxonomy_name( $old_attribute_name ) )
);
// Update taxonomy ordering term meta
$wpdb->update(
$wpdb->prefix . 'woocommerce_termmeta',
array( 'meta_key' => 'order_pa_' . sanitize_title( $attribute_name ) ),
array( 'meta_key' => 'order_pa_' . sanitize_title( $old_attribute_name ) )
);
// Update product attributes which use this taxonomy
$old_attribute_name_length = strlen( $old_attribute_name ) + 3;
$attribute_name_length = strlen( $attribute_name ) + 3;
$wpdb->query( "
UPDATE {$wpdb->postmeta}
SET meta_value = REPLACE( meta_value, 's:{$old_attribute_name_length}:\"pa_{$old_attribute_name}\"', 's:{$attribute_name_length}:\"pa_{$attribute_name}\"' )
WHERE meta_key = '_product_attributes'"
);
// Update variations which use this taxonomy
$wpdb->update(
$wpdb->postmeta,
array( 'meta_key' => 'attribute_pa_' . sanitize_title( $attribute_name ) ),
array( 'meta_key' => 'attribute_pa_' . sanitize_title( $old_attribute_name ) )
);
}
$action_completed = true;
}
}
}
// Delete an attribute
if ( 'delete' === $action ) {
// Security check
$attribute_id = absint( $_GET['delete'] );
check_admin_referer( 'woocommerce-delete-attribute_' . $attribute_id );
$attribute_name = $wpdb->get_var( "SELECT attribute_name FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_id = $attribute_id" );
if ( $attribute_name && $wpdb->query( "DELETE FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_id = $attribute_id" ) ) {
$taxonomy = $woocommerce->attribute_taxonomy_name( $attribute_name );
if ( taxonomy_exists( $taxonomy ) ) {
$terms = get_terms( $taxonomy, 'orderby=name&hide_empty=0' );
foreach ( $terms as $term ) {
wp_delete_term( $term->term_id, $taxonomy );
}
}
$action_completed = true;
}
}
// If an attribute was added, edited or deleted: clear cache and redirect
if ( ! empty( $action_completed ) ) {
delete_transient( 'wc_attribute_taxonomies' );
wp_safe_redirect( get_admin_url() . 'edit.php?post_type=product&page=woocommerce_attributes' );
exit;
}
// Show admin interface
if ( ! empty( $_GET['edit'] ) )
woocommerce_edit_attribute();
else
woocommerce_add_attribute();
}
@ -232,6 +253,7 @@ function woocommerce_edit_attribute() {
<select name="attribute_type" id="attribute_type">
<option value="select" <?php selected( $att_type, 'select' ); ?>><?php _e( 'Select', 'woocommerce' ) ?></option>
<option value="text" <?php selected( $att_type, 'text' ); ?>><?php _e( 'Text', 'woocommerce' ) ?></option>
<?php do_action('woocommerce_admin_attribute_types'); ?>
</select>
<p class="description"><?php _e( 'Determines how you select attributes for products. <strong>Text</strong> allows manual entry via the product page, whereas <strong>select</strong> attribute terms can be defined from this section. If you plan on using an attribute for variations use <strong>select</strong>.', 'woocommerce' ); ?></p>
</td>
@ -364,6 +386,7 @@ function woocommerce_add_attribute() {
<select name="attribute_type" id="attribute_type">
<option value="select"><?php _e( 'Select', 'woocommerce' ) ?></option>
<option value="text"><?php _e( 'Text', 'woocommerce' ) ?></option>
<?php do_action('woocommerce_admin_attribute_types'); ?>
</select>
<p class="description"><?php _e( 'Determines how you select attributes for products. <strong>Text</strong> allows manual entry via the product page, whereas <strong>select</strong> attribute terms can be defined from this section. If you plan on using an attribute for variations use <strong>select</strong>.', 'woocommerce' ); ?></p>
</div>

View File

@ -26,7 +26,7 @@ function woocommerce_admin_help_tab_content() {
'title' => __( 'Overview', 'woocommerce' ),
'content' =>
'<p>' . sprintf(__( 'Thank you for using WooCommerce :) Should you need help using or extending WooCommerce please <a href="%s">read the documentation</a>. For further assistance you can use the <a href="%s">community forum</a> or if you have access, <a href="%s">the members forum</a>.', 'woocommerce' ), 'http://www.woothemes.com/woocommerce-docs/', 'http://www.woothemes.com/support-forum/?viewforum=150', 'http://www.woothemes.com/support-forum/') . '</p>' .
'<p>' . sprintf(__( 'Thank you for using WooCommerce :) Should you need help using or extending WooCommerce please <a href="%s">read the documentation</a>. For further assistance you can use the <a href="%s">community forum</a> or if you have access, <a href="%s">our support desk</a>.', 'woocommerce' ), 'http://docs.woothemes.com/', 'http://wordpress.org/support/plugin/woocommerce', 'http://support.woothemes.com') . '</p>' .
'<p>' . __( 'If you are having problems, or to assist us with support, please check the status page to identify any problems with your configuration:', 'woocommerce' ) . '</p>' .
@ -58,6 +58,7 @@ function woocommerce_admin_help_tab_content() {
'content' =>
'<p>' . __( 'The reports section can be accessed from the left-hand navigation menu. Here you can generate reports for sales and customers.', 'woocommerce' ) . '</p>' .
'<p><strong>' . __( 'Sales', 'woocommerce' ) . '</strong> - ' . __( 'Reports for sales based on date, top sellers and top earners.', 'woocommerce' ) . '</p>' .
'<p><strong>' . __( 'Coupons', 'woocommerce' ) . '</strong> - ' . __( 'Coupon usage reports.', 'woocommerce' ) . '</p>' .
'<p><strong>' . __( 'Customers', 'woocommerce' ) . '</strong> - ' . __( 'Customer reports, such as signups per day.', 'woocommerce' ) . '</p>' .
'<p><strong>' . __( 'Stock', 'woocommerce' ) . '</strong> - ' . __( 'Stock reports for low stock and out of stock items.', 'woocommerce' ) . '</p>'
) );
@ -79,11 +80,11 @@ function woocommerce_admin_help_tab_content() {
$screen->set_help_sidebar(
'<p><strong>' . __( 'For more information:', 'woocommerce' ) . '</strong></p>' .
'<p>' . __( '<a href="http://www.woothemes.com/woocommerce/" target="_blank">WooCommerce</a>', 'woocommerce' ) . '</p>' .
'<p>' . __( '<a href="http://wordpress.org/extend/plugins/woocommerce/" target="_blank">Project on WordPress.org</a>', 'woocommerce' ) . '</p>' .
'<p>' . __( '<a href="https://github.com/woothemes/woocommerce" target="_blank">Project on Github</a>', 'woocommerce' ) . '</p>' .
'<p>' . __( '<a href="http://www.woothemes.com/woocommerce-docs/" target="_blank">WooCommerce Docs</a>', 'woocommerce' ) . '</p>' .
'<p>' . __( '<a href="http://www.woothemes.com/extensions/woocommerce-extensions/" target="_blank">Official Extensions</a>', 'woocommerce' ) . '</p>' .
'<p>' . __( '<a href="http://www.woothemes.com/themes/woocommerce-themes/" target="_blank">Official Themes</a>', 'woocommerce' ) . '</p>'
'<p><a href="http://www.woothemes.com/woocommerce/" target="_blank">' . __( 'WooCommerce', 'woocommerce' ) . '</a></p>' .
'<p><a href="http://wordpress.org/extend/plugins/woocommerce/" target="_blank">' . __( 'Project on WordPress.org', 'woocommerce' ) . '</a></p>' .
'<p><a href="https://github.com/woothemes/woocommerce" target="_blank">' . __( 'Project on Github', 'woocommerce' ) . '</a></p>' .
'<p><a href="http://docs.woothemes.com/" target="_blank">' . __( 'WooCommerce Docs', 'woocommerce' ) . '</a></p>' .
'<p><a href="http://www.woothemes.com/product-category/woocommerce-extensions/" target="_blank">' . __( 'Official Extensions', 'woocommerce' ) . '</a></p>' .
'<p><a href="http://www.woothemes.com/product-category/themes/woocommerce/" target="_blank">' . __( 'Official Themes', 'woocommerce' ) . '</a></p>'
);
}

View File

@ -276,7 +276,7 @@ function woocommerce_dashboard_recent_reviews() {
$rating = get_comment_meta( $comment->comment_ID, 'rating', true );
echo '<div class="star-rating" title="' . $rating . '">
<span style="width:'. ( $rating * 10 ) . 'px">' . $rating . ' ' . __( 'out of 5', 'woocommerce' ) . '</span></div>';
<span style="width:'. ( $rating * 20 ) . '%">' . $rating . ' ' . __( 'out of 5', 'woocommerce' ) . '</span></div>';
echo '<h4 class="meta"><a href="' . get_permalink( $comment->ID ) . '#comment-' . absint( $comment->comment_ID ) .'">' . esc_html__( $comment->post_title ) . '</a> reviewed by ' . esc_html( $comment->comment_author ) .'</h4>';
echo '<blockquote>' . wp_kses_data( $comment->comment_excerpt ) . ' [...]</blockquote></li>';
@ -447,13 +447,11 @@ function woocommerce_dashboard_sales_js() {
// Queue scripts
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
wp_register_script( 'woocommerce_dashboard_sales', $woocommerce->plugin_url() . '/assets/js/admin/dashboard_sales'.$suffix.'.js', 'jquery', '1.0' );
wp_register_script( 'woocommerce_dashboard_sales', $woocommerce->plugin_url() . '/assets/js/admin/dashboard_sales' . $suffix . '.js', array( 'jquery', 'flot', 'flot-resize' ), '1.0' );
wp_register_script( 'flot', $woocommerce->plugin_url() . '/assets/js/admin/jquery.flot'.$suffix.'.js', 'jquery', '1.0' );
wp_register_script( 'flot-resize', $woocommerce->plugin_url() . '/assets/js/admin/jquery.flot.resize'.$suffix.'.js', 'jquery', '1.0' );
wp_localize_script( 'woocommerce_dashboard_sales', 'params', $params );
wp_print_scripts('flot');
wp_print_scripts('flot-resize');
wp_print_scripts('woocommerce_dashboard_sales');
}

View File

@ -20,33 +20,29 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
* @access public
* @return void
*/
function woocomerce_check_download_folder_protection() {
function woocommerce_check_download_folder_protection() {
$upload_dir = wp_upload_dir();
$downloads_url = $upload_dir['basedir'] . '/woocommerce_uploads';
$download_method = get_option('woocommerce_file_download_method');
if ($download_method=='redirect') :
if ( $download_method == 'redirect' ) {
// Redirect method - don't protect
if (file_exists($downloads_url.'/.htaccess')) :
if ( file_exists( $downloads_url . '/.htaccess' ) )
unlink( $downloads_url . '/.htaccess' );
endif;
flush_rewrite_rules( true );
else :
} else {
// Force method - protect, add rules to the htaccess file
if (!file_exists($downloads_url.'/.htaccess')) :
if ($file_handle = @fopen( $downloads_url . '/.htaccess', 'w' )) :
fwrite($file_handle, 'deny from all');
fclose($file_handle);
endif;
endif;
if ( ! file_exists( $downloads_url . '/.htaccess' ) ) {
if ( $file_handle = @fopen( $downloads_url . '/.htaccess', 'w' ) ) {
fwrite( $file_handle, 'deny from all' );
fclose( $file_handle );
}
}
}
flush_rewrite_rules( true );
endif;
flush_rewrite_rules();
}
@ -85,7 +81,8 @@ function woocommerce_ms_protect_download_rewite_rules( $rewrite ) {
function woocommerce_delete_post( $id ) {
global $woocommerce, $wpdb;
if ( ! current_user_can( 'delete_posts' ) ) return;
if ( ! current_user_can( 'delete_posts' ) )
return;
if ( $id > 0 ) {
@ -94,11 +91,20 @@ function woocommerce_delete_post( $id ) {
switch( $post_type ) {
case 'product' :
if ( $children_products =& get_children( 'post_parent=' . $id . '&post_type=product_variation' ) )
if ( $children_products )
foreach ( $children_products as $child )
if ( $child_product_variations =& get_children( 'post_parent=' . $id . '&post_type=product_variation' ) )
if ( $child_product_variations )
foreach ( $child_product_variations as $child )
wp_delete_post( $child->ID, true );
if ( $child_products =& get_children( 'post_parent=' . $id . '&post_type=product' ) )
if ( $child_products )
foreach ( $child_products as $child ) {
$child_post = array();
$child_post['ID'] = $child->ID;
$child_post['post_parent'] = 0;
wp_update_post( $child_post );
}
$woocommerce->clear_product_transients();
break;
@ -254,20 +260,6 @@ function woocommerce_prevent_admin_access() {
}
}
/**
* Fix 'insert into post' buttons for images
*
* @access public
* @param mixed $vars
* @return array
*/
function woocommerce_allow_img_insertion( $vars ) {
$vars['send'] = true; // 'send' as in "Send to Editor"
return($vars);
}
/**
* Filter the directory for uploads.
*
@ -277,16 +269,15 @@ function woocommerce_allow_img_insertion( $vars ) {
*/
function woocommerce_downloads_upload_dir( $pathdata ) {
if (isset($_POST['type']) && $_POST['type'] == 'downloadable_product') :
// Change upload dir
if ( isset( $_POST['type'] ) && $_POST['type'] == 'downloadable_product' ) {
// Uploading a downloadable file
$subdir = '/woocommerce_uploads'.$pathdata['subdir'];
$pathdata['path'] = str_replace($pathdata['subdir'], $subdir, $pathdata['path']);
$pathdata['url'] = str_replace($pathdata['subdir'], $subdir, $pathdata['url']);
$pathdata['subdir'] = str_replace($pathdata['subdir'], $subdir, $pathdata['subdir']);
return $pathdata;
endif;
}
return $pathdata;
}

View File

@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
* @see woocommerce_untrash_post()
* @see woocommerce_preview_emails()
* @see woocommerce_prevent_admin_access()
* @see woocomerce_check_download_folder_protection()
* @see woocommerce_check_download_folder_protection()
* @see woocommerce_ms_protect_download_rewite_rules()
*/
add_action('delete_post', 'woocommerce_delete_post');
@ -28,16 +28,9 @@ add_action('wp_trash_post', 'woocommerce_trash_post');
add_action('untrash_post', 'woocommerce_untrash_post');
add_action('admin_init', 'woocommerce_preview_emails');
add_action('admin_init', 'woocommerce_prevent_admin_access');
add_action('woocommerce_settings_saved', 'woocomerce_check_download_folder_protection');
add_action('woocommerce_settings_saved', 'woocommerce_check_download_folder_protection');
add_filter('mod_rewrite_rules', 'woocommerce_ms_protect_download_rewite_rules');
/**
* Filters
*
* @see woocommerce_allow_img_insertion()
*/
add_filter('get_media_item_args', 'woocommerce_allow_img_insertion');
/**
* File uploads
*
@ -74,4 +67,10 @@ add_action( "delete_term", 'woocommerce_delete_term', 5 );
*/
add_action( 'admin_footer', 'woocommerce_bulk_admin_footer', 10 );
add_action( 'load-edit.php', 'woocommerce_order_bulk_action' );
add_action( 'admin_notices', 'woocommerce_order_bulk_admin_notices' );
add_action( 'admin_notices', 'woocommerce_order_bulk_admin_notices' );
/**
* Mijireh Gateway
*/
add_action( 'add_meta_boxes', array( 'WC_Gateway_Mijireh', 'add_page_slurp_meta' ) );
add_action( 'wp_ajax_page_slurp', array( 'WC_Gateway_Mijireh', 'page_slurp' ) );

View File

@ -62,13 +62,13 @@ function woocommerce_import_start() {
// Register the taxonomy now so that the import works!
register_taxonomy( $domain,
array('product'),
array(
apply_filters( 'woocommerce_taxonomy_objects_' . $domain, array('product') ),
apply_filters( 'woocommerce_taxonomy_args_' . $domain, array(
'hierarchical' => true,
'show_ui' => false,
'query_var' => true,
'rewrite' => false,
)
) )
);
endif;

View File

@ -42,6 +42,11 @@ include_once( 'woocommerce-admin-functions.php' );
*/
include_once( 'woocommerce-admin-taxonomies.php' );
/**
* Welcome Page
*/
include_once( 'includes/welcome.php' );
/**
* Setup the Admin menu in WordPress
*
@ -54,14 +59,14 @@ function woocommerce_admin_menu() {
if ( current_user_can( 'manage_woocommerce' ) )
$menu[] = array( '', 'read', 'separator-woocommerce', '', 'wp-menu-separator woocommerce' );
$main_page = add_menu_page(__( 'WooCommerce', 'woocommerce' ), __( 'WooCommerce', 'woocommerce' ), 'manage_woocommerce', 'woocommerce' , 'woocommerce_settings_page', null, '55.5' );
$main_page = add_menu_page( __( 'WooCommerce', 'woocommerce' ), __( 'WooCommerce', 'woocommerce' ), 'manage_woocommerce', 'woocommerce' , 'woocommerce_settings_page', null, '55.5' );
$reports_page = add_submenu_page('woocommerce', __( 'Reports', 'woocommerce' ), __( 'Reports', 'woocommerce' ) , 'view_woocommerce_reports', 'woocommerce_reports', 'woocommerce_reports_page');
$reports_page = add_submenu_page( 'woocommerce', __( 'Reports', 'woocommerce' ), __( 'Reports', 'woocommerce' ) , 'view_woocommerce_reports', 'woocommerce_reports', 'woocommerce_reports_page' );
add_submenu_page('edit.php?post_type=product', __( 'Attributes', 'woocommerce' ), __( 'Attributes', 'woocommerce' ), 'manage_product_terms', 'woocommerce_attributes', 'woocommerce_attributes_page');
add_submenu_page( 'edit.php?post_type=product', __( 'Attributes', 'woocommerce' ), __( 'Attributes', 'woocommerce' ), 'manage_product_terms', 'woocommerce_attributes', 'woocommerce_attributes_page');
add_action('load-' . $main_page, 'woocommerce_admin_help_tab');
add_action('load-' . $reports_page, 'woocommerce_admin_help_tab');
add_action( 'load-' . $main_page, 'woocommerce_admin_help_tab' );
add_action( 'load-' . $reports_page, 'woocommerce_admin_help_tab' );
$print_css_on = apply_filters( 'woocommerce_screen_ids', array( 'toplevel_page_woocommerce', 'woocommerce_page_woocommerce_settings', 'woocommerce_page_woocommerce_reports', 'woocommerce_page_woocommerce_status', 'product_page_woocommerce_attributes', 'edit-tags.php', 'edit.php', 'index.php', 'post-new.php', 'post.php' ) );
@ -78,12 +83,24 @@ add_action('admin_menu', 'woocommerce_admin_menu', 9);
* @return void
*/
function woocommerce_admin_menu_after() {
add_submenu_page( 'woocommerce', __( 'WooCommerce Settings', 'woocommerce' ), __( 'Settings', 'woocommerce' ) , 'manage_woocommerce', 'woocommerce_settings', 'woocommerce_settings_page');
add_submenu_page( 'woocommerce', __( 'WooCommerce Status', 'woocommerce' ), __( 'System Status', 'woocommerce' ) , 'manage_woocommerce', 'woocommerce_status', 'woocommerce_status_page');
$settings_page = add_submenu_page( 'woocommerce', __( 'WooCommerce Settings', 'woocommerce' ), __( 'Settings', 'woocommerce' ) , 'manage_woocommerce', 'woocommerce_settings', 'woocommerce_settings_page');
$status_page = add_submenu_page( 'woocommerce', __( 'WooCommerce Status', 'woocommerce' ), __( 'System Status', 'woocommerce' ) , 'manage_woocommerce', 'woocommerce_status', 'woocommerce_status_page');
add_action( 'load-' . $settings_page, 'woocommerce_settings_page_init' );
}
add_action('admin_menu', 'woocommerce_admin_menu_after', 50);
/**
* Loads gateways and shipping methods into memory for use within settings.
*
* @access public
* @return void
*/
function woocommerce_settings_page_init() {
$GLOBALS['woocommerce']->payment_gateways();
$GLOBALS['woocommerce']->shipping();
}
/**
* Highlights the correct top level admin menu item for post type add screens.
@ -147,16 +164,43 @@ add_action( 'admin_head', 'woocommerce_admin_menu_highlight' );
*/
function woocommerce_admin_notices_styles() {
if ( get_option( 'woocommerce_updated' ) == 1 || get_option( 'woocommerce_needs_update' ) == 1 || get_option( 'woocommerce_installed' ) == 1 ) {
if ( get_option( '_wc_needs_update' ) == 1 || get_option( '_wc_needs_pages' ) == 1 ) {
wp_enqueue_style( 'woocommerce-activation', plugins_url( '/assets/css/activation.css', dirname( __FILE__ ) ) );
add_action( 'admin_notices', 'woocommerce_admin_install_notices' );
}
$template = get_option( 'template' );
if ( ! current_theme_supports( 'woocommerce' ) && ! in_array( $template, array( 'twentyeleven', 'twentytwelve', 'twentyten' ) ) ) {
if ( ! empty( $_GET['hide_woocommerce_theme_support_check'] ) ) {
update_option( 'woocommerce_theme_support_check', $template );
return;
}
if ( get_option( 'woocommerce_theme_support_check' ) !== $template ) {
wp_enqueue_style( 'woocommerce-activation', plugins_url( '/assets/css/activation.css', dirname( __FILE__ ) ) );
add_action( 'admin_notices', 'woocommerce_theme_check_notice' );
}
}
}
add_action( 'admin_print_styles', 'woocommerce_admin_notices_styles' );
/**
* woocommerce_theme_check_notice function.
*
* @access public
* @return void
*/
function woocommerce_theme_check_notice() {
include( 'includes/notice-theme-support.php' );
}
/**
* woocommerce_admin_install_notices function.
*
@ -166,31 +210,14 @@ add_action( 'admin_print_styles', 'woocommerce_admin_notices_styles' );
function woocommerce_admin_install_notices() {
global $woocommerce;
if ( get_option( 'woocommerce_needs_update' ) == 1 ) {
// If we need to update, include a message with the update button
if ( get_option( '_wc_needs_update' ) == 1 ) {
include( 'includes/notice-update.php' );
}
} elseif ( get_option( 'woocommerce_updated' ) == 1 ) {
include( 'includes/notice-updated.php' );
update_option( 'woocommerce_updated', 0 );
update_option( 'woocommerce_installed', 0 );
} elseif ( get_option( 'woocommerce_installed' ) == 1 ) {
if ( get_option( 'skip_install_woocommerce_pages' ) != 1 && woocommerce_get_page_id( 'shop' ) < 1 && ! isset( $_GET['install_woocommerce_pages'] ) && !isset( $_GET['skip_install_woocommerce_pages'] ) ) {
include( 'includes/notice-install.php' );
} elseif ( ! isset( $_GET['page'] ) || $_GET['page'] != 'woocommerce_settings' ) {
include( 'includes/notice-installed.php' );
update_option( 'woocommerce_installed', 0 );
}
// If we have just installed, show a message with the install pages button
elseif ( get_option( '_wc_needs_pages' ) == 1 ) {
include( 'includes/notice-install.php' );
}
}
@ -205,7 +232,52 @@ function woocommerce_admin_init() {
ob_start();
if ( $typenow=='post' && isset( $_GET['post'] ) && ! empty( $_GET['post'] ) ) {
// Install - Add pages button
if ( ! empty( $_GET['install_woocommerce_pages'] ) ) {
require_once( 'woocommerce-admin-install.php' );
woocommerce_create_pages();
// We no longer need to install pages
delete_option( '_wc_needs_pages' );
delete_transient( '_wc_activation_redirect' );
// What's new redirect
wp_safe_redirect( admin_url( 'index.php?page=wc-about&wc-installed=true' ) );
exit;
// Skip button
} elseif ( ! empty( $_GET['skip_install_woocommerce_pages'] ) ) {
// We no longer need to install pages
delete_option( '_wc_needs_pages' );
delete_transient( '_wc_activation_redirect' );
// Flush rules after install
flush_rewrite_rules();
// What's new redirect
wp_safe_redirect( admin_url( 'index.php?page=wc-about' ) );
exit;
// Update button
} elseif ( ! empty( $_GET['do_update_woocommerce'] ) ) {
include_once( 'woocommerce-admin-update.php' );
do_update_woocommerce();
// Update complete
delete_option( '_wc_needs_pages' );
delete_option( '_wc_needs_update' );
delete_transient( '_wc_activation_redirect' );
// What's new redirect
wp_safe_redirect( admin_url( 'index.php?page=wc-about&wc-updated=true' ) );
exit;
}
// Includes
if ( $typenow == 'post' && isset( $_GET['post'] ) && ! empty( $_GET['post'] ) ) {
$typenow = $post->post_type;
} elseif ( empty( $typenow ) && ! empty( $_GET['post'] ) ) {
$post = get_post( $_GET['post'] );
@ -287,24 +359,6 @@ function woocommerce_status_page() {
}
/**
* update_woocommerce function.
*
* @access public
* @return void
*/
function update_woocommerce() {
if ( ! empty( $_GET['do_update_woocommerce'] ) ) {
include_once( 'woocommerce-admin-update.php' );
do_update_woocommerce();
update_option( 'woocommerce_updated', 1 );
update_option( 'woocommerce_needs_update', 0 );
}
}
add_action( 'admin_init', 'update_woocommerce' );
/**
* Include and add help tabs to WordPress admin.
*
@ -337,9 +391,7 @@ function woocommerce_admin_scripts() {
wp_register_script( 'jquery-tiptip', $woocommerce->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip' . $suffix . '.js', array( 'jquery' ), $woocommerce->version, true );
wp_register_script( 'jquery-ui-datepicker', $woocommerce->plugin_url() . '/assets/js/admin/ui-datepicker.js', array('jquery','jquery-ui-core'), $woocommerce->version );
wp_register_script( 'woocommerce_writepanel', $woocommerce->plugin_url() . '/assets/js/admin/write-panels'.$suffix.'.js', array('jquery', 'jquery-ui-datepicker'), $woocommerce->version );
wp_register_script( 'woocommerce_writepanel', $woocommerce->plugin_url() . '/assets/js/admin/write-panels'.$suffix.'.js', array('jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable'), $woocommerce->version );
wp_register_script( 'ajax-chosen', $woocommerce->plugin_url() . '/assets/js/chosen/ajax-chosen.jquery'.$suffix.'.js', array('jquery', 'chosen'), $woocommerce->version );
@ -349,7 +401,7 @@ function woocommerce_admin_scripts() {
$screen = get_current_screen();
// WooCommerce admin pages
if (in_array( $screen->id, apply_filters( 'woocommerce_screen_ids', array( 'toplevel_page_woocommerce', 'woocommerce_page_woocommerce_settings', 'woocommerce_page_woocommerce_reports', 'edit-shop_order', 'edit-shop_coupon', 'shop_coupon', 'shop_order', 'edit-product', 'product' ) ) ) ) :
if ( in_array( $screen->id, apply_filters( 'woocommerce_screen_ids', array( 'toplevel_page_woocommerce', 'woocommerce_page_woocommerce_settings', 'woocommerce_page_woocommerce_reports', 'edit-shop_order', 'edit-shop_coupon', 'shop_coupon', 'shop_order', 'edit-product', 'product' ) ) ) ) {
wp_enqueue_script( 'woocommerce_admin' );
wp_enqueue_script( 'farbtastic' );
@ -358,32 +410,27 @@ function woocommerce_admin_scripts() {
wp_enqueue_script( 'jquery-ui-sortable' );
wp_enqueue_script( 'jquery-ui-autocomplete' );
endif;
}
// Edit product category pages
if (in_array( $screen->id, array('edit-product_cat') )) :
wp_enqueue_script( 'media-upload' );
wp_enqueue_script( 'thickbox' );
endif;
if ( in_array( $screen->id, array('edit-product_cat') ) )
wp_enqueue_media();
// Product/Coupon/Orders
if (in_array( $screen->id, array( 'shop_coupon', 'shop_order', 'product' ))) :
if ( in_array( $screen->id, array( 'shop_coupon', 'shop_order', 'product' ) ) ) {
wp_enqueue_script( 'woocommerce_writepanel' );
wp_enqueue_script( 'jquery-ui-datepicker' );
wp_enqueue_script( 'media-upload' );
wp_enqueue_script( 'thickbox' );
wp_enqueue_media();
wp_enqueue_script( 'ajax-chosen' );
wp_enqueue_script( 'chosen' );
wp_enqueue_script( 'plupload-all' );
$woocommerce_witepanel_params = array(
'remove_item_notice' => __( 'Are you sure you want to remove the selected items? If you have previously reduced this item\'s stock, or this order was submitted by a customer, you will need to manually restore the item\'s stock.', 'woocommerce' ),
'i18n_select_items' => __( 'Please select some items.', 'woocommerce' ),
'remove_item_meta' => __( 'Remove this item meta?', 'woocommerce' ),
'remove_attribute' => __( 'Remove this attribute?', 'woocommerce' ),
'refund_item_notice' => __( 'Are you sure you want to refund the selected items? The item\'s stock will not be affected.', 'woocommerce' ),
'name_label' => __( 'Name', 'woocommerce' ),
'remove_label' => __( 'Remove', 'woocommerce' ),
'click_to_toggle' => __( 'Click to toggle', 'woocommerce' ),
@ -415,15 +462,17 @@ function woocommerce_admin_scripts() {
'currency_format_symbol' => get_woocommerce_currency_symbol(),
'currency_format_decimal_sep' => esc_attr( stripslashes( get_option( 'woocommerce_price_decimal_sep' ) ) ),
'currency_format_thousand_sep' => esc_attr( stripslashes( get_option( 'woocommerce_price_thousand_sep' ) ) ),
'currency_format' => esc_attr( str_replace( array( '%1$s', '%2$s' ), array( '%s', '%v' ), get_woocommerce_price_format() ) ) // For accounting JS
'currency_format' => esc_attr( str_replace( array( '%1$s', '%2$s' ), array( '%s', '%v' ), get_woocommerce_price_format() ) ), // For accounting JS
'product_types' => array_map( 'sanitize_title', get_terms( 'product_type', array( 'hide_empty' => false, 'fields' => 'names' ) ) ),
'default_attribute_visibility' => apply_filters( 'default_attribute_visibility', false ),
'default_attribute_variation' => apply_filters( 'default_attribute_variation', false )
);
wp_localize_script( 'woocommerce_writepanel', 'woocommerce_writepanel_params', $woocommerce_witepanel_params );
endif;
}
// Term ordering - only when sorting by term_order
if ( ( strstr( $screen->id, 'edit-pa_' ) || ( ! empty( $_GET['taxonomy'] ) && in_array( $_GET['taxonomy'], apply_filters( 'woocommerce_sortable_taxonomies', array( 'product_cat' ) ) ) ) ) && ! isset( $_GET['orderby'] ) ) :
if ( ( strstr( $screen->id, 'edit-pa_' ) || ( ! empty( $_GET['taxonomy'] ) && in_array( $_GET['taxonomy'], apply_filters( 'woocommerce_sortable_taxonomies', array( 'product_cat' ) ) ) ) ) && ! isset( $_GET['orderby'] ) ) {
wp_register_script( 'woocommerce_term_ordering', $woocommerce->plugin_url() . '/assets/js/admin/term-ordering.js', array('jquery-ui-sortable'), $woocommerce->version );
wp_enqueue_script( 'woocommerce_term_ordering' );
@ -436,7 +485,7 @@ function woocommerce_admin_scripts() {
wp_localize_script( 'woocommerce_term_ordering', 'woocommerce_term_ordering_params', $woocommerce_term_order_params );
endif;
}
// Product sorting - only when sorting by menu order on the products page
if ( current_user_can('edit_others_pages') && $screen->id == 'edit-product' && isset( $wp_query->query['orderby'] ) && $wp_query->query['orderby'] == 'menu_order title' ) {
@ -465,20 +514,22 @@ add_action( 'admin_enqueue_scripts', 'woocommerce_admin_scripts' );
* @return void
*/
function woocommerce_admin_css() {
global $woocommerce, $typenow, $post;
global $woocommerce, $typenow, $post, $wp_scripts;
if ($typenow=='post' && isset($_GET['post']) && !empty($_GET['post'])) :
if ( $typenow == 'post' && ! empty( $_GET['post'] ) ) {
$typenow = $post->post_type;
elseif (empty($typenow) && !empty($_GET['post'])) :
$post = get_post($_GET['post']);
} elseif ( empty( $typenow ) && ! empty( $_GET['post'] ) ) {
$post = get_post( $_GET['post'] );
$typenow = $post->post_type;
endif;
}
if ( $typenow == '' || $typenow=="product" || $typenow=="shop_order" || $typenow=="shop_coupon" ) :
wp_enqueue_style( 'thickbox' );
if ( $typenow == '' || $typenow == "product" || $typenow == "shop_order" || $typenow == "shop_coupon" ) {
wp_enqueue_style( 'woocommerce_admin_styles', $woocommerce->plugin_url() . '/assets/css/admin.css' );
wp_enqueue_style( 'jquery-ui-style', (is_ssl()) ? 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css' : 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css' );
endif;
$jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.9.2';
wp_enqueue_style( 'jquery-ui-style', '//ajax.googleapis.com/ajax/libs/jqueryui/' . $jquery_version . '/themes/smoothness/jquery-ui.css' );
}
wp_enqueue_style('farbtastic');
@ -581,79 +632,6 @@ function woocommerce_admin_head() {
add_action('admin_head', 'woocommerce_admin_head');
/**
* Add functionality to the image uploader on product pages to exclude an image
*
* @access public
* @param mixed $fields
* @param mixed $object
* @return void
*/
function woocommerce_exclude_image_from_product_page_field( $fields, $object ) {
if (!$object->post_parent) return $fields;
$parent = get_post( $object->post_parent );
if ( $parent->post_type !== 'product' )
return $fields;
$exclude_image = get_post_meta( absint( $object->ID ), '_woocommerce_exclude_image', true );
$label = __( 'Exclude image', 'woocommerce' );
$html = '<input type="checkbox" '.checked($exclude_image, 1, false).' name="attachments['.$object->ID.'][woocommerce_exclude_image]" id="attachments['.$object->ID.'][woocommerce_exclude_image" />';
$fields['woocommerce_exclude_image'] = array(
'label' => $label,
'input' => 'html',
'html' => $html,
'value' => '',
'helps' => __( 'Enabling this option will hide it from the product page image gallery.', 'woocommerce' )
);
return $fields;
}
add_filter('attachment_fields_to_edit', 'woocommerce_exclude_image_from_product_page_field', 1, 2);
add_filter('attachment_fields_to_save', 'woocommerce_exclude_image_from_product_page_field_save', 1, 2);
add_action('add_attachment', 'woocommerce_exclude_image_from_product_page_field_add');
/**
* Save the meta for exlcuding images from galleries.
*
* @access public
* @param mixed $post
* @param mixed $attachment
* @return void
*/
function woocommerce_exclude_image_from_product_page_field_save( $post, $attachment ) {
if (isset($_REQUEST['attachments'][$post['ID']]['woocommerce_exclude_image'])) :
delete_post_meta( (int) $post['ID'], '_woocommerce_exclude_image' );
update_post_meta( (int) $post['ID'], '_woocommerce_exclude_image', 1);
else :
delete_post_meta( (int) $post['ID'], '_woocommerce_exclude_image' );
update_post_meta( (int) $post['ID'], '_woocommerce_exclude_image', 0);
endif;
return $post;
}
/**
* Add the meta for exlcuding images from galleries.
*
* @access public
* @param mixed $post_id
* @return void
*/
function woocommerce_exclude_image_from_product_page_field_add( $post_id ) {
add_post_meta( $post_id, '_woocommerce_exclude_image', 0, true );
}
/**
* Duplicate a product action
*

View File

@ -34,7 +34,22 @@ function do_install_woocommerce() {
// Cron jobs
wp_clear_scheduled_hook( 'woocommerce_scheduled_sales' );
wp_schedule_event( strtotime( 'tomorrow' ), 'daily', 'woocommerce_scheduled_sales');
wp_clear_scheduled_hook( 'woocommerce_cancel_unpaid_orders' );
wp_clear_scheduled_hook( 'woocommerce_cleanup_sessions' );
$ve = get_option('gmt_offset') > 0 ? '+' : '-';
wp_schedule_event( strtotime( 'tomorrow ' . $ve . get_option('gmt_offset') . ' HOURS' ), 'daily', 'woocommerce_scheduled_sales');
$held_duration = get_option( 'woocommerce_hold_stock_minutes', null );
if ( is_null( $held_duration ) )
$held_duration = '60';
if ( $held_duration != '' )
wp_schedule_single_event( time() + ( absint( $held_duration ) * 60 ), 'woocommerce_cancel_unpaid_orders' );
wp_schedule_event( time(), 'twicedaily', 'woocommerce_cleanup_sessions' );
// Install files and folders for uploading files and prevent hotlinking
$upload_dir = wp_upload_dir();
@ -88,14 +103,17 @@ function do_install_woocommerce() {
$current_version = get_option( 'woocommerce_version', null );
$current_db_version = get_option( 'woocommerce_db_version', null );
if ( version_compare( $current_db_version, '2.0', '<' ) && null !== $current_version ) {
update_option( 'woocommerce_needs_update', 1 );
if ( version_compare( $current_db_version, '2.0', '<' ) && null !== $current_db_version ) {
update_option( '_wc_needs_update', 1 );
} else {
update_option( 'woocommerce_db_version', $woocommerce->version );
}
// Update version
update_option( 'woocommerce_version', $woocommerce->version );
// Flush rewrite rules
flush_rewrite_rules();
}
@ -182,9 +200,6 @@ function woocommerce_create_pages() {
// Checkout page
woocommerce_create_page( esc_sql( _x( 'checkout', 'page_slug', 'woocommerce' ) ), 'woocommerce_checkout_page_id', __( 'Checkout', 'woocommerce' ), '[woocommerce_checkout]' );
// Order tracking page
woocommerce_create_page( esc_sql( _x( 'order-tracking', 'page_slug', 'woocommerce' ) ), 'woocommerce_order_tracking_page_id', __( 'Track your order', 'woocommerce' ), '[woocommerce_order_tracking]' );
// My Account page
woocommerce_create_page( esc_sql( _x( 'my-account', 'page_slug', 'woocommerce' ) ), 'woocommerce_myaccount_page_id', __( 'My Account', 'woocommerce' ), '[woocommerce_my_account]' );
@ -200,6 +215,9 @@ function woocommerce_create_pages() {
// Change password page
woocommerce_create_page( esc_sql( _x( 'change-password', 'page_slug', 'woocommerce' ) ), 'woocommerce_change_password_page_id', __( 'Change Password', 'woocommerce' ), '[woocommerce_change_password]', woocommerce_get_page_id( 'myaccount' ) );
// Logout page
woocommerce_create_page( esc_sql( _x( 'logout', 'page_slug', 'woocommerce' ) ), 'woocommerce_logout_page_id', __( 'Logout', 'woocommerce' ), '', woocommerce_get_page_id( 'myaccount' ) );
// Pay page
woocommerce_create_page( esc_sql( _x( 'pay', 'page_slug', 'woocommerce' ) ), 'woocommerce_pay_page_id', __( 'Checkout &rarr; Pay', 'woocommerce' ), '[woocommerce_pay]', woocommerce_get_page_id( 'checkout' ) );
@ -211,6 +229,16 @@ function woocommerce_create_pages() {
/**
* Set up the database tables which the plugin needs to function.
*
* Tables:
* woocommerce_attribute_taxonomies - Table for storing attribute taxonomies - these are user defined
* woocommerce_termmeta - Term meta table - sadly WordPress does not have termmeta so we need our own
* woocommerce_downloadable_product_permissions - Table for storing user and guest download permissions.
* KEY(order_id, product_id, download_id) used for organizing downloads on the My Account page
* woocommerce_order_items - Order line items are stored in a table to make them easily queryable for reports
* woocommerce_order_itemmeta - Order line item meta is stored in a table for storing extra data.
* woocommerce_tax_rates - Tax Rates are stored inside 2 tables making tax queries simple and efficient.
* woocommerce_tax_rate_locations - Each rate can be applied to more than one postcode/city hence the second table.
*
* @access public
* @return void
*/
@ -220,6 +248,7 @@ function woocommerce_tables_install() {
$wpdb->hide_errors();
$collate = '';
if ( $wpdb->has_cap( 'collation' ) ) {
if( ! empty($wpdb->charset ) )
$collate .= "DEFAULT CHARACTER SET $wpdb->charset";
@ -229,35 +258,27 @@ function woocommerce_tables_install() {
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
// Table for storing attribute taxonomies - these are user defined
$sql = "
CREATE TABLE ". $wpdb->prefix . "woocommerce_attribute_taxonomies (
// WooCommerce Tables
$woocommerce_tables = "
CREATE TABLE {$wpdb->prefix}woocommerce_attribute_taxonomies (
attribute_id bigint(20) NOT NULL auto_increment,
attribute_name varchar(200) NOT NULL,
attribute_label longtext NULL,
attribute_type varchar(200) NOT NULL,
attribute_orderby varchar(200) NOT NULL,
PRIMARY KEY (attribute_id)
PRIMARY KEY (attribute_id),
KEY attribute_name (attribute_name)
) $collate;
";
dbDelta( $sql );
// Term meta table - sadly WordPress does not have termmeta so we need our own
$sql = "
CREATE TABLE ". $wpdb->prefix . "woocommerce_termmeta (
CREATE TABLE {$wpdb->prefix}woocommerce_termmeta (
meta_id bigint(20) NOT NULL AUTO_INCREMENT,
woocommerce_term_id bigint(20) NOT NULL,
meta_key varchar(255) NULL,
meta_value longtext NULL,
PRIMARY KEY (meta_id)
PRIMARY KEY (meta_id),
KEY woocommerce_term_id (woocommerce_term_id),
KEY meta_key (meta_key)
) $collate;
";
dbDelta( $sql );
// Table for storing user and guest download permissions
// KEY(order_id, product_id, download_id) used for organizing downloads on the My Account page
$sql = "
CREATE TABLE ". $wpdb->prefix . "woocommerce_downloadable_product_permissions (
CREATE TABLE {$wpdb->prefix}woocommerce_downloadable_product_permissions (
download_id varchar(32) NOT NULL,
product_id bigint(20) NOT NULL,
order_id bigint(20) NOT NULL DEFAULT 0,
@ -269,38 +290,26 @@ CREATE TABLE ". $wpdb->prefix . "woocommerce_downloadable_product_permissions (
access_expires datetime NULL default null,
download_count bigint(20) NOT NULL DEFAULT 0,
PRIMARY KEY (product_id,order_id,order_key,download_id),
KEY (order_id,product_id,download_id)
KEY download_order_product (download_id,order_id,product_id)
) $collate;
";
dbDelta( $sql );
// Order line items are stored in a table to make them easily queryable for reports
$sql = "
CREATE TABLE ". $wpdb->prefix . "woocommerce_order_items (
CREATE TABLE {$wpdb->prefix}woocommerce_order_items (
order_item_id bigint(20) NOT NULL auto_increment,
order_item_name longtext NOT NULL DEFAULT '',
order_item_name longtext NOT NULL,
order_item_type varchar(200) NOT NULL DEFAULT '',
order_id bigint(20) NOT NULL,
PRIMARY KEY (order_item_id)
PRIMARY KEY (order_item_id),
KEY order_id (order_id)
) $collate;
";
dbDelta( $sql );
// Order line item meta is stored in a table for storing extra data.
$sql = "
CREATE TABLE ". $wpdb->prefix . "woocommerce_order_itemmeta (
CREATE TABLE {$wpdb->prefix}woocommerce_order_itemmeta (
meta_id bigint(20) NOT NULL auto_increment,
order_item_id bigint(20) NOT NULL,
meta_key varchar(255) NULL,
meta_value longtext NULL,
PRIMARY KEY (meta_id)
PRIMARY KEY (meta_id),
KEY order_item_id (order_item_id),
KEY meta_key (meta_key)
) $collate;
";
dbDelta( $sql );
// Tax Rates are stored inside 2 tables making tax queries simple and efficient.
$sql = "
CREATE TABLE ". $wpdb->prefix . "woocommerce_tax_rates (
CREATE TABLE {$wpdb->prefix}woocommerce_tax_rates (
tax_rate_id bigint(20) NOT NULL auto_increment,
tax_rate_country varchar(200) NOT NULL DEFAULT '',
tax_rate_state varchar(200) NOT NULL DEFAULT '',
@ -311,22 +320,23 @@ CREATE TABLE ". $wpdb->prefix . "woocommerce_tax_rates (
tax_rate_shipping int(1) NOT NULL DEFAULT 1,
tax_rate_order bigint(20) NOT NULL,
tax_rate_class varchar(200) NOT NULL DEFAULT '',
PRIMARY KEY (tax_rate_id)
PRIMARY KEY (tax_rate_id),
KEY tax_rate_country (tax_rate_country),
KEY tax_rate_state (tax_rate_state),
KEY tax_rate_class (tax_rate_class),
KEY tax_rate_priority (tax_rate_priority)
) $collate;
";
dbDelta( $sql );
// Each rate can be applied to more than one postcode/city hence the second table.
$sql = "
CREATE TABLE ". $wpdb->prefix . "woocommerce_tax_rate_locations (
CREATE TABLE {$wpdb->prefix}woocommerce_tax_rate_locations (
location_id bigint(20) NOT NULL auto_increment,
location_code varchar(255) NOT NULL,
tax_rate_id bigint(20) NOT NULL,
location_type varchar(40) NOT NULL,
PRIMARY KEY (location_id)
PRIMARY KEY (location_id),
KEY location_type (location_type),
KEY location_type_code (location_type,location_code)
) $collate;
";
dbDelta( $sql );
dbDelta( $woocommerce_tables );
}

View File

@ -368,7 +368,7 @@ function woocommerce_sales_overview() {
<div class="postbox">
<h3><span><?php _e( 'Total sales', 'woocommerce' ); ?></span></h3>
<div class="inside">
<p class="stat"><?php if ($total_sales>0) echo woocommerce_price($total_sales); else _e( 'n/a', 'woocommerce' ); ?></p>
<p class="stat"><?php if ( $total_sales > 0 ) echo woocommerce_price($total_sales); else _e( 'n/a', 'woocommerce' ); ?></p>
</div>
</div>
<div class="postbox">
@ -407,6 +407,7 @@ function woocommerce_sales_overview() {
<h3><span><?php _e( 'This month\'s sales', 'woocommerce' ); ?></span></h3>
<div class="inside chart">
<div id="placeholder" style="width:100%; overflow:hidden; height:568px; position:relative;"></div>
<div id="cart_legend"></div>
</div>
</div>
</div>
@ -494,6 +495,10 @@ function woocommerce_sales_overview() {
var placeholder = jQuery("#placeholder");
var plot = jQuery.plot(placeholder, [ { label: "<?php echo esc_js( __( 'Number of sales', 'woocommerce' ) ) ?>", data: d }, { label: "<?php echo esc_js( __( 'Sales amount', 'woocommerce' ) ) ?>", data: d2, yaxis: 2 } ], {
legend: {
container: jQuery('#cart_legend'),
noColumns: 2
},
series: {
lines: { show: true, fill: true },
points: { show: true }
@ -663,6 +668,7 @@ function woocommerce_daily_sales() {
<h3><span><?php _e( 'Sales in range', 'woocommerce' ); ?></span></h3>
<div class="inside chart">
<div id="placeholder" style="width:100%; overflow:hidden; height:568px; position:relative;"></div>
<div id="cart_legend"></div>
</div>
</div>
</div>
@ -694,6 +700,10 @@ function woocommerce_daily_sales() {
var placeholder = jQuery("#placeholder");
var plot = jQuery.plot(placeholder, [ { label: "<?php echo esc_js( __( 'Number of sales', 'woocommerce' ) ) ?>", data: d }, { label: "<?php echo esc_js( __( 'Sales amount', 'woocommerce' ) ) ?>", data: d2, yaxis: 2 } ], {
legend: {
container: jQuery('#cart_legend'),
noColumns: 2
},
series: {
lines: { show: true, fill: true },
points: { show: true }
@ -842,6 +852,7 @@ function woocommerce_monthly_sales() {
<h3><span><?php _e( 'Monthly sales for year', 'woocommerce' ); ?></span></h3>
<div class="inside chart">
<div id="placeholder" style="width:100%; overflow:hidden; height:568px; position:relative;"></div>
<div id="cart_legend"></div>
</div>
</div>
</div>
@ -870,6 +881,10 @@ function woocommerce_monthly_sales() {
var placeholder = jQuery("#placeholder");
var plot = jQuery.plot(placeholder, [ { label: "<?php echo esc_js( __( 'Number of sales', 'woocommerce' ) ) ?>", data: d }, { label: "<?php echo esc_js( __( 'Sales amount', 'woocommerce' ) ) ?>", data: d2, yaxis: 2 } ], {
legend: {
container: jQuery('#cart_legend'),
noColumns: 2
},
series: {
lines: { show: true, fill: true },
points: { show: true, align: "left" }
@ -980,10 +995,10 @@ function woocommerce_top_sellers() {
if ( $product_title ) {
$product_name = '<a href="' . get_permalink( $product_id ) . '">'. __( $product_title ) .'</a>';
$orders_link = admin_url( 'edit.php?s&post_status=all&post_type=shop_order&action=-1&s=' . urlencode( $product_title ) . '&shop_order_status=completed,processing,on-hold' );
$orders_link = admin_url( 'edit.php?s&post_status=all&post_type=shop_order&action=-1&s=' . urlencode( $product_title ) . '&shop_order_status=' . implode( ",", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) );
} else {
$product_name = __( 'Product does not exist', 'woocommerce' );
$orders_link = admin_url( 'edit.php?s&post_status=all&post_type=shop_order&action=-1&s=&shop_order_status=completed,processing,on-hold' );
$orders_link = admin_url( 'edit.php?s&post_status=all&post_type=shop_order&action=-1&s=&shop_order_status=' . implode( ",", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) );
}
echo '<tr><th>' . $product_name . '</th><td width="1%"><span>' . esc_html( $sales ) . '</span></td><td class="bars"><a href="' . esc_url( $orders_link ) . '" style="width:' . esc_attr( $width ) . '%">&nbsp;</a></td></tr>';
@ -1077,10 +1092,10 @@ function woocommerce_top_earners() {
if ( $product_title ) {
$product_name = '<a href="'.get_permalink( $product_id ).'">'. __( $product_title ) .'</a>';
$orders_link = admin_url( 'edit.php?s&post_status=all&post_type=shop_order&action=-1&s=' . urlencode( $product_title ) . '&shop_order_status=completed,processing,on-hold' );
$orders_link = admin_url( 'edit.php?s&post_status=all&post_type=shop_order&action=-1&s=' . urlencode( $product_title ) . '&shop_order_status=' . implode( ",", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) );
} else {
$product_name = __( 'Product no longer exists', 'woocommerce' );
$orders_link = admin_url( 'edit.php?s&post_status=all&post_type=shop_order&action=-1&s=&shop_order_status=completed,processing,on-hold' );
$orders_link = admin_url( 'edit.php?s&post_status=all&post_type=shop_order&action=-1&s=&shop_order_status=' . implode( ",", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) );
}
echo '<tr><th>' . $product_name . '</th><td width="1%"><span>' . woocommerce_price( $sales ) . '</span></td><td class="bars"><a href="' . esc_url( $orders_link ) . '" style="width:' . esc_attr( $width ) . '%">&nbsp;</a></td></tr>';
@ -1191,7 +1206,7 @@ function woocommerce_product_sales() {
$width = ($sales>0) ? (round($sales) / round($max_sales)) * 100 : 0;
$width2 = ($product_totals[$date]>0) ? (round($product_totals[$date]) / round($max_totals)) * 100 : 0;
$orders_link = admin_url( 'edit.php?s&post_status=all&post_type=shop_order&action=-1&s=' . urlencode( implode( ' ', $chosen_product_titles ) ) . '&m=' . date( 'Ym', strtotime( $date . '01' ) ) . '&shop_order_status=completed,processing,on-hold' );
$orders_link = admin_url( 'edit.php?s&post_status=all&post_type=shop_order&action=-1&s=' . urlencode( implode( ' ', $chosen_product_titles ) ) . '&m=' . date( 'Ym', strtotime( $date . '01' ) ) . '&shop_order_status=' . implode( ",", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) );
echo '<tr><th><a href="' . esc_url( $orders_link ) . '">' . date_i18n( 'F', strtotime( $date . '01' ) ) . '</a></th>
<td width="1%"><span>' . esc_html( $sales ) . '</span><span class="alt">' . woocommerce_price( $product_totals[ $date ] ) . '</span></td>
@ -1643,6 +1658,7 @@ function woocommerce_coupon_discounts() {
<h3><span><?php _e( 'Monthly discounts by coupon', 'woocommerce' ); ?></span></h3>
<div class="inside chart">
<div id="placeholder" style="width:100%; overflow:hidden; height:568px; position:relative;"></div>
<div id="cart_legend"></div>
</div>
</div>
</div>
@ -1671,6 +1687,10 @@ function woocommerce_coupon_discounts() {
echo implode( ',', $labels );
?>
], {
legend: {
container: jQuery('#cart_legend'),
noColumns: 2
},
series: {
lines: { show: true, fill: true },
points: { show: true, align: "left" }
@ -1826,6 +1846,7 @@ function woocommerce_customer_overview() {
<h3><span><?php _e( 'Signups per day', 'woocommerce' ); ?></span></h3>
<div class="inside chart">
<div id="placeholder" style="width:100%; overflow:hidden; height:568px; position:relative;"></div>
<div id="cart_legend"></div>
</div>
</div>
</div>
@ -1877,6 +1898,10 @@ function woocommerce_customer_overview() {
var placeholder = jQuery("#placeholder");
var plot = jQuery.plot(placeholder, [ { data: d } ], {
legend: {
container: jQuery('#cart_legend'),
noColumns: 2
},
series: {
bars: {
barWidth: 60 * 60 * 24 * 1000,
@ -1932,9 +1957,6 @@ function woocommerce_stock_overview() {
$nostockamount = get_option('woocommerce_notify_no_stock_amount');
if (!is_numeric($nostockamount)) $nostockamount = 0;
$outofstock = array();
$lowinstock = array();
// Get low in stock simple/downloadable/virtual products. Grouped don't have stock. Variations need a separate query.
$args = array(
'post_type' => 'product',
@ -1955,12 +1977,14 @@ function woocommerce_stock_overview() {
'tax_query' => array(
array(
'taxonomy' => 'product_type',
'field' => 'slug',
'field' => 'name',
'terms' => array('simple'),
'operator' => 'IN'
)
)
),
'fields' => 'id=>parent'
);
$low_stock_products = (array) get_posts($args);
// Get low stock product variations
@ -1977,14 +2001,16 @@ function woocommerce_stock_overview() {
),
array(
'key' => '_stock',
'value' => array('', false, null),
'value' => array( '', false, null ),
'compare' => 'NOT IN'
)
)
),
'fields' => 'id=>parent'
);
$low_stock_variations = (array) get_posts($args);
// Finally, get low stock variable products (where stock is set for the parent)
// Get low stock variable products (where stock is set for the parent)
$args = array(
'post_type' => array('product'),
'post_status' => 'publish',
@ -2005,17 +2031,35 @@ function woocommerce_stock_overview() {
'tax_query' => array(
array(
'taxonomy' => 'product_type',
'field' => 'slug',
'field' => 'name',
'terms' => array('variable'),
'operator' => 'IN'
)
)
),
'fields' => 'id=>parent'
);
$low_stock_variable_products = (array) get_posts($args);
// Merge results
$low_in_stock = array_merge($low_stock_products, $low_stock_variations, $low_stock_variable_products);
// Get products marked out of stock
$args = array(
'post_type' => array( 'product' ),
'post_status' => 'publish',
'posts_per_page' => -1,
'meta_query' => array(
'relation' => 'AND',
array(
'key' => '_stock_status',
'value' => 'outofstock'
)
),
'fields' => 'id=>parent'
);
$out_of_stock_status_products = (array) get_posts($args);
// Merge results
$low_in_stock = apply_filters( 'woocommerce_reports_stock_overview_products', $low_stock_products + $low_stock_variations + $low_stock_variable_products + $out_of_stock_status_products );
?>
<div id="poststuff" class="woocommerce-reports-wrap halved">
<div class="woocommerce-reports-left">
@ -2025,22 +2069,23 @@ function woocommerce_stock_overview() {
<?php
if ( $low_in_stock ) {
echo '<ul class="stock_list">';
foreach ( $low_in_stock as $product ) {
foreach ( $low_in_stock as $product_id => $parent ) {
$stock = (int) get_post_meta( $product->ID, '_stock', true );
$sku = get_post_meta( $product->ID, '_sku', true );
$stock = (int) get_post_meta( $product_id, '_stock', true );
$sku = get_post_meta( $product_id, '_sku', true );
if ( $stock <= $nostockamount ) continue;
if ( $stock <= $nostockamount || in_array( $product_id, array_keys( $out_of_stock_status_products ) ) )
continue;
$title = esc_html__( $product->post_title );
$title = esc_html__( get_the_title( $product_id ) );
if ( $sku )
$title .= ' (' . __( 'SKU', 'woocommerce' ) . ': ' . esc_html( $sku ) . ')';
if ( $product->post_type=='product' )
$product_url = admin_url( 'post.php?post=' . $product->ID . '&action=edit' );
if ( get_post_type( $product_id ) == 'product' )
$product_url = admin_url( 'post.php?post=' . $product_id . '&action=edit' );
else
$product_url = admin_url( 'post.php?post=' . $product->post_parent . '&action=edit' );
$product_url = admin_url( 'post.php?post=' . $parent . '&action=edit' );
printf( '<li><a href="%s"><small>' . _n('%d in stock', '%d in stock', $stock, 'woocommerce') . '</small> %s</a></li>', $product_url, $stock, $title );
@ -2060,24 +2105,28 @@ function woocommerce_stock_overview() {
<?php
if ( $low_in_stock ) {
echo '<ul class="stock_list">';
foreach ( $low_in_stock as $product ) {
foreach ( $low_in_stock as $product_id => $parent ) {
$stock = (int) get_post_meta( $product->ID, '_stock', true );
$sku = get_post_meta( $product->ID, '_sku', true );
$stock = get_post_meta( $product_id, '_stock', true );
$sku = get_post_meta( $product_id, '_sku', true );
if ( $stock > $nostockamount ) continue;
if ( $stock > $nostockamount && ! in_array( $product_id, array_keys( $out_of_stock_status_products ) ) )
continue;
$title = esc_html__( $product->post_title );
$title = esc_html__( get_the_title( $product_id ) );
if ( $sku )
$title .= ' (' . __( 'SKU', 'woocommerce' ) . ': ' . esc_html( $sku ) . ')';
if ( $product->post_type=='product' )
$product_url = admin_url( 'post.php?post=' . $product->ID . '&action=edit' );
if ( get_post_type( $product_id ) == 'product' )
$product_url = admin_url( 'post.php?post=' . $product_id . '&action=edit' );
else
$product_url = admin_url( 'post.php?post=' . $product->post_parent . '&action=edit' );
$product_url = admin_url( 'post.php?post=' . $parent . '&action=edit' );
printf( '<li><a href="%s"><small>' . _n('%d in stock', '%d in stock', $stock, 'woocommerce') . '</small> %s</a></li>', $product_url, $stock, $title );
if ( $stock == '' )
printf( '<li><a href="%s"><small>' . __('Marked out of stock', 'woocommerce') . '</small> %s</a></li>', $product_url, $title );
else
printf( '<li><a href="%s"><small>' . _n('%d in stock', '%d in stock', $stock, 'woocommerce') . '</small> %s</a></li>', $product_url, $stock, $title );
}
echo '</ul>';
@ -2395,8 +2444,7 @@ function woocommerce_category_sales() {
$first_year = $wpdb->get_var( "SELECT post_date FROM $wpdb->posts WHERE post_date != 0 ORDER BY post_date ASC LIMIT 1;" );
$first_year = ( $first_year ) ? date( 'Y', strtotime( $first_year ) ) : date( 'Y' );
$current_year = isset( $_POST['show_year'] ) ? $_POST['show_year'] : date( 'Y', current_time( 'timestamp' ) );
$start_date = strtotime( $current_year . '0101' );
$current_year = isset( $_POST['show_year'] ) ? $_POST['show_year'] : date( 'Y', current_time( 'timestamp' ) );
$categories = get_terms( 'product_cat', array( 'orderby' => 'name' ) );
?>
@ -2433,8 +2481,6 @@ function woocommerce_category_sales() {
$item_sales = array();
// Get order items
$start_date = date( 'Ym', strtotime( date( 'Ym', strtotime( '-1 year', $start_date ) ) . '01' ) );
$order_items = apply_filters( 'woocommerce_reports_category_sales_order_items', $wpdb->get_results( $wpdb->prepare( "
SELECT order_item_meta_2.meta_value as product_id, posts.post_date, SUM( order_item_meta.meta_value ) as line_total
FROM {$wpdb->prefix}woocommerce_order_items as order_items
@ -2450,13 +2496,13 @@ function woocommerce_category_sales() {
AND posts.post_status = 'publish'
AND tax.taxonomy = 'shop_order_status'
AND term.slug IN ('" . implode( "','", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) . "')
AND date_format(posts.post_date,'%%Y%%m') >= %s
AND date_format(posts.post_date,'%%Y') = %s
AND order_items.order_item_type = 'line_item'
AND order_item_meta.meta_key = '_line_total'
AND order_item_meta_2.meta_key = '_product_id'
GROUP BY order_items.order_id
GROUP BY order_items.order_item_id
ORDER BY posts.post_date ASC
", $start_date ) ) );
", $current_year ) ) );
if ( $order_items ) {
foreach ( $order_items as $order_item ) {
@ -2533,7 +2579,8 @@ function woocommerce_category_sales() {
$total = 0;
}
$month_totals[ $count ] += $total;
if ( sizeof( array_intersect( $include_categories, get_ancestors( $category->term_id, 'product_cat' ) ) ) == 0 )
$month_totals[ $count ] += $total;
$category_sales_html .= '<td>' . woocommerce_price( $total ) . '</td>';
@ -2633,6 +2680,7 @@ function woocommerce_category_sales() {
<h3><span><?php _e( 'Monthly sales by category', 'woocommerce' ); ?></span></h3>
<div class="inside chart">
<div id="placeholder" style="width:100%; overflow:hidden; height:568px; position:relative;"></div>
<div id="cart_legend"></div>
</div>
</div>
</div>
@ -2661,6 +2709,10 @@ function woocommerce_category_sales() {
echo implode( ',', $labels );
?>
], {
legend: {
container: jQuery('#cart_legend'),
noColumns: 2
},
series: {
lines: { show: true, fill: true },
points: { show: true, align: "left" }
@ -2677,7 +2729,7 @@ function woocommerce_category_sales() {
},
xaxis: {
mode: "time",
timeformat: "%b %y",
timeformat: "%b",
monthNames: <?php echo json_encode( array_values( $wp_locale->month_abbrev ) ) ?>,
tickLength: 1,
minTickSize: [1, "month"]
@ -2699,4 +2751,4 @@ function woocommerce_category_sales() {
});
</script>
<?php
}
}

View File

@ -52,20 +52,24 @@ if ( ! function_exists( 'woocommerce_settings' ) ) {
include_once( 'settings/settings-save.php' );
switch ( $current_tab ) {
case "general" :
case "pages" :
case "catalog" :
case "inventory" :
case "payment" :
case "shipping" :
case "tax" :
case "email" :
case "payment_gateways" :
woocommerce_update_options( $woocommerce_settings[ $current_tab ] );
$woocommerce->payment_gateways->process_admin_options();
break;
case "shipping" :
woocommerce_update_options( $woocommerce_settings[ $current_tab ] );
$woocommerce->shipping->process_admin_options();
break;
default :
if ( isset( $woocommerce_settings[ $current_tab ] ) )
woocommerce_update_options( $woocommerce_settings[ $current_tab ] );
// Trigger action for tab
do_action( 'woocommerce_update_options_' . $current_tab );
break;
}
do_action( 'woocommerce_update_options' );
do_action( 'woocommerce_update_options_' . $current_tab );
// Handle Colour Settings
if ( $current_tab == 'general' && get_option('woocommerce_frontend_css') == 'yes' ) {
@ -95,7 +99,7 @@ if ( ! function_exists( 'woocommerce_settings' ) ) {
} else {
// If saving a shipping methods options, load 'er up
if ( $current_tab == 'shipping' && class_exists( $current_section ) ) {
if ( ( $current_tab == 'shipping' || $current_tab == 'payment_gateways' && class_exists( $current_section ) ) ) {
$current_section_class = new $current_section();
do_action( 'woocommerce_update_options_' . $current_tab . '_' . $current_section_class->id );
@ -104,7 +108,7 @@ if ( ! function_exists( 'woocommerce_settings' ) ) {
} elseif ( $current_tab == 'email' ) {
// Load mailer
$mailer = $woocommerce->mailer();
$mailer = $woocommerce->mailer();
if ( class_exists( $current_section ) ) {
$current_section_class = new $current_section();
@ -165,45 +169,8 @@ if ( ! function_exists( 'woocommerce_settings' ) ) {
}
// Hide WC Link
if (isset($_GET['hide-wc-extensions-message']))
update_option('hide-wc-extensions-message', 1);
// Install/page installer
$install_complete = false;
// Add pages button
if (isset($_GET['install_woocommerce_pages']) && $_GET['install_woocommerce_pages']) {
require_once( 'woocommerce-admin-install.php' );
woocommerce_create_pages();
update_option('skip_install_woocommerce_pages', 1);
$install_complete = true;
// Skip button
} elseif (isset($_GET['skip_install_woocommerce_pages']) && $_GET['skip_install_woocommerce_pages']) {
update_option('skip_install_woocommerce_pages', 1);
$install_complete = true;
}
if ($install_complete) {
?>
<div id="message" class="updated woocommerce-message wc-connect">
<div class="squeezer">
<h4><?php _e( '<strong>Congratulations!</strong> &#8211; WooCommerce has been installed and setup. Enjoy :)', 'woocommerce' ); ?></h4>
<p><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/woocommerce/" data-text="A open-source (free) #ecommerce plugin for #WordPress that helps you sell anything. Beautifully." data-via="WooThemes" data-size="large" data-hashtags="WooCommerce">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></p>
</div>
</div>
<?php
// Flush rules after install
flush_rewrite_rules( false );
// Set installed option
update_option('woocommerce_installed', 0);
}
if ( ! empty( $_GET['hide-wc-extensions-message'] ) )
update_option( 'hide-wc-extensions-message', 1 );
?>
<div class="wrap woocommerce">
<form method="post" id="mainform" action="" enctype="multipart/form-data">
@ -221,6 +188,9 @@ if ( ! function_exists( 'woocommerce_settings' ) ) {
'integration' => __( 'Integration', 'woocommerce' )
);
if ( ! $woocommerce->integrations->get_integrations() )
unset( $tabs['integration'] );
$tabs = apply_filters('woocommerce_settings_tabs_array', $tabs);
foreach ( $tabs as $name => $label ) {
@ -345,38 +315,44 @@ if ( ! function_exists( 'woocommerce_settings' ) ) {
}
}
} else {
woocommerce_admin_fields( $woocommerce_settings[$current_tab] );
woocommerce_admin_fields( $woocommerce_settings[ $current_tab ] );
}
break;
case "payment_gateways" :
include('settings/settings-payment-gateways.php');
$links = array( '<a href="#payment-gateways">'.__( 'Payment Gateways', 'woocommerce' ).'</a>' );
$current = $current_section ? '' : 'class="current"';
foreach ( $woocommerce->payment_gateways->payment_gateways() as $gateway ) :
$title = empty( $gateway->method_title ) ? ucwords( $gateway->id ) : ucwords( $gateway->method_title );
$links = array( '<a href="' . admin_url('admin.php?page=woocommerce_settings&tab=payment_gateways') . '" ' . $current . '>' . __( 'Payment Gateways', 'woocommerce' ) . '</a>' );
$links[] = '<a href="#gateway-'.$gateway->id.'">' . esc_html( $title ) . '</a>';
endforeach;
// Load shipping methods so we can show any global options they may have
$payment_gateways = $woocommerce->payment_gateways->payment_gateways();
echo '<div class="subsubsub_section"><ul class="subsubsub"><li>' . implode( ' | </li><li>', $links ) . '</li></ul><br class="clear" />';
foreach ( $payment_gateways as $gateway ) {
echo '<div class="section" id="payment-gateways">';
$title = empty( $gateway->method_title ) ? ucwords( $gateway->id ) : ucwords( $gateway->method_title );
woocommerce_admin_fields( $woocommerce_settings[$current_tab] );
$current = ( get_class( $gateway ) == $current_section ) ? 'class="current"' : '';
echo '</div>';
$links[] = '<a href="' . add_query_arg( 'section', get_class( $gateway ), admin_url('admin.php?page=woocommerce_settings&tab=payment_gateways') ) . '"' . $current . '>' . esc_html( $title ) . '</a>';
}
echo '<ul class="subsubsub"><li>' . implode( ' | </li><li>', $links ) . '</li></ul><br class="clear" />';
// Specific method options
foreach ( $woocommerce->payment_gateways->payment_gateways() as $gateway ) {
echo '<div class="section" id="gateway-'.$gateway->id.'">';
$gateway->admin_options();
echo '</div>';
if ( $current_section ) {
foreach ( $payment_gateways as $gateway ) {
if ( get_class( $gateway ) == $current_section ) {
$gateway->admin_options();
break;
}
}
} else {
woocommerce_admin_fields( $woocommerce_settings[ $current_tab ] );
}
echo '</div>';
break;
case "integration" :
@ -384,6 +360,8 @@ if ( ! function_exists( 'woocommerce_settings' ) ) {
$current_section = empty( $current_section ) ? key( $integrations ) : $current_section;
$links = array();
foreach ( $integrations as $integration ) {
$title = empty( $integration->method_title ) ? ucwords( $integration->id ) : ucwords( $integration->method_title );
@ -413,32 +391,6 @@ if ( ! function_exists( 'woocommerce_settings' ) ) {
<script type="text/javascript">
jQuery(window).load(function(){
// Subsubsub tabs
jQuery('div.subsubsub_section ul.subsubsub li a:eq(0)').addClass('current');
jQuery('div.subsubsub_section .section:gt(0)').hide();
jQuery('div.subsubsub_section ul.subsubsub li a').click(function(){
var $clicked = jQuery(this);
var $section = $clicked.closest('.subsubsub_section');
var $target = $clicked.attr('href');
$section.find('a').removeClass('current');
if ( $section.find('.section:visible').size() > 0 ) {
$section.find('.section:visible').fadeOut( 100, function() {
$section.find( $target ).fadeIn('fast');
});
} else {
$section.find( $target ).fadeIn('fast');
}
$clicked.addClass('current');
jQuery('#last_tab').val( $target );
return false;
});
<?php if ( ! empty( $_GET['subtab'] ) ) echo 'jQuery("div.subsubsub_section ul.subsubsub li a[href=#' . esc_js( $_GET['subtab'] ) . ']").click();'; ?>
// Countries
jQuery('select#woocommerce_allowed_countries').change(function(){
@ -553,10 +505,10 @@ function woocommerce_settings_get_option( $option_name, $default = '' ) {
if ( is_array( $option_value ) )
$option_value = array_map( 'stripslashes', $option_value );
elseif ( $option_value )
elseif ( ! is_null( $option_value ) )
$option_value = stripslashes( $option_value );
return $option_value == null ? $default : $option_value;
return $option_value === null ? $default : $option_value;
}
/**
@ -609,9 +561,13 @@ function woocommerce_admin_fields( $options ) {
}
if ( $tip && in_array( $value['type'], array( 'checkbox' ) ) ) {
$tip = '<span class="help_tip" data-tip="' . esc_attr( $tip ) . '">[?]</span>';
$tip = '<p class="description">' . $tip . '</p>';
} elseif ( $tip ) {
$tip = '<img class="help_tip" data-tip="' . esc_attr( $tip ) . '" src="' . $woocommerce->plugin_url() . '/assets/images/help.png" height="16" width="16" />';
}
// Switch based on type
@ -637,6 +593,7 @@ function woocommerce_admin_fields( $options ) {
case 'email':
case 'number':
case 'color' :
case 'password' :
$type = $value['type'];
$class = '';
@ -704,7 +661,7 @@ function woocommerce_admin_fields( $options ) {
</th>
<td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>">
<select
name="<?php echo esc_attr( $value['id'] ); ?>"
name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) echo '[]'; ?>"
id="<?php echo esc_attr( $value['id'] ); ?>"
style="<?php echo esc_attr( $value['css'] ); ?>"
class="<?php echo esc_attr( $value['class'] ); ?>"
@ -807,7 +764,7 @@ function woocommerce_admin_fields( $options ) {
value="1"
<?php checked( $option_value, 'yes'); ?>
<?php echo implode( ' ', $custom_attributes ); ?>
/> <?php echo wp_kses_post( $value['desc'] ) ?></label> <?php echo $tip; ?><br />
/> <?php echo wp_kses_post( $value['desc'] ) ?></label> <?php echo $tip; ?>
<?php
if ( ! isset( $value['checkboxgroup'] ) || ( isset( $value['checkboxgroup'] ) && $value['checkboxgroup'] == 'end' ) ) {
@ -832,7 +789,7 @@ function woocommerce_admin_fields( $options ) {
$crop = checked( 1, woocommerce_settings_get_option( $value['id'] . '[crop]', $value['default']['crop'] ), false );
?><tr valign="top">
<th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ) ?></th>
<th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ) ?> <?php echo $tip; ?></th>
<td class="forminp">
<?php _e( 'Width', 'woocommerce' ); ?> <input name="<?php echo esc_attr( $value['id'] ); ?>[width]" id="<?php echo esc_attr( $value['id'] ); ?>-width" type="text" size="3" value="<?php echo $width; ?>" />
@ -841,7 +798,7 @@ function woocommerce_admin_fields( $options ) {
<label><?php _e( 'Hard Crop', 'woocommerce' ); ?> <input name="<?php echo esc_attr( $value['id'] ); ?>[crop]" id="<?php echo esc_attr( $value['id'] ); ?>-crop" type="checkbox" <?php echo $crop; ?> /></label>
<?php echo $description; ?></td>
</td>
</tr><?php
break;
@ -924,4 +881,4 @@ function woocommerce_admin_fields( $options ) {
break;
}
}
}
}

View File

@ -15,325 +15,134 @@
* @return void
*/
function woocommerce_status() {
global $woocommerce;
$tools = apply_filters( 'wc_debug_tools', array(
'clear_transients' => array(
'name' => __( 'Transients','woocommerce'),
'button' => __('Clear Transients','woocommerce'),
'desc' => __( 'This tool will clear the product/shop transients cache.', 'woocommerce' ),
),
'recount_terms' => array(
'name' => __('Term counts','woocommerce'),
'button' => __('Recount Terms','woocommerce'),
'desc' => __( 'This tool will recount product terms - useful when changing your settings in a way which hides products from the catalog.', 'woocommerce' ),
),
'reset_roles' => array(
'name' => __('Capabilities','woocommerce'),
'button' => __('Reset Capabilities','woocommerce'),
'desc' => __( 'This tool will reset the admin, customer and shop_manager roles to default. Use this if your users cannot access all of the WooCommerce admin pages.', 'woocommerce' ),
),
) );
global $woocommerce, $wpdb;
$current_tab = ! empty( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : 'status';
?>
<div class="wrap woocommerce">
<div class="icon32 icon32-woocommerce-status" id="icon-woocommerce"><br /></div>
<h2><?php _e( 'System Status', 'woocommerce' ); ?> <a href="#" class="add-new-h2 debug-report"><?php _e('Generate report', 'woocommerce' ); ?></a></h2>
<?php
if ( ! empty( $_GET['action'] ) && ! empty( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'debug_action' ) ) {
switch ( $_GET['action'] ) {
case "clear_transients" :
$woocommerce->clear_product_transients();
echo '<div class="updated"><p>' . __( 'Product Transients Cleared', 'woocommerce' ) . '</p></div>';
break;
case "reset_roles" :
// Remove then re-add caps and roles
woocommerce_remove_roles();
woocommerce_init_roles();
echo '<div class="updated"><p>' . __( 'Roles successfully reset', 'woocommerce' ) . '</p></div>';
break;
case "recount_terms" :
$product_cats = get_terms( 'product_cat', array( 'hide_empty' => false, 'fields' => 'id=>parent' ) );
_woocommerce_term_recount( $product_cats, get_taxonomy( 'product_cat' ), false, false );
$product_tags = get_terms( 'product_tag', array( 'hide_empty' => false, 'fields' => 'id=>parent' ) );
_woocommerce_term_recount( $product_cats, get_taxonomy( 'product_tag' ), false, false );
echo '<div class="updated"><p>' . __( 'Terms successfully recounted', 'woocommerce' ) . '</p></div>';
break;
default:
$action = esc_attr( $_GET['action'] );
if( isset( $tools[ $action ]['callback'] ) ) {
$callback = $tools[ $action ]['callback'];
$return = call_user_func( $callback );
if( $return === false ) {
if( is_array( $callback ) ) {
echo '<div class="error"><p>' . sprintf( __( 'There was an error calling %s::%s', 'woocommerce' ), get_class( $callback[0] ), $callback[1] ) . '</p></div>';
} else {
echo '<div class="error"><p>' . sprintf( __( 'There was an error calling %s', 'woocommerce' ), $callback ) . '</p></div>';
}
}
}
<div class="icon32 icon32-woocommerce-status" id="icon-woocommerce"><br /></div><h2 class="nav-tab-wrapper woo-nav-tab-wrapper">
<?php
$tabs = array(
'status' => __( 'System Status', 'woocommerce' ),
'tools' => __( 'Tools', 'woocommerce' ),
);
foreach ( $tabs as $name => $label ) {
echo '<a href="' . admin_url( 'admin.php?page=woocommerce_status&tab=' . $name ) . '" class="nav-tab ';
if ( $current_tab == $name ) echo 'nav-tab-active';
echo '">' . $label . '</a>';
}
?>
</h2><br/>
<?php
switch ( $current_tab ) {
case "tools" :
woocommerce_status_tools();
break;
default :
woocommerce_status_report();
break;
}
?>
<br/>
<textarea id="debug-report" readonly="readonly"></textarea>
<table class="wc_status_table widefat" cellspacing="0">
</div>
<?php
}
<thead>
<tr>
<th colspan="2"><?php _e( 'Versions', 'woocommerce' ); ?></th>
</tr>
</thead>
/**
* woocommerce_status_report function.
*
* @access public
* @return void
*/
function woocommerce_status_report() {
global $woocommerce, $wpdb;
<tbody>
<tr>
<td><?php _e('WooCommerce version','woocommerce')?></td>
<td><?php echo esc_html( $woocommerce->version ); ?></td>
</tr>
<tr>
<td><?php _e('WooCommerce DB version','woocommerce')?></td>
<td><?php echo esc_html( get_option( 'woocommerce_db_version' ) ); ?></td>
</tr>
<tr>
<td><?php _e('WordPress version','woocommerce')?></td>
<td><?php if ( is_multisite() ) echo 'WPMU'; else echo 'WP'; ?> <?php echo bloginfo('version'); ?></td>
</tr>
<tr>
<td><?php _e('Installed plugins','woocommerce')?></td>
<td><?php
$active_plugins = (array) get_option( 'active_plugins', array() );
?>
<div class="woocommerce-message">
<div class="squeezer">
<h4><?php _e( 'Please include this information when requesting support:', 'woocommerce' ); ?> </h4>
<p class="submit"><a href="#" download="wc_report.txt" class="button-primary debug-report"><?php _e( 'Download System Report File', 'woocommerce' ); ?></a></p>
</div>
</div>
<br/>
<table class="wc_status_table widefat" cellspacing="0">
if ( is_multisite() )
$active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
<thead>
<tr>
<th colspan="2"><?php _e( 'Environment', 'woocommerce' ); ?></th>
</tr>
</thead>
$wc_plugins = array();
<tbody>
<tr>
<td><?php _e( 'Home URL','woocommerce' ); ?>:</td>
<td><?php echo home_url(); ?></td>
</tr>
<tr>
<td><?php _e( 'Site URL','woocommerce' ); ?>:</td>
<td><?php echo site_url(); ?></td>
</tr>
<tr>
<td><?php _e( 'WC Version','woocommerce' ); ?>:</td>
<td><?php echo esc_html( $woocommerce->version ); ?></td>
</tr>
<tr>
<td><?php _e( 'WC Database Version','woocommerce' ); ?>:</td>
<td><?php echo esc_html( get_option( 'woocommerce_db_version' ) ); ?></td>
</tr>
<tr>
<td><?php _e( 'WP Version','woocommerce' ); ?>:</td>
<td><?php if ( is_multisite() ) echo 'WPMU'; else echo 'WP'; ?> <?php echo bloginfo('version'); ?></td>
</tr>
<tr>
<td><?php _e( 'Web Server Info','woocommerce' ); ?>:</td>
<td><?php echo esc_html( $_SERVER['SERVER_SOFTWARE'] ); ?></td>
</tr>
<tr>
<td><?php _e( 'PHP Version','woocommerce' ); ?>:</td>
<td><?php if ( function_exists( 'phpversion' ) ) echo esc_html( phpversion() ); ?></td>
</tr>
<tr>
<td><?php _e( 'MySQL Version','woocommerce' ); ?>:</td>
<td><?php if ( function_exists( 'mysql_get_server_info' ) ) echo esc_html( mysql_get_server_info() ); ?></td>
</tr>
<tr>
<td><?php _e( 'WP Memory Limit','woocommerce' ); ?>:</td>
<td><?php
$memory = woocommerce_let_to_num( WP_MEMORY_LIMIT );
foreach ( $active_plugins as $plugin ) {
$plugin_data = @get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
if ( ! empty( $plugin_data['Name'] ) ) {
$wc_plugins[] = $plugin_data['Name'] . ' ' . __( 'by', 'woocommerce' ) . ' ' . $plugin_data['Author'] . ' ' . __( 'version', 'woocommerce' ) . ' ' . $plugin_data['Version'];
}
}
if ( sizeof( $wc_plugins ) == 0 ) echo '-'; else echo '<ul><li>' . implode( ', </li><li>', $wc_plugins ) . '</li></ul>';
?></td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="2"><?php _e( 'Settings', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><?php _e('Home URL','woocommerce')?></td>
<td><?php echo home_url(); ?></td>
</tr>
<tr>
<td><?php _e('Site URL','woocommerce')?></td>
<td><?php echo site_url(); ?></td>
</tr>
<tr>
<td><?php _e('Force SSL','woocommerce')?></td>
<td><?php echo ( get_option( 'woocommerce_force_ssl_checkout' ) === 'yes' ) ? '<mark class="yes">'.__( 'Yes', 'woocommerce' ).'</mark>' : '<mark class="no">'.__( 'No', 'woocommerce' ).'</mark>'; ?></td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="2"><?php _e( 'Shop Pages', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<?php
$check_pages = array(
__( 'Shop base page', 'woocommerce' ) => array(
'option' => 'woocommerce_shop_page_id',
'shortcode' => ''
),
__( 'Cart Page', 'woocommerce' ) => array(
'option' => 'woocommerce_cart_page_id',
'shortcode' => '[woocommerce_cart]'
),
__( 'Checkout Page', 'woocommerce' ) => array(
'option' => 'woocommerce_checkout_page_id',
'shortcode' => '[woocommerce_checkout]'
),
__( 'Pay Page', 'woocommerce' ) => array(
'option' => 'woocommerce_pay_page_id',
'shortcode' => '[woocommerce_pay]'
),
__( 'Thanks Page', 'woocommerce' ) => array(
'option' => 'woocommerce_thanks_page_id',
'shortcode' => '[woocommerce_thankyou]'
),
__( 'My Account Page', 'woocommerce' ) => array(
'option' => 'woocommerce_myaccount_page_id',
'shortcode' => '[woocommerce_my_account]'
),
__( 'Edit Address Page', 'woocommerce' ) => array(
'option' => 'woocommerce_edit_address_page_id',
'shortcode' => '[woocommerce_edit_address]'
),
__( 'View Order Page', 'woocommerce' ) => array(
'option' => 'woocommerce_view_order_page_id',
'shortcode' => '[woocommerce_view_order]'
),
__( 'Change Password Page', 'woocommerce' ) => array(
'option' => 'woocommerce_change_password_page_id',
'shortcode' => '[woocommerce_change_password]'
)
);
$alt = 1;
foreach ( $check_pages as $page_name => $values ) {
if ( $alt == 1 ) echo '<tr>'; else echo '<tr>';
echo '<td>' . esc_html( $page_name ) . '</td><td>';
$error = false;
$page_id = get_option($values['option']);
// Page ID check
if ( ! $page_id ) {
echo '<mark class="error">' . __( 'Page not set', 'woocommerce' ) . '</mark>';
$error = true;
} else {
// Shortcode check
if ( $values['shortcode'] ) {
$page = get_post( $page_id );
if ( ! strstr( $page->post_content, $values['shortcode'] ) ) {
echo '<mark class="error">' . sprintf(__( 'Page does not contain the shortcode: %s', 'woocommerce' ), $values['shortcode'] ) . '</mark>';
$error = true;
}
}
}
if ( ! $error ) echo '<mark class="yes">#' . absint( $page_id ) . ' - ' . get_permalink( $page_id ) . '</mark>';
echo '</td></tr>';
$alt = $alt * -1;
}
?>
</tbody>
<thead>
<tr>
<th colspan="2"><?php _e( 'Core Taxonomies', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><?php _e('Order Statuses','woocommerce')?></td>
<td><?php
$order_statuses = get_terms( 'shop_order_status', array( 'fields' => 'names', 'hide_empty' => 0 ) );
echo implode( ', ', array_map( 'esc_html', $order_statuses ) );
?></td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="2"><?php _e( 'Server Environment', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><?php _e('PHP Version','woocommerce')?></td>
<td><?php
if ( function_exists( 'phpversion' ) )
echo esc_html( phpversion() );
?></td>
</tr>
<tr>
<td><?php _e('Server Software','woocommerce')?></td>
<td><?php
echo esc_html( $_SERVER['SERVER_SOFTWARE'] );
?></td>
</tr>
<tr>
<td><?php _e('WP Max Upload Size','woocommerce'); ?></td>
<td><?php
echo wp_convert_bytes_to_hr( wp_max_upload_size() );
?></td>
</tr>
<tr>
<td><?php _e('Server upload_max_filesize','woocommerce')?></td>
<td><?php
if(function_exists('phpversion'))
echo wp_convert_bytes_to_hr( woocommerce_let_to_num( ini_get('upload_max_filesize') ) );
?></td>
</tr>
<tr>
<td><?php _e('Server post_max_size','woocommerce')?></td>
<td><?php
if(function_exists('phpversion'))
echo wp_convert_bytes_to_hr( woocommerce_let_to_num( ini_get('post_max_size') ) );
?></td>
</tr>
<tr>
<td><?php _e('WP Memory Limit','woocommerce')?></td>
<td><?php
$memory = woocommerce_let_to_num( WP_MEMORY_LIMIT );
if ( $memory < 67108864 ) {
echo '<mark class="error">' . sprintf( __( '%s - We recommend setting memory to at least 64MB. See: <a href="%s">Increasing memory allocated to PHP</a>', 'woocommerce' ), wp_convert_bytes_to_hr( $memory ), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP' ) . '</mark>';
} else {
echo '<mark class="yes">' . wp_convert_bytes_to_hr( $memory ) . '</mark>';
}
?></td>
</tr>
<tr>
<td><?php _e('WP Debug Mode','woocommerce')?></td>
<td><?php if ( defined('WP_DEBUG') && WP_DEBUG ) echo '<mark class="yes">' . __( 'Yes', 'woocommerce' ) . '</mark>'; else echo '<mark class="no">' . __( 'No', 'woocommerce' ) . '</mark>'; ?></td>
</tr>
<tr>
<td><?php _e('WC Logging','woocommerce')?></td>
<td><?php
if ( @fopen( $woocommerce->plugin_path() . '/logs/paypal.txt', 'a' ) )
echo '<mark class="yes">' . __( 'Log directory is writable.', 'woocommerce' ) . '</mark>';
else
echo '<mark class="error">' . __( 'Log directory (<code>woocommerce/logs/</code>) is not writable. Logging will not be possible.', 'woocommerce' ) . '</mark>';
?></td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="2"><?php _e( 'Remote Posting/IPN', 'woocommerce' ); ?></th>
</tr>
</thead>
<?php
if ( $memory < 67108864 ) {
echo '<mark class="error">' . sprintf( __( '%s - We recommend setting memory to at least 64MB. See: <a href="%s">Increasing memory allocated to PHP</a>', 'woocommerce' ), wp_convert_bytes_to_hr( $memory ), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP' ) . '</mark>';
} else {
echo '<mark class="yes">' . wp_convert_bytes_to_hr( $memory ) . '</mark>';
}
?></td>
</tr>
<tr>
<td><?php _e( 'WP Debug Mode','woocommerce' ); ?>:</td>
<td><?php if ( defined('WP_DEBUG') && WP_DEBUG ) echo '<mark class="yes">' . __( 'Yes', 'woocommerce' ) . '</mark>'; else echo '<mark class="no">' . __( 'No', 'woocommerce' ) . '</mark>'; ?></td>
</tr>
<tr>
<td><?php _e( 'WP Max Upload Size','woocommerce' ); ?>:</td>
<td><?php echo wp_convert_bytes_to_hr( wp_max_upload_size() ); ?></td>
</tr>
<tr>
<td><?php _e('PHP Post Max Size','woocommerce' ); ?>:</td>
<td><?php if ( function_exists( 'ini_get' ) ) echo wp_convert_bytes_to_hr( woocommerce_let_to_num( ini_get('post_max_size') ) ); ?></td>
</tr>
<tr>
<td><?php _e('PHP Time Limit','woocommerce' ); ?>:</td>
<td><?php if ( function_exists( 'ini_get' ) ) echo ini_get('max_execution_time'); ?></td>
</tr>
<tr>
<td><?php _e( 'WC Logging','woocommerce' ); ?>:</td>
<td><?php
if ( @fopen( $woocommerce->plugin_path() . '/logs/paypal.txt', 'a' ) )
echo '<mark class="yes">' . __( 'Log directory is writable.', 'woocommerce' ) . '</mark>';
else
echo '<mark class="error">' . __( 'Log directory (<code>woocommerce/logs/</code>) is not writable. Logging will not be possible.', 'woocommerce' ) . '</mark>';
?></td>
</tr>
<?php
$posting = array();
// fsockopen/cURL
@ -348,22 +157,22 @@ function woocommerce_status() {
}
$posting['fsockopen_curl']['success'] = true;
} else {
$posting['fsockopen_curl']['note'] = __( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'woocommerce' ). '</mark>';
$posting['fsockopen_curl']['success'] = false;
}
$posting['fsockopen_curl']['note'] = __( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'woocommerce' ). '</mark>';
$posting['fsockopen_curl']['success'] = false;
}
// SOAP
$posting['soap_client']['name'] = __( 'SOAP Client','woocommerce' );
// SOAP
$posting['soap_client']['name'] = __( 'SOAP Client','woocommerce' );
if ( class_exists( 'SoapClient' ) ) {
$posting['soap_client']['note'] = __('Your server has the SOAP Client class enabled.', 'woocommerce' );
$posting['soap_client']['success'] = true;
} else {
$posting['soap_client']['note'] = sprintf( __( 'Your server does not have the <a href="%s">SOAP Client</a> class enabled - some gateway plugins which use SOAP may not work as expected.', 'woocommerce' ), 'http://php.net/manual/en/class.soapclient.php' ) . '</mark>';
$posting['soap_client']['success'] = false;
}
$posting['soap_client']['note'] = sprintf( __( 'Your server does not have the <a href="%s">SOAP Client</a> class enabled - some gateway plugins which use SOAP may not work as expected.', 'woocommerce' ), 'http://php.net/manual/en/class.soapclient.php' ) . '</mark>';
$posting['soap_client']['success'] = false;
}
// WP Remote Post Check
$posting['wp_remote_post']['name'] = __( 'WP Remote Post Check','woocommerce');
// WP Remote Post Check
$posting['wp_remote_post']['name'] = __( 'WP Remote Post','woocommerce');
$request['cmd'] = '_notify-validate';
$params = array(
'sslverify' => false,
@ -374,101 +183,459 @@ function woocommerce_status() {
$response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params );
if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
$posting['wp_remote_post']['note'] = __('wp_remote_post() was successful - PayPal IPN is working.', 'woocommerce' );
$posting['wp_remote_post']['success'] = true;
} elseif ( is_wp_error( $response ) ) {
$posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider. Error:', 'woocommerce' ) . ' ' . $response->get_error_message();
$posting['wp_remote_post']['success'] = false;
} else {
$posting['wp_remote_post']['note'] = __('wp_remote_post() was successful - PayPal IPN is working.', 'woocommerce' );
$posting['wp_remote_post']['success'] = true;
} elseif ( is_wp_error( $response ) ) {
$posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider. Error:', 'woocommerce' ) . ' ' . $response->get_error_message();
$posting['wp_remote_post']['success'] = false;
} else {
$posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN may not work with your server.', 'woocommerce' );
$posting['wp_remote_post']['success'] = false;
}
$posting['wp_remote_post']['success'] = false;
}
$posting = apply_filters( 'wc_debug_posting', $posting );
?>
$posting = apply_filters( 'woocommerce_debug_posting', $posting );
<tbody>
<?php foreach($posting as $post) { $mark = ( isset( $post['success'] ) && $post['success'] == true ) ? 'yes' : 'error'; ?>
<tr>
<td><?php echo esc_html( $post['name'] ); ?></td>
<td>
<mark class="<?php echo $mark; ?>">
<?php echo wp_kses_data( $post['note'] ); ?>
</mark>
</td>
</tr>
<?php } ?>
</tbody>
foreach( $posting as $post ) { $mark = ( isset( $post['success'] ) && $post['success'] == true ) ? 'yes' : 'error';
?>
<tr>
<td><?php echo esc_html( $post['name'] ); ?>:</td>
<td>
<mark class="<?php echo $mark; ?>">
<?php echo wp_kses_data( $post['note'] ); ?>
</mark>
</td>
</tr>
<?php
}
?>
</tbody>
<thead class="tools">
<tr>
<th colspan="2"><?php _e( 'Tools', 'woocommerce' ); ?></th>
</tr>
</thead>
<thead>
<tr>
<th colspan="2"><?php _e( 'Plugins', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody class="tools">
<?php foreach($tools as $action => $tool) { ?>
<tr>
<td><?php echo esc_html( $tool['name'] ); ?></td>
<td>
<p>
<a href="<?php echo wp_nonce_url( admin_url('admin.php?page=woocommerce_status&action=' . $action ), 'debug_action' ); ?>" class="button"><?php echo esc_html( $tool['button'] ); ?></a>
<span class="description"><?php echo wp_kses_post( $tool['desc'] ); ?></span>
</p>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<tbody>
<tr>
<td><?php _e( 'Installed Plugins','woocommerce' ); ?>:</td>
<td><?php
$active_plugins = (array) get_option( 'active_plugins', array() );
</div>
<script type="text/javascript">
if ( is_multisite() )
$active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
jQuery('a.debug-report').click(function(){
$wc_plugins = array();
if ( ! jQuery('#debug-report').val() ) {
foreach ( $active_plugins as $plugin ) {
// Generate report - user can paste into forum
var report = '`';
$plugin_data = @get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
jQuery('thead:not(".tools"), tbody:not(".tools")', '.wc_status_table').each(function(){
if ( ! empty( $plugin_data['Name'] ) ) {
$this = jQuery( this );
$wc_plugins[] = $plugin_data['Name'] . ' ' . __( 'by', 'woocommerce' ) . ' ' . $plugin_data['Author'] . ' ' . __( 'version', 'woocommerce' ) . ' ' . $plugin_data['Version'];
if ( $this.is('thead') ) {
}
}
report = report + "\n=============================================================================================\n";
report = report + " " + jQuery.trim( $this.text() ) + "\n";
report = report + "=============================================================================================\n";
if ( sizeof( $wc_plugins ) == 0 )
echo '-';
else
echo implode( ', <br/>', $wc_plugins );
?></td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="2"><?php _e( 'Settings', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><?php _e( 'Force SSL','woocommerce' ); ?>:</td>
<td><?php echo get_option( 'woocommerce_force_ssl_checkout' ) === 'yes' ? '<mark class="yes">'.__( 'Yes', 'woocommerce' ).'</mark>' : '<mark class="no">'.__( 'No', 'woocommerce' ).'</mark>'; ?></td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="2"><?php _e( 'WC Pages', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<?php
$check_pages = array(
__( 'Shop Base', 'woocommerce' ) => array(
'option' => 'woocommerce_shop_page_id',
'shortcode' => ''
),
__( 'Cart', 'woocommerce' ) => array(
'option' => 'woocommerce_cart_page_id',
'shortcode' => '[woocommerce_cart]'
),
__( 'Checkout', 'woocommerce' ) => array(
'option' => 'woocommerce_checkout_page_id',
'shortcode' => '[woocommerce_checkout]'
),
__( 'Pay', 'woocommerce' ) => array(
'option' => 'woocommerce_pay_page_id',
'shortcode' => '[woocommerce_pay]'
),
__( 'Thanks', 'woocommerce' ) => array(
'option' => 'woocommerce_thanks_page_id',
'shortcode' => '[woocommerce_thankyou]'
),
__( 'My Account', 'woocommerce' ) => array(
'option' => 'woocommerce_myaccount_page_id',
'shortcode' => '[woocommerce_my_account]'
),
__( 'Edit Address', 'woocommerce' ) => array(
'option' => 'woocommerce_edit_address_page_id',
'shortcode' => '[woocommerce_edit_address]'
),
__( 'View Order', 'woocommerce' ) => array(
'option' => 'woocommerce_view_order_page_id',
'shortcode' => '[woocommerce_view_order]'
),
__( 'Change Password', 'woocommerce' ) => array(
'option' => 'woocommerce_change_password_page_id',
'shortcode' => '[woocommerce_change_password]'
),
__( 'Lost Password', 'woocommerce' ) => array(
'option' => 'woocommerce_lost_password_page_id',
'shortcode' => '[woocommerce_lost_password]'
)
);
$alt = 1;
foreach ( $check_pages as $page_name => $values ) {
if ( $alt == 1 ) echo '<tr>'; else echo '<tr>';
echo '<td>' . esc_html( $page_name ) . ':</td><td>';
$error = false;
$page_id = get_option( $values['option'] );
// Page ID check
if ( ! $page_id ) {
echo '<mark class="error">' . __( 'Page not set', 'woocommerce' ) . '</mark>';
$error = true;
} else {
jQuery('tr', $this).each(function(){
// Shortcode check
if ( $values['shortcode'] ) {
$page = get_post( $page_id );
$this = jQuery( this );
if ( empty( $page ) ) {
report = report + $this.find('td:eq(0)').text() + ": \t";
report = report + $this.find('td:eq(1)').text() + "\n";
echo '<mark class="error">' . sprintf( __( 'Page does not exist', 'woocommerce' ) ) . '</mark>';
$error = true;
});
} else if ( ! strstr( $page->post_content, $values['shortcode'] ) ) {
echo '<mark class="error">' . sprintf( __( 'Page does not contain the shortcode: %s', 'woocommerce' ), $values['shortcode'] ) . '</mark>';
$error = true;
}
}
}
});
if ( ! $error ) echo '<mark class="yes">#' . absint( $page_id ) . ' - ' . str_replace( home_url(), '', get_permalink( $page_id ) ) . '</mark>';
report = report + '`';
echo '</td></tr>';
jQuery('#debug-report').val( report );
$alt = $alt * -1;
}
?>
</tbody>
<thead>
<tr>
<th colspan="2"><?php _e( 'WC Taxonomies', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><?php _e( 'Order Statuses', 'woocommerce' ); ?>:</td>
<td><?php
$display_terms = array();
$terms = get_terms( 'shop_order_status', array( 'hide_empty' => 0 ) );
foreach ( $terms as $term )
$display_terms[] = $term->name . ' (' . $term->slug . ')';
echo implode( ', ', array_map( 'esc_html', $display_terms ) );
?></td>
</tr>
<tr>
<td><?php _e( 'Product Types', 'woocommerce' ); ?>:</td>
<td><?php
$display_terms = array();
$terms = get_terms( 'product_type', array( 'hide_empty' => 0 ) );
foreach ( $terms as $term )
$display_terms[] = $term->name . ' (' . $term->slug . ')';
echo implode( ', ', array_map( 'esc_html', $display_terms ) );
?></td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="2"><?php _e( 'Templates', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><?php _e( 'Template Overrides', 'woocommerce' ); ?>:</td>
<td><?php
$template_path = $woocommerce->plugin_path() . '/templates/';
$found_files = array();
$files = woocommerce_scan_template_files( $template_path );
foreach ( $files as $file ) {
if ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
$found_files[] = '/' . $file;
} elseif( file_exists( get_stylesheet_directory() . '/woocommerce/' . $file ) ) {
$found_files[] = '/woocommerce/' . $file;
}
}
if ( $found_files ) {
echo implode( ', <br/>', $found_files );
} else {
_e( 'No core overrides present in theme.', 'woocommerce' );
}
?></td>
</tr>
</tbody>
</table>
<script type="text/javascript">
jQuery.wc_strPad = function(i,l,s) {
var o = i.toString();
if (!s) { s = '0'; }
while (o.length < l) {
o = o + s;
}
return o;
};
jQuery('#debug-report').slideToggle('500', function() {
jQuery(this).select();
});
jQuery('a.debug-report').click(function(){
return false;
var report = "data:text/plain;charset=utf-8,";
jQuery('.wc_status_table thead, .wc_status_table tbody').each(function(){
$this = jQuery( this );
if ( $this.is('thead') ) {
report = report + "\n### " + jQuery.trim( $this.text() ) + " ###\n\n";
} else {
jQuery('tr', $this).each(function(){
$this = jQuery( this );
name = jQuery.wc_strPad( jQuery.trim( $this.find('td:eq(0)').text() ), 25, ' ' );
value = jQuery.trim( $this.find('td:eq(1)').text() );
report = report + '' + name + value + "\n\n";
});
}
} );
jQuery(this).attr( 'href', encodeURI( report ) );
return true;
});
</script>
<?php
}
/**
* woocommerce_scan_template_files function.
*
* @access public
* @param mixed $template_path
* @return void
*/
function woocommerce_scan_template_files( $template_path ) {
$files = scandir( $template_path );
$result = array();
if ( $files ) {
foreach ( $files as $key => $value ) {
if ( ! in_array( $value, array( ".",".." ) ) ) {
if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) {
$sub_files = woocommerce_scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value );
foreach ( $sub_files as $sub_file ) {
$result[] = $value . DIRECTORY_SEPARATOR . $sub_file;
}
} else {
$result[] = $value;
}
}
}
}
return $result;
}
/**
* woocommerce_status_tools function.
*
* @access public
* @return void
*/
function woocommerce_status_tools() {
global $woocommerce, $wpdb;
$tools = apply_filters( 'woocommerce_debug_tools', array(
'clear_transients' => array(
'name' => __( 'WC Transients','woocommerce'),
'button' => __('Clear transients','woocommerce'),
'desc' => __( 'This tool will clear the product/shop transients cache.', 'woocommerce' ),
),
'clear_expired_transients' => array(
'name' => __( 'Expired Transients','woocommerce'),
'button' => __('Clear expired transients','woocommerce'),
'desc' => __( 'This tool will clear ALL expired transients from Wordpress.', 'woocommerce' ),
),
'recount_terms' => array(
'name' => __('Term counts','woocommerce'),
'button' => __('Recount terms','woocommerce'),
'desc' => __( 'This tool will recount product terms - useful when changing your settings in a way which hides products from the catalog.', 'woocommerce' ),
),
'reset_roles' => array(
'name' => __('Capabilities','woocommerce'),
'button' => __('Reset capabilities','woocommerce'),
'desc' => __( 'This tool will reset the admin, customer and shop_manager roles to default. Use this if your users cannot access all of the WooCommerce admin pages.', 'woocommerce' ),
),
) );
if ( ! empty( $_GET['action'] ) && ! empty( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'debug_action' ) ) {
switch ( $_GET['action'] ) {
case "clear_transients" :
$woocommerce->clear_product_transients();
echo '<div class="updated"><p>' . __( 'Product Transients Cleared', 'woocommerce' ) . '</p></div>';
break;
case "clear_expired_transients" :
// http://w-shadow.com/blog/2012/04/17/delete-stale-transients/
$rows = $wpdb->query( "
DELETE
a, b
FROM
{$wpdb->options} a, {$wpdb->options} b
WHERE
a.option_name LIKE '_transient_%' AND
a.option_name NOT LIKE '_transient_timeout_%' AND
b.option_name = CONCAT(
'_transient_timeout_',
SUBSTRING(
a.option_name,
CHAR_LENGTH('_transient_') + 1
)
)
AND b.option_value < UNIX_TIMESTAMP()
" );
$rows2 = $wpdb->query( "
DELETE
a, b
FROM
{$wpdb->options} a, {$wpdb->options} b
WHERE
a.option_name LIKE '_site_transient_%' AND
a.option_name NOT LIKE '_site_transient_timeout_%' AND
b.option_name = CONCAT(
'_site_transient_timeout_',
SUBSTRING(
a.option_name,
CHAR_LENGTH('_site_transient_') + 1
)
)
AND b.option_value < UNIX_TIMESTAMP()
" );
echo '<div class="updated"><p>' . sprintf( __( '%d Transients Rows Cleared', 'woocommerce' ), $rows + $rows2 ) . '</p></div>';
break;
case "reset_roles" :
// Remove then re-add caps and roles
woocommerce_remove_roles();
woocommerce_init_roles();
echo '<div class="updated"><p>' . __( 'Roles successfully reset', 'woocommerce' ) . '</p></div>';
break;
case "recount_terms" :
$product_cats = get_terms( 'product_cat', array( 'hide_empty' => false, 'fields' => 'id=>parent' ) );
_woocommerce_term_recount( $product_cats, get_taxonomy( 'product_cat' ), false, false );
$product_tags = get_terms( 'product_tag', array( 'hide_empty' => false, 'fields' => 'id=>parent' ) );
_woocommerce_term_recount( $product_cats, get_taxonomy( 'product_tag' ), false, false );
echo '<div class="updated"><p>' . __( 'Terms successfully recounted', 'woocommerce' ) . '</p></div>';
break;
default:
$action = esc_attr( $_GET['action'] );
if( isset( $tools[ $action ]['callback'] ) ) {
$callback = $tools[ $action ]['callback'];
$return = call_user_func( $callback );
if( $return === false ) {
if( is_array( $callback ) ) {
echo '<div class="error"><p>' . sprintf( __( 'There was an error calling %s::%s', 'woocommerce' ), get_class( $callback[0] ), $callback[1] ) . '</p></div>';
} else {
echo '<div class="error"><p>' . sprintf( __( 'There was an error calling %s', 'woocommerce' ), $callback ) . '</p></div>';
}
}
}
}
}
?>
<table class="wc_status_table widefat" cellspacing="0">
<thead class="tools">
<tr>
<th colspan="2"><?php _e( 'Tools', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody class="tools">
<?php foreach($tools as $action => $tool) { ?>
<tr>
<td><?php echo esc_html( $tool['name'] ); ?></td>
<td>
<p>
<a href="<?php echo wp_nonce_url( admin_url('admin.php?page=woocommerce_status&tab=tools&action=' . $action ), 'debug_action' ); ?>" class="button"><?php echo esc_html( $tool['button'] ); ?></a>
<span class="description"><?php echo wp_kses_post( $tool['desc'] ); ?></span>
</p>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php
}

View File

@ -44,38 +44,42 @@ function woocommerce_add_category_fields() {
if ( ! jQuery('#product_cat_thumbnail_id').val() )
jQuery('.remove_image_button').hide();
window.send_to_editor_default = window.send_to_editor;
// Uploading files
var file_frame;
window.send_to_termmeta = function(html) {
jQuery(document).on( 'click', '.upload_image_button', function( event ){
jQuery('body').append('<div id="temp_image">' + html + '</div>');
event.preventDefault();
var img = jQuery('#temp_image').find('img');
// If the media frame already exists, reopen it.
if ( file_frame ) {
file_frame.open();
return;
}
imgurl = img.attr('src');
imgclass = img.attr('class');
imgid = parseInt(imgclass.replace(/\D/g, ''), 10);
// Create the media frame.
file_frame = wp.media.frames.downloadable_file = wp.media({
title: '<?php _e( 'Choose an image', 'woocommerce' ); ?>',
button: {
text: '<?php _e( 'Use image', 'woocommerce' ); ?>',
},
multiple: false
});
jQuery('#product_cat_thumbnail_id').val(imgid);
jQuery('#product_cat_thumbnail img').attr('src', imgurl);
jQuery('.remove_image_button').show();
jQuery('#temp_image').remove();
// When an image is selected, run a callback.
file_frame.on( 'select', function() {
attachment = file_frame.state().get('selection').first().toJSON();
tb_remove();
jQuery('#product_cat_thumbnail_id').val( attachment.id );
jQuery('#product_cat_thumbnail img').attr('src', attachment.url );
jQuery('.remove_image_button').show();
});
window.send_to_editor = window.send_to_editor_default;
}
jQuery('.upload_image_button').live('click', function(){
var post_id = 0;
window.send_to_editor = window.send_to_termmeta;
tb_show('', 'media-upload.php?post_id=' + post_id + '&amp;type=image&amp;TB_iframe=true');
return false;
// Finally, open the modal.
file_frame.open();
});
jQuery('.remove_image_button').live('click', function(){
jQuery(document).on( 'click', '.remove_image_button', function( event ){
jQuery('#product_cat_thumbnail img').attr('src', '<?php echo woocommerce_placeholder_img_src(); ?>');
jQuery('#product_cat_thumbnail_id').val('');
jQuery('.remove_image_button').hide();
@ -132,35 +136,45 @@ function woocommerce_edit_category_fields( $term, $taxonomy ) {
</div>
<script type="text/javascript">
window.send_to_termmeta = function(html) {
// Uploading files
var file_frame;
jQuery('body').append('<div id="temp_image">' + html + '</div>');
jQuery(document).on( 'click', '.upload_image_button', function( event ){
var img = jQuery('#temp_image').find('img');
event.preventDefault();
imgurl = img.attr('src');
imgclass = img.attr('class');
imgid = parseInt(imgclass.replace(/\D/g, ''), 10);
// If the media frame already exists, reopen it.
if ( file_frame ) {
file_frame.open();
return;
}
jQuery('#product_cat_thumbnail_id').val(imgid);
jQuery('#product_cat_thumbnail img').attr('src', imgurl);
jQuery('#temp_image').remove();
// Create the media frame.
file_frame = wp.media.frames.downloadable_file = wp.media({
title: '<?php _e( 'Choose an image', 'woocommerce' ); ?>',
button: {
text: '<?php _e( 'Use image', 'woocommerce' ); ?>',
},
multiple: false
});
tb_remove();
}
// When an image is selected, run a callback.
file_frame.on( 'select', function() {
attachment = file_frame.state().get('selection').first().toJSON();
jQuery('.upload_image_button').live('click', function(){
var post_id = 0;
jQuery('#product_cat_thumbnail_id').val( attachment.id );
jQuery('#product_cat_thumbnail img').attr('src', attachment.url );
jQuery('.remove_image_button').show();
});
window.send_to_editor = window.send_to_termmeta;
tb_show('', 'media-upload.php?post_id=' + post_id + '&amp;type=image&amp;TB_iframe=true');
return false;
// Finally, open the modal.
file_frame.open();
});
jQuery('.remove_image_button').live('click', function(){
jQuery(document).on( 'click', '.remove_image_button', function( event ){
jQuery('#product_cat_thumbnail img').attr('src', '<?php echo woocommerce_placeholder_img_src(); ?>');
jQuery('#product_cat_thumbnail_id').val('');
jQuery('.remove_image_button').hide();
return false;
});
@ -189,6 +203,8 @@ function woocommerce_category_fields_save( $term_id, $tt_id, $taxonomy ) {
if ( isset( $_POST['product_cat_thumbnail_id'] ) )
update_woocommerce_term_meta( $term_id, 'thumbnail_id', absint( $_POST['product_cat_thumbnail_id'] ) );
delete_transient( 'wc_term_counts' );
}
add_action( 'created_term', 'woocommerce_category_fields_save', 10,3 );
@ -328,7 +344,7 @@ add_filter( 'manage_product_cat_custom_column', 'woocommerce_product_cat_column'
* @return void
*/
function woocommerce_shipping_class_columns( $columns ) {
$columns['configure'] = '&nbsp;';
$columns['edit'] = '&nbsp;';
return $columns;
}
@ -345,8 +361,8 @@ add_filter( 'manage_edit-product_shipping_class_columns', 'woocommerce_shipping_
* @return void
*/
function woocommerce_shipping_class_column( $columns, $column, $id ) {
if ( $column == 'configure' )
$columns .= '<a href="'. admin_url( 'edit-tags.php?action=edit&taxonomy=product_shipping_class&tag_ID='. $id .'&post_type=product' ) .'" class="button alignright">'.__( 'Configure shipping class', 'woocommerce' ).'</a>';
if ( $column == 'edit' )
$columns .= '<a href="'. admin_url( 'edit-tags.php?action=edit&taxonomy=product_shipping_class&tag_ID='. $id .'&post_type=product' ) .'" class="button alignright">'.__( 'Edit Class', 'woocommerce' ).'</a>';
return $columns;
}

View File

@ -21,6 +21,9 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
function do_update_woocommerce() {
global $woocommerce;
// Include installer so we have page creation functions
include_once( 'woocommerce-admin-install.php' );
// Do updates
$current_db_version = get_option( 'woocommerce_db_version' );

View File

@ -120,9 +120,9 @@ function woocommerce_user_column_values( $value, $column_name, $user_id ) {
$paying_customer = get_user_meta( $user_id, 'paying_customer', true );
if ( $paying_customer )
$value = '<img src="' . $woocommerce->plugin_url() . '/assets/images/success.png" alt="yes" width="16px" />';
$value = '<img src="' . $woocommerce->plugin_url() . '/assets/images/success@2x.png" alt="yes" width="16px" />';
else
$value = '<img src="' . $woocommerce->plugin_url() . '/assets/images/success-off.png" alt="no" width="16px" />';
$value = '<img src="' . $woocommerce->plugin_url() . '/assets/images/success-off@2x.png" alt="no" width="16px" />';
break;
endswitch;

View File

@ -1 +1 @@
.woocommerce-message{position:relative;z-index:100;border:1px solid #b76ca9!important;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 0 15px rgba(0,0,0,0.04);-moz-box-shadow:inset 0 0 15px rgba(0,0,0,0.04);box-shadow:inset 0 0 15px rgba(0,0,0,0.04);overflow:hidden;padding:10px 0 10px!important;background:#cc99c2 url(../images/message.png) no-repeat right bottom!important}.woocommerce-message .squeezer{max-width:960px;margin:0;padding:0 10px;text-align:left;overflow:hidden}.woocommerce-message h4{margin:0 10px 0 0;font-size:18px;line-height:36px;font-family:"Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;font-weight:normal;color:#fff;text-shadow:0 1px 1px #b574a8;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;float:left;vertical-align:middle}.woocommerce-message p{margin:0!important;padding:2px 0!important;float:left!important;line-height:32px;vertical-align:middle}.woocommerce-message p a.button-primary{font-size:16px!important;line-height:16px!important;height:auto!important;margin:0 5px 0 0;padding:6px 15px;vertical-align:middle;color:#fff;text-align:center;text-decoration:none;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;border:1px solid #88537e;background:#a46497;-moz-box-shadow:inset 0 0 2px #fff,0 1px 1px rgba(0,0,0,0.1);-webkit-box-shadow:inset 0 0 2px #fff,0 1px 1px rgba(0,0,0,0.1);box-shadow:inset 0 0 2px #fff,0 1px 1px rgba(0,0,0,0.1);text-shadow:0 -1px 0 rgba(0,0,0,0.3);-webkit-transition-duration:.3s;-moz-transition-duration:.3s;cursor:pointer;font-family:"Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif}.woocommerce-message p a.button-primary:hover,.woocommerce-message p a.button-primary:active{background-color:#f0a000;border-color:#c87800;-webkit-transition-duration:.3s;outline:0;opacity:1}.woocommerce-message p a.skip,.woocommerce-message p a.docs{opacity:.5}.woocommerce-message .twitter-share-button{vertical-align:middle}
.woocommerce-message{position:relative;z-index:100;border:1px solid #b76ca9!important;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 0 15px rgba(0,0,0,0.04);-moz-box-shadow:inset 0 0 15px rgba(0,0,0,0.04);box-shadow:inset 0 0 15px rgba(0,0,0,0.04);overflow:hidden;padding:10px 0 10px!important;background:#cc99c2 url(../images/message.png) no-repeat right bottom!important}.woocommerce-message .squeezer{max-width:960px;margin:0;padding:0 10px;text-align:left;overflow:hidden}.woocommerce-message h4{margin:5px 10px 5px 0;font-size:18px;line-height:27px;font-family:"Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;font-weight:normal;color:#fff;text-shadow:0 1px 1px #b574a8;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;float:left;vertical-align:middle}.woocommerce-message p{margin:5px 0!important;padding:1px 2px!important;float:left!important;line-height:27px;vertical-align:middle}.woocommerce-message .twitter-share-button{vertical-align:middle;margin-left:3px}p.woocommerce-actions a.button-primary,.woocommerce-message a.button-primary{font-size:14px!important;line-height:16px!important;height:auto!important;-webkit-border-radius:3px;border-radius:3px;margin:0 5px 0 0;padding:5px 12px;vertical-align:middle;color:#fff;text-align:center;text-decoration:none;border:1px solid #76456d;-webkit-transition:none;-moz-transition:none;cursor:pointer;outline:0;font-family:"Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;text-shadow:0 1px 0 rgba(0,0,0,0.3);background-color:#a46497;background-image:-webkit-gradient(linear,left top,left bottom,from(#a46497),to(#864f7b));background-image:-webkit-linear-gradient(top,#a46497,#864f7b);background-image:-moz-linear-gradient(top,#a46497,#864f7b);background-image:-ms-linear-gradient(top,#a46497,#864f7b);background-image:-o-linear-gradient(top,#a46497,#864f7b);background-image:linear-gradient(to bottom,#a46497,#864f7b);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),inset 0 -1px 0 rgba(0,0,0,0.1);box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),inset 0 -1px 0 rgba(0,0,0,0.1)}p.woocommerce-actions a.button-primary:hover,.woocommerce-message a.button-primary:hover{text-shadow:0 -1px 0 rgba(0,0,0,0.3);border:1px solid #76456d;background-color:#ad74a2;background-image:-webkit-gradient(linear,left top,left bottom,from(#ad74a2),to(#864f7b));background-image:-webkit-linear-gradient(top,#ad74a2,#864f7b);background-image:-moz-linear-gradient(top,#ad74a2,#864f7b);background-image:-ms-linear-gradient(top,#ad74a2,#864f7b);background-image:-o-linear-gradient(top,#ad74a2,#864f7b);background-image:linear-gradient(to bottom,#ad74a2,#864f7b);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),inset 0 -1px 0 rgba(0,0,0,0.1);box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),inset 0 -1px 0 rgba(0,0,0,0.1)}p.woocommerce-actions a.button-primary:active,.woocommerce-message a.button-primary:active{border:1px solid #76456d;text-shadow:0 1px 0 rgba(0,0,0,0.3);background-color:#864f7b;background-image:-webkit-gradient(linear,left top,left bottom,from(#864f7b),to(#864f7b));background-image:-webkit-linear-gradient(top,#864f7b,#a46497);background-image:-moz-linear-gradient(top,#864f7b,#a46497);background-image:-ms-linear-gradient(top,#864f7b,#a46497);background-image:-o-linear-gradient(top,#864f7b,#a46497);background-image:linear-gradient(to bottom,#a46497,#a46497);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.2);box-shadow:inset 0 1px 1px rgba(0,0,0,0.2)}p.woocommerce-actions a.skip,.woocommerce-message a.skip,p.woocommerce-actions a.docs,.woocommerce-message a.docs{opacity:.7}p.woocommerce-actions .twitter-share-button,.woocommerce-message .twitter-share-button{vertical-align:middle;margin-left:3px}p.woocommerce-actions{margin-bottom:2em}.woocommerce-about-text{margin-bottom:1em!important}

View File

@ -19,9 +19,9 @@
overflow: hidden;
}
h4 {
margin: 0 10px 0 0;
margin: 5px 10px 5px 0;
font-size: 18px;
line-height: 36px;
line-height: 27px;
font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
font-weight: normal;
color: #fff;
@ -33,47 +33,94 @@
vertical-align: middle;
}
p {
margin: 0 !important;
padding: 2px 0 !important;
margin: 5px 0 !important;
padding: 1px 2px !important;
float: left !important;
line-height: 32px;
line-height: 27px;
vertical-align: middle;
a.button-primary {
font-size: 16px !important;
line-height: 16px !important;
height: auto !important;
margin: 0 5px 0 0;
padding: 6px 15px;
vertical-align: middle;
color: #fff;
text-align: center;
text-decoration: none;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border: 1px solid #88537e;
background: #a46497;
-moz-box-shadow: inset 0 0 2px rgba( 255,255,255,1), 0 1px 1px rgba( 0,0,0,0.1 );
-webkit-box-shadow: inset 0 0 2px rgba( 255,255,255,1), 0 1px 1px rgba( 0,0,0,0.1 );
box-shadow: inset 0 0 2px rgba( 255,255,255,1), 0 1px 1px rgba( 0,0,0,0.1 );
text-shadow: 0px -1px 0px rgba( 0,0,0,0.3);
-webkit-transition-duration: .3s;
-moz-transition-duration: .3s;
cursor: pointer;
font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
}
a.button-primary:hover, a.button-primary:active {
background-color: #f0a000;
border-color: #c87800;
-webkit-transition-duration: .3s;
outline: none;
opacity: 1;
}
a.skip, a.docs {
opacity: 0.5;
}
}
.twitter-share-button {
vertical-align: middle;
margin-left:3px;
}
}
p.woocommerce-actions, .woocommerce-message {
a.button-primary {
font-size: 14px !important;
line-height: 16px !important;
height: auto !important;
-webkit-border-radius:3px;
border-radius:3px;
margin: 0 5px 0 0;
padding: 5px 12px;
vertical-align: middle;
color: #fff;
text-align: center;
text-decoration: none;
border: 1px solid #76456d;
-webkit-transition:none;
-moz-transition:none;
cursor: pointer;
outline:none;
font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
text-shadow: 0px 1px 0px rgba(0,0,0,0.3);
background-color: #a46497;
background-image: -webkit-gradient(linear, left top, left bottom, from(#a46497), to(#864f7b)); /* Saf4+, Chrome */
background-image: -webkit-linear-gradient(top, #a46497, #864f7b); /* Chrome 10+, Saf5.1+, iOS 5+ */
background-image: -moz-linear-gradient(top, #a46497, #864f7b); /* FF3.6+ */
background-image: -ms-linear-gradient(top, #a46497, #864f7b); /* IE10 */
background-image: -o-linear-gradient(top, #a46497, #864f7b); /* Opera 11.10+ */
background-image: linear-gradient(to bottom, #a46497, #864f7b);
-webkit-box-shadow:
inset 0 1px 0 rgba(255,255,255,0.2),
inset 0 -1px 0 rgba(0,0,0,0.1);
box-shadow:
inset 0 1px 0 rgba(255,255,255,0.2),
inset 0 -1px 0 rgba(0,0,0,0.1);
}
a.button-primary:hover {
text-shadow: 0px -1px 0px rgba(0,0,0,0.3);
border: 1px solid #76456d;
background-color: #ad74a2;
background-image: -webkit-gradient(linear, left top, left bottom, from(#ad74a2), to(#864f7b)); /* Saf4+, Chrome */
background-image: -webkit-linear-gradient(top, #ad74a2, #864f7b); /* Chrome 10+, Saf5.1+, iOS 5+ */
background-image: -moz-linear-gradient(top, #ad74a2, #864f7b); /* FF3.6+ */
background-image: -ms-linear-gradient(top, #ad74a2, #864f7b); /* IE10 */
background-image: -o-linear-gradient(top, #ad74a2, #864f7b); /* Opera 11.10+ */
background-image: linear-gradient(to bottom, #ad74a2, #864f7b);
-webkit-box-shadow:
inset 0 1px 0 rgba(255,255,255,0.2),
inset 0 -1px 0 rgba(0,0,0,0.1);
box-shadow:
inset 0 1px 0 rgba(255,255,255,0.2),
inset 0 -1px 0 rgba(0,0,0,0.1);
}
a.button-primary:active {
border: 1px solid #76456d;
text-shadow: 0px 1px 0px rgba(0,0,0,0.3);
background-color: #864f7b;
background-image: -webkit-gradient(linear, left top, left bottom, from(#864f7b), to(#864f7b)); /* Saf4+, Chrome */
background-image: -webkit-linear-gradient(top, #864f7b, #a46497); /* Chrome 10+, Saf5.1+, iOS 5+ */
background-image: -moz-linear-gradient(top, #864f7b, #a46497); /* FF3.6+ */
background-image: -ms-linear-gradient(top, #864f7b, #a46497); /* IE10 */
background-image: -o-linear-gradient(top, #864f7b, #a46497); /* Opera 11.10+ */
background-image: linear-gradient(to bottom, #a46497, #a46497);
-webkit-box-shadow:
inset 0 1px 1px rgba(0,0,0,0.2);
box-shadow:
inset 0 1px 1px rgba(0,0,0,0.2);
}
a.skip, a.docs {
opacity: 0.7;
}
.twitter-share-button {
vertical-align: middle;
margin-left:3px;
}
}
p.woocommerce-actions {
margin-bottom: 2em;
}
.woocommerce-about-text {
margin-bottom: 1em !important;
}

File diff suppressed because one or more lines are too long

View File

@ -19,9 +19,9 @@
overflow: hidden;
}
h4 {
margin: 0 10px 0 0;
margin: 5px 10px 5px 0;
font-size: 18px;
line-height: 36px;
line-height: 27px;
font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
font-weight: normal;
color: #fff;
@ -33,40 +33,75 @@
vertical-align: middle;
}
p {
margin: 0 !important;
padding: 2px 0 !important;
margin: 5px 0 !important;
padding: 1px 2px !important;
float: left !important;
line-height: 32px;
line-height: 27px;
vertical-align: middle;
a.button-primary {
font-size: 16px !important;
font-size: 14px !important;
line-height: 16px !important;
height: auto !important;
-webkit-border-radius:3px;
border-radius:3px;
margin: 0 5px 0 0;
padding: 6px 15px;
padding: 5px 12px;
vertical-align: middle;
color: #fff;
text-align: center;
text-decoration: none;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border: 1px solid #88537e;
background: #a46497;
-moz-box-shadow: inset 0 0 2px rgba( 255,255,255,1), 0 1px 1px rgba( 0,0,0,0.1 );
-webkit-box-shadow: inset 0 0 2px rgba( 255,255,255,1), 0 1px 1px rgba( 0,0,0,0.1 );
box-shadow: inset 0 0 2px rgba( 255,255,255,1), 0 1px 1px rgba( 0,0,0,0.1 );
text-shadow: 0px -1px 0px rgba( 0,0,0,0.3);
-webkit-transition-duration: .3s;
-moz-transition-duration: .3s;
border: 1px solid #76456d;
-webkit-transition:none;
-moz-transition:none;
cursor: pointer;
outline:none;
font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",Verdana,"Bitstream Vera Sans",sans-serif;
text-shadow: 0px 1px 0px rgba(0,0,0,0.3);
background-color: #a46497;
background-image: -webkit-gradient(linear, left top, left bottom, from(#a46497), to(#864f7b)); /* Saf4+, Chrome */
background-image: -webkit-linear-gradient(top, #a46497, #864f7b); /* Chrome 10+, Saf5.1+, iOS 5+ */
background-image: -moz-linear-gradient(top, #a46497, #864f7b); /* FF3.6+ */
background-image: -ms-linear-gradient(top, #a46497, #864f7b); /* IE10 */
background-image: -o-linear-gradient(top, #a46497, #864f7b); /* Opera 11.10+ */
background-image: linear-gradient(to bottom, #a46497, #864f7b);
-webkit-box-shadow:
inset 0 1px 0 rgba(255,255,255,0.2),
inset 0 -1px 0 rgba(0,0,0,0.1);
box-shadow:
inset 0 1px 0 rgba(255,255,255,0.2),
inset 0 -1px 0 rgba(0,0,0,0.1);
}
a.button-primary:hover, a.button-primary:active {
background-color: #f0a000;
border-color: #c87800;
-webkit-transition-duration: .3s;
outline: none;
opacity: 1;
a.button-primary:hover {
text-shadow: 0px -1px 0px rgba(0,0,0,0.3);
border: 1px solid #76456d;
background-color: #ad74a2;
background-image: -webkit-gradient(linear, left top, left bottom, from(#ad74a2), to(#864f7b)); /* Saf4+, Chrome */
background-image: -webkit-linear-gradient(top, #ad74a2, #864f7b); /* Chrome 10+, Saf5.1+, iOS 5+ */
background-image: -moz-linear-gradient(top, #ad74a2, #864f7b); /* FF3.6+ */
background-image: -ms-linear-gradient(top, #ad74a2, #864f7b); /* IE10 */
background-image: -o-linear-gradient(top, #ad74a2, #864f7b); /* Opera 11.10+ */
background-image: linear-gradient(to bottom, #ad74a2, #864f7b);
-webkit-box-shadow:
inset 0 1px 0 rgba(255,255,255,0.2),
inset 0 -1px 0 rgba(0,0,0,0.1);
box-shadow:
inset 0 1px 0 rgba(255,255,255,0.2),
inset 0 -1px 0 rgba(0,0,0,0.1);
}
a.button-primary:active {
border: 1px solid #76456d;
text-shadow: 0px 1px 0px rgba(0,0,0,0.3);
background-color: #864f7b;
background-image: -webkit-gradient(linear, left top, left bottom, from(#864f7b), to(#864f7b)); /* Saf4+, Chrome */
background-image: -webkit-linear-gradient(top, #864f7b, #a46497); /* Chrome 10+, Saf5.1+, iOS 5+ */
background-image: -moz-linear-gradient(top, #864f7b, #a46497); /* FF3.6+ */
background-image: -ms-linear-gradient(top, #864f7b, #a46497); /* IE10 */
background-image: -o-linear-gradient(top, #864f7b, #a46497); /* Opera 11.10+ */
background-image: linear-gradient(to bottom, #a46497, #a46497);
-webkit-box-shadow:
inset 0 1px 1px rgba(0,0,0,0.2);
box-shadow:
inset 0 1px 1px rgba(0,0,0,0.2);
}
a.skip, a.docs {
opacity: 0.5;
@ -112,17 +147,6 @@
text-align: center;
}
}
@media
(-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
#woocommerce_extensions {
background-image: url(../images/icons/wc_icon@2x.png);
background-size: 16px 17px;
background-position: 6px 6px;
}
}
#wc_get_started { position: relative; margin: 1em 0 2em; padding: 15px 15px 15px 90px; border: 1px solid #d9d9d9; background: #f5f5f5 url(../images/gear.png) no-repeat 15px 15px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #fff; -moz-box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #fff; -webkit-box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #fff; }
#wc_get_started span { display: block; text-shadow: 1px 1px 0 #fff; font-size: 14px; line-height: 22px; color: #595959; }
#wc_get_started span.main { margin-top: 2px; font-weight: bold; font-size: 16px; }
@ -141,16 +165,6 @@
background-position: -11px -5px;
background-size: auto !important;
}
@media
(-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
#icon-woocommerce, .woocommerce_icon, .icon32-posts-product, .icon32-posts-shop_order, .icon32-posts-shop_coupon, .icon32-posts-product_variation {
background-image: url(../images/icons/woocommerce-icons-x2.png) !important;
background-size: 986px 91px !important;
}
}
.icon32-posts-product {
background-position: -69px -5px !important;
}
@ -213,11 +227,17 @@ mark.amount {
/* Status page */
table.wc_status_table {
font-family: monospace;
th {
font-weight: bold;
}
td:first-child {
width: 20%;
}
td {
padding: 5px 7px;
padding: 6px 9px;
font-size: 1.1em;
mark {
background: transparent none;
}
@ -439,6 +459,20 @@ ul.wc_coupon_list_block {
/* Orders */
.button.wc-reload {
padding:0;
-webkit-border-radius:100%;
border-radius:100%;
span {
display: block;
text-indent: -999em;
background-image:url(../images/icons/reload.png);
background-repeat: no-repeat;
background-position: center center;
width:22px;
height:22px;
}
}
.tablenav .actions {
overflow: visible;
}
@ -446,14 +480,48 @@ ul.wc_coupon_list_block {
display: inline-block;
vertical-align: middle;
}
#woocommerce-order-data {
h3.hndle, .handlediv {
display: none;
}
.inside {
display: block !important;
}
}
#order_data {
padding: 0 10px 9px;
.order_data_left {
width: 48%;
padding: 23px 24px 12px 24px;
h2 {
margin: 0;
font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;
font-size: 21px;
font-weight: normal;
line-height: 1.2;
text-shadow: 1px 1px 1px white;
padding: 0;
}
h4 {
color: #333;
margin: 1.33em 0 0;
}
p {
color: #777;
}
p.order_number {
margin: 0;
font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;
font-weight: normal;
line-height: 1.6em;
font-size: 16px;
}
.order_data_column_container {
clear: both;
}
.order_data_column {
width: 32%;
padding: 0 2% 0 0;
float: left;
h2 {
margin-top: 11px;
margin-bottom: 0;
&:last-child {
padding-right: 0;
}
p {
padding: 0 !important;
@ -487,6 +555,11 @@ ul.wc_coupon_list_block {
.hour, .minute {
width: 2.5em;
}
small {
display: block;
margin: 5px 0 0 0;
color: #999;
}
}
.form-field.last {
float: right;
@ -501,48 +574,20 @@ ul.wc_coupon_list_block {
width: 100%;
}
}
}
.order_data_right {
width: 48%;
float: right;
.order_data {
overflow: hidden;
zoom: 1;
width: 49%;
float:left;
}
.order_data_alt {
float:right;
}
h2 {
margin-top: 11px;
margin-bottom: 0;
}
p {
padding: 0 !important;
}
p.none_set {
color: #999;
}
.form-field {
._billing_first_name_field, ._billing_address_1_field, ._billing_city_field, ._billing_country_field, ._billing_email_field,
._shipping_first_name_field, ._shipping_address_1_field, ._shipping_city_field, ._shipping_country_field {
float: left;
width: 50%;
padding: 0;
margin: 9px 0 0 0;
label {
display: block;
padding: 0 0 3px;
}
input, select {
width: 95%;
}
}
._billing_last_name_field, ._billing_address_2_field, ._billing_postcode_field, ._billing_state_field, ._billing_phone_field,
._shipping_last_name_field, ._shipping_address_2_field, ._shipping_postcode_field, ._shipping_state_field {
float: right;
}
._billing_company_field, ._shipping_company_field {
clear: both;
width: 100%;
input {
width: 97.5%;
}
}
._billing_email_field {
clear: left
@ -551,6 +596,7 @@ ul.wc_coupon_list_block {
display: none;
overflow: hidden;
zoom: 1;
padding-right: 1px;
}
}
}
@ -592,14 +638,14 @@ ul.wc_coupon_list_block {
&#actions {
overflow: hidden;
.button {
width: 25%;
width: 24px;
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
float: right;
}
select {
width: 70%;
width: 225px;
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
@ -868,6 +914,7 @@ ul.wc_coupon_list_block {
}
.woocommerce_order_items_wrapper {
margin: 0;
overflow: auto;
table.woocommerce_order_items {
width: 100%;
background: #fff;
@ -899,10 +946,6 @@ ul.wc_coupon_list_block {
padding: 8px;
width: 1%;
}
tr.refunded {
background: url( data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAAO0lEQVQYV2NkIAIwElLz5s2b/3gVgRSIiIgwEjQJZBNWRTATYE7BUISuAKdJ6J6Bm4TNBBTr8CkAKQQAdWEXzZ0t/moAAAAASUVORK5CYII= ) repeat;
color: #999;
}
.item {
min-width: 200px;
}
@ -920,7 +963,7 @@ ul.wc_coupon_list_block {
}
}
input {
width: 60px;
width: 70px;
vertical-align:middle;
text-align: right;
}
@ -954,7 +997,7 @@ ul.wc_coupon_list_block {
padding: 1px 4px 1px 0;
border: 0;
input {
min-width: 100px;
min-width: 50px;
}
}
}
@ -979,14 +1022,6 @@ ul.wc_coupon_list_block {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAARklEQVQYGWP8//8/AzGACV3Rnj17/oMwujiGQnQFMD7RChlBbsRmFcwkEO3i4sJImonIumGmg0xBFifaRKIVgj2DbAUuNgCfThpracSKqwAAAABJRU5ErkJggg==) no-repeat center;
}
}
tr.refunded {
.thumb {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAS0lEQVQYV42QUQoAIAhD83A7tYcrCiZLsPRL3XOiNiTcfWoNwFhHkiEChA+oEIXcsx8UqwlWTtTDcYMv90vMB+hg/xi6tN5TwfrwBffKRMurJBdPAAAAAElFTkSuQmCC) no-repeat center;
* {
display: none;
}
}
}
}
}
@ -1004,9 +1039,12 @@ ul.wc_coupon_list_block {
float:left;
margin: 0 4px 2px 0;
cursor: pointer;
padding:3px 6px;
padding:3px 4px;
height:auto;
img {
display: block;
width:12px;
height:auto;
}
}
}
@ -1020,47 +1058,51 @@ ul.wc_coupon_list_block {
width:9%;
}
.column-order_status {
width:75px;
width:45px;
text-align: center;
mark {
display:block;
text-align: center;
white-space: nowrap;
padding: 0 2px;
background: #999;
font-size:11px;
line-height: 1.75;
-webkit-border-radius:3px;
-moz-border-radius:3px;
-o-border-radius:3px;
border-radius:3px;
margin: 0;
color:#fff;
font-weight: bold;
height:18px;
width:18px;
text-indent: -999em;
margin:0 auto;
background: #bbb;
background-repeat: no-repeat;
background-position: center;
-webkit-border-radius:100%;
border-radius:100%;
}
mark.pending {
background-image:url(../images/icons/pending.png);
background-color: #999;
}
mark.completed {
background-color: #a0658b;
background-image:url(../images/icons/completed.png);
background-color: #21759b;
}
mark.on-hold {
background-color: #E66F00;
background-image:url(../images/icons/on-hold.png);
background-color: #de9e0c;
}
mark.failed {
background-color: red;
background-image:url(../images/icons/failed.png);
background-color: #e6db55;
}
mark.cancelled {
background-color: #ccc;
background-image:url(../images/icons/cancelled.png);
background-color: #d54e21;
}
mark.processing {
background-color: #2184c2;
background-image:url(../images/icons/st-processing.png);
background-color: #73a724;
}
mark.refunded {
background-color: #ccc;
background-image:url(../images/icons/refunded.png);
}
}
td.column-order_status {
padding-top:10px;
}
}
/* Order notes */
@ -1126,6 +1168,9 @@ table.wp-list-table {
text-align: center;
white-space: nowrap
}
.column-name {
width:22%;
}
.column-product_cat, .column-product_tag {
width: 11% !important;
}
@ -1161,13 +1206,13 @@ table.wp-list-table {
img {
margin: 1px 2px;
}
.column-thumb img {
padding: 2px;
td.column-thumb img {
margin: 0;
border: 1px solid #dfdfdf;
vertical-align: middle;
width: 32px;
height: 32px;
width: auto;
height: auto;
max-width: 40px;
max-height: 40px;
}
span.na {
color: #999;
@ -1175,14 +1220,6 @@ table.wp-list-table {
.column-is_in_stock {
text-align: left !important;
}
@media
(-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
span.product-type {
background-image: url(../images/product_types-x2.png) !important;
background-size:96px 16px !important;
}
}
span.product-type {
width: 16px;
height: 16px;
@ -1402,16 +1439,39 @@ ul.recent-orders, ul.stock_list {
}
.star-rating {
float: right;
width: 50px;
height: 10px;
margin: 3px 0 0 0;
background: url(../images/admin-star.png) repeat-x left -10px;
overflow: hidden;
position: relative;
height: 1.5em;
line-height: 1.5;
margin-left:.5em;
width: 5.4em;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important;
&:before {
content: "\2605\2605\2605\2605\2605";
color: darken( #ccc, 10 );
float: left;
top: 0;
left: 0;
position: absolute;
letter-spacing: 0.1em;
letter-spacing:0\9; // IE8 & below hack ;-(
}
span {
background: url(../images/admin-star.png) repeat-x left 0;
height: 0;
padding-top: 10px;
overflow: hidden;
float: left;
top: 0;
left: 0;
position: absolute;
padding-top: 1.5em;
}
span:before {
content: "\2605\2605\2605\2605\2605";
top: 0;
position: absolute;
left: 0;
letter-spacing: 0.1em;
letter-spacing:0\9; // IE8 & below hack ;-(
color: #9c5d90;
}
}
}
@ -1470,10 +1530,20 @@ table.wc_tax_rates {
padding: 0;
}
td.sort {
width: 16px;
padding: 0;
padding-left: 2em;
cursor: move;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAHUlEQVQYV2O8f//+fwY8gJGgAny6QXKETRgEVgAAXxAVsa5Xr3QAAAAASUVORK5CYII=) no-repeat center;
position: relative;
background: #f9f9f9;
&:before {
content: "";
position: absolute;
top: 0.75em;
left: 0.5em;
width: 1em;
height: 0.125em;
border-top: 0.375em double #777;
border-bottom: 0.125em solid #777;
}
}
.button {
float: left;
@ -1563,14 +1633,20 @@ img.help_tip {
padding-right: 24px;
}
th img.help_tip {
position: absolute;
right: 0;
margin: 0;
margin: 0 -24px 0 0;
float: right;
}
fieldset {
margin-top: 4px;
img.help_tip {
margin: -3px 0 0 5px;
}
p.description {
margin-bottom: 8px;
}
&:first-child {
margin-top: 0;
}
}
.color_box {
border: 1px solid #ccc;
@ -1637,12 +1713,21 @@ img.help_tip {
#product_variation-parent #parent_id {
width: 100%;
}
#postimagediv {
img {
border: 1px solid #d5d5d5;
max-width: 100%;
}
}
#woocommerce-product-images {
.inside {
margin: 0;
padding: 0;
.add_product_images {
padding: 0 9px;
}
#product_images_container {
padding: 9px 0 0 9px;
padding: 0 0 0 9px;
ul {
overflow: hidden;
margin: 0;
@ -1654,7 +1739,7 @@ img.help_tip {
float: left;
cursor: move;
border: 1px solid #d5d5d5;
margin: 0 9px 9px 0;
margin: 9px 9px 0 0;
background: #f7f7f7;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
@ -1668,41 +1753,11 @@ img.help_tip {
height: auto;
display: block;
}
.loading {
background: #fff url(../images/ajax-loader.gif) no-repeat center;
width: 100%;
height: 100%;
opacity: 0.5;
position: absolute;
display: none;
top:0;
left: 0;
}
}
li.excluded {
opacity: 0.2;
}
li.loading {
.loading {
display: block;
}
}
li.image:first-child {
margin: 0 0 9px 0;
width: 258px;
height: auto;
overflow: visible;
opacity: 1;
}
li.wc-metabox-sortable-placeholder {
border: 4px dashed #dddddd;
background: #f7f7f7 url(../images/image_watermark.png) no-repeat center;
}
li.wc-metabox-sortable-placeholder:first-child {
background: #f7f7f7 url(../images/star_watermark.png) no-repeat center;
width: 258px;
height: 258px;
}
ul.actions {
position: absolute;
top:0;
@ -1739,36 +1794,6 @@ img.help_tip {
}
}
}
#plupload-upload-ui {
text-align: center;
color: #999;
background: none;
cursor: default !important;
border: 0;
width: 258px;
height: auto;
margin: 0;
padding: 0 0 9px 9px;
#drag-drop-area {
padding: 20px 0;
height: auto;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
line-height: 1.4em;
p {
color: #AAA;
font-size: 14px;
margin: 5px 0;
}
p.drag-drop-info {
font-size: 20px;
}
}
}
}
}
#woocommerce-product-data {
@ -1829,21 +1854,6 @@ img.help_tip {
border-right: 1px solid #DFDFDF;
}
}
@media
(-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
#woocommerce-product-data ul.product_data_tabs li {
&.general_options, &.tax_options, &.inventory_options, &.shipping_options, &.linked_product_options, &.attribute_options, &.variation_options, &.advanced_options {
a {
background-image: url(../images/icons/wc-tab-icons-x2.png) !important;
background-size: 17px 720px !important;
}
}
}
}
#woocommerce-product-data ul.product_data_tabs, .woocommerce ul.wc-tabs {
background: #f1f1f1;
line-height: 1em;
@ -2105,7 +2115,10 @@ img.help_tip {
}
.upload_file_button {
padding-left: 20px;
background: #fefefe url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAQ0lEQVQYV3WPUQoAMAhC1+E6tYdrFBgiW185X7biSAGolpkZfN6GJg1CA7ip0CYo+FzxBTqeE/7J1qGAXsTEAdxQfQHJTymZe4oqiAAAAABJRU5ErkJggg==) no-repeat 8px 5px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAQ0lEQVQYV3WPUQoAMAhC1+E6tYdrFBgiW185X7biSAGolpkZfN6GJg1CA7ip0CYo+FzxBTqeE/7J1qGAXsTEAdxQfQHJTymZe4oqiAAAAABJRU5ErkJggg==) !important;
background-color: #FEFEFE !important;
background-repeat: no-repeat !important;
background-position: 8px 7px !important;
}
}
#woocommerce-product-data input.dp-applied {
@ -2221,6 +2234,11 @@ img.help_tip {
padding: 4px;
color: #555;
}
.upload_file_button {
font-size: 12px;
padding: 3px 8px 3px 20px;
line-height: 1;
}
select, .chzn-container {
width: 100% !important;
}
@ -2337,7 +2355,7 @@ img.help_tip {
}
&.data {
padding: 0 0 0 12px;
table {
table.data_table {
width: 100%;
padding: 0 12px 6px 12px;
background: #fff;
@ -2356,7 +2374,7 @@ img.help_tip {
box-sizing: border-box; /* Opera/IE 8+ */
}
}
table:before {
table.data_table:before {
content: "";
display: block;
position: absolute;
@ -2366,7 +2384,7 @@ img.help_tip {
border: 7px solid #dfdfdf;
border-color: transparent transparent transparent #dfdfdf;
}
table:after {
table.data_table:after {
content: "";
display: block;
position: absolute;
@ -2423,7 +2441,10 @@ img.help_tip {
width: auto;
margin: 5px 0 0 0;
padding: 3px 8px 3px 20px;
background: #fefefe url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAQ0lEQVQYV3WPUQoAMAhC1+E6tYdrFBgiW185X7biSAGolpkZfN6GJg1CA7ip0CYo+FzxBTqeE/7J1qGAXsTEAdxQfQHJTymZe4oqiAAAAABJRU5ErkJggg==) no-repeat 8px 5px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAQ0lEQVQYV3WPUQoAMAhC1+E6tYdrFBgiW185X7biSAGolpkZfN6GJg1CA7ip0CYo+FzxBTqeE/7J1qGAXsTEAdxQfQHJTymZe4oqiAAAAABJRU5ErkJggg==) !important;
background-color: #FEFEFE !important;
background-repeat: no-repeat !important;
background-position: 8px 7px !important;
}
}
}
@ -2446,31 +2467,6 @@ img.help_tip {
}
}
}
@media
(-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
.wc-metaboxes-wrapper {
a.plus, a.minus, .expand_all, .close_all {
background-image: url(../images/icons/edit_variations@2x.png) !important;
background-size: 21px 165px;
&:hover {
background-size: 21px 165px;
}
}
}
#variable_product_options {
p.toolbar {
a.set, a.toggle, a.delete_variations {
background-image: url(../images/icons/edit_variations@2x.png) !important;
background-size: 21px 165px;
&:hover {
background-size: 21px 165px;
}
}
}
}
}
/* Tooltips */
.tips {
cursor: help;
@ -2574,7 +2570,7 @@ img.ui-datepicker-trigger { vertical-align: middle; margin-top: -1px; cursor: po
text-align: center;
}
.chart {
padding: 16px;
padding: 16px 16px 0;
}
}
.woocommerce-reports-main {
@ -2743,5 +2739,86 @@ table.bar_chart {
}
}
}
// HiDPI optimisation
@media
(-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
#icon-woocommerce, .woocommerce_icon, .icon32-posts-product, .icon32-posts-shop_order, .icon32-posts-shop_coupon, .icon32-posts-product_variation {
background-image: url(../images/icons/woocommerce-icons-x2.png) !important;
background-size: 986px 91px !important;
}
#woocommerce_extensions {
background-image: url(../images/icons/wc_icon@2x.png);
background-size: 16px 17px;
background-position: 6px 6px;
}
table.wp-list-table span.product-type {
background-image: url(../images/product_types-x2.png) !important;
background-size:96px 16px !important;
}
#woocommerce-product-data ul.product_data_tabs li {
&.general_options, &.tax_options, &.inventory_options, &.shipping_options, &.linked_product_options, &.attribute_options, &.variation_options, &.advanced_options {
a {
background-image: url(../images/icons/wc-tab-icons-x2.png) !important;
background-size: 17px 720px !important;
}
}
}
.wc-metaboxes-wrapper {
a.plus, a.minus, .expand_all, .close_all {
background-image: url(../images/icons/edit_variations@2x.png) !important;
background-size: 21px 165px;
&:hover {
background-size: 21px 165px;
}
}
}
#variable_product_options {
p.toolbar {
a.set, a.toggle, a.delete_variations {
background-image: url(../images/icons/edit_variations@2x.png) !important;
background-size: 21px 165px;
&:hover {
background-size: 21px 165px;
}
}
}
}
.widefat {
.column-order_status {
mark.pending {
background-image:url(../images/icons/pending@2x.png);
background-size: 10px 8px;
}
mark.completed {
background-image:url(../images/icons/completed@2x.png);
background-size: 10px 8px;
}
mark.on-hold {
background-image:url(../images/icons/on-hold@2x.png);
background-size: 10px 10px;
}
mark.failed {
background-image:url(../images/icons/failed@2x.png);
background-size: 10px 8px;
}
mark.cancelled {
background-image:url(../images/icons/cancelled@2x.png);
background-size: 10px 8px;
}
mark.processing {
background-image:url(../images/icons/st-processing@2x.png);
background-size: 10px 8px;
}
mark.refunded {
background-image:url(../images/icons/refunded@2x.png);
background-size: 10px 8px;
}
}
}
.button.wc-reload span {
background-image: url(../images/icons/reload@2x.png);
background-size: 12px 12px;
}
}
@import 'chosen.less';

View File

@ -1 +0,0 @@
#fancybox-loading{position:fixed;top:50%;left:50%;width:40px;height:40px;margin-top:-20px;margin-left:-20px;cursor:pointer;overflow:hidden;z-index:11104;display:none}#fancybox-loading div{position:absolute;top:0;left:0;width:40px;height:480px;background-image:url('../images/fancybox/fancybox.png')}#fancybox-overlay{position:absolute;top:0;left:0;width:100%;z-index:11100;display:none}#fancybox-tmp{padding:0;margin:0;border:0;overflow:auto;display:none}#fancybox-wrap{position:absolute;top:0;left:0;padding:20px;z-index:11101;outline:0;display:none}#fancybox-outer{position:relative;width:100%;height:100%;background:#fff;-webkit-border-radius:1em;-moz-border-radius:1em;border-radius:1em;-webkit-box-shadow:0 0 1em rgba(0,0,0,0.6);-moz-box-shadow:0 0 1em rgba(0,0,0,0.6);box-shadow:0 0 1em rgba(0,0,0,0.6)}#fancybox-content{width:0;height:0;padding:0;outline:0;position:relative;overflow:hidden;z-index:11102;border:0 solid #fff;-webkit-border-radius:1em;-moz-border-radius:1em;border-radius:1em}#fancybox-hide-sel-frame{position:absolute;top:0;left:0;width:100%;height:100%;background:transparent;z-index:11101}#fancybox-close{position:absolute;top:-15px;right:-15px;width:24px;height:24px;line-height:24px!important;font-size:16px!important;font-family:sans-serif!important;cursor:pointer;z-index:11103;display:none;text-align:center;background:#000;display:inline-block;border:2px solid #fff;-webkit-border-radius:2em;-moz-border-radius:2em;border-radius:2em;font-weight:bold;color:#fff;text-shadow:none;-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.8);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.8);box-shadow:0 1px 3px rgba(0,0,0,0.8);-webkit-transition:all ease-in-out .2s}#fancybox-close:hover{background:#a36396;text-decoration:none!important}#fancybox-error{color:#444;font:normal 12px/20px Arial;padding:14px;margin:0}#fancybox-img{width:100%;height:100%;padding:0;margin:0;border:0;outline:0;line-height:0;vertical-align:top}#fancybox-frame{width:100%;height:100%;border:0;display:block}#fancybox-left,#fancybox-right{position:absolute;bottom:0;height:100%;width:35%;cursor:pointer;outline:0;background:transparent url('../images/fancybox/blank.gif');z-index:11102;display:none}#fancybox-left{left:0}#fancybox-right{right:0}#fancybox-left-ico,#fancybox-right-ico{position:absolute;top:50%;left:-9999px;width:30px;height:30px;margin-top:-15px;cursor:pointer;z-index:11102;display:block}#fancybox-left-ico{background-image:url('../images/fancybox/fancybox.png');background-position:-40px -30px}#fancybox-right-ico{background-image:url('../images/fancybox/fancybox.png');background-position:-40px -60px}#fancybox-left:hover,#fancybox-right:hover{visibility:visible}#fancybox-left:hover span{left:20px}#fancybox-right:hover span{left:auto;right:20px}.fancybox-bg{position:absolute;padding:0;margin:0;border:0;width:20px;height:20px;z-index:11001}#fancybox-title{font-family:Helvetica;font-size:12px;z-index:11102;text-align:center;padding-top:10px}#fancybox-title-float{padding:3px 10px;background:#000;display:inline-block;border:2px solid #fff;-webkit-border-radius:2em;-moz-border-radius:2em;border-radius:2em;font-weight:bold;color:#fff;text-shadow:none;-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.8);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.8);box-shadow:0 1px 3px rgba(0,0,0,0.8)}

View File

@ -1,250 +0,0 @@
/*
* FancyBox - jQuery Plugin
* Simple and fancy lightbox alternative
*
* Examples and documentation at: http://fancybox.net
*
* Copyright (c) 2008 - 2010 Janis Skarnelis
* That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
*
* Version: 1.3.4 (11/11/2010)
* Requires: jQuery v1.3+
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
#fancybox-loading {
position: fixed;
top: 50%;
left: 50%;
width: 40px;
height: 40px;
margin-top: -20px;
margin-left: -20px;
cursor: pointer;
overflow: hidden;
z-index: 11104;
display: none;
}
#fancybox-loading div {
position: absolute;
top: 0;
left: 0;
width: 40px;
height: 480px;
background-image: url('../images/fancybox/fancybox.png');
}
#fancybox-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: 11100;
display: none;
}
#fancybox-tmp {
padding: 0;
margin: 0;
border: 0;
overflow: auto;
display: none;
}
#fancybox-wrap {
position: absolute;
top: 0;
left: 0;
padding: 20px;
z-index: 11101;
outline: none;
display: none;
}
#fancybox-outer {
position: relative;
width: 100%;
height: 100%;
background: #fff;
-webkit-border-radius:1em;
-moz-border-radius:1em;
border-radius:1em;
-webkit-box-shadow:0 0 1em rgba(0,0,0,0.6);
-moz-box-shadow:0 0 1em rgba(0,0,0,0.6);
box-shadow:0 0 1em rgba(0,0,0,0.6);
}
#fancybox-content {
width: 0;
height: 0;
padding: 0;
outline: none;
position: relative;
overflow: hidden;
z-index: 11102;
border: 0px solid #fff;
-webkit-border-radius:1em;
-moz-border-radius:1em;
border-radius:1em;
}
#fancybox-hide-sel-frame {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: transparent;
z-index: 11101;
}
#fancybox-close {
position: absolute;
top: -15px;
right: -15px;
width: 24px;
height: 24px;
line-height: 24px !important;
font-size:16px !important;
font-family: sans-serif !important;
cursor: pointer;
z-index: 11103;
display: none;
text-align: center;
background: #000;
display: inline-block;
border:2px solid #fff;
-webkit-border-radius:2em;
-moz-border-radius:2em;
border-radius:2em;
font-weight: bold;
color: #fff;
text-shadow:none;
-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.8);
-moz-box-shadow:0 1px 3px rgba(0,0,0,0.8);
box-shadow:0 1px 3px rgba(0,0,0,0.8);
-webkit-transition:all ease-in-out .2s;
}
#fancybox-close:hover {
background: #a36396;
text-decoration:none !important;
}
#fancybox-error {
color: #444;
font: normal 12px/20px Arial;
padding: 14px;
margin: 0;
}
#fancybox-img {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
border: none;
outline: none;
line-height: 0;
vertical-align: top;
}
#fancybox-frame {
width: 100%;
height: 100%;
border: none;
display: block;
}
#fancybox-left, #fancybox-right {
position: absolute;
bottom: 0px;
height: 100%;
width: 35%;
cursor: pointer;
outline: none;
background: transparent url('../images/fancybox/blank.gif');
z-index: 11102;
display: none;
}
#fancybox-left {
left: 0px;
}
#fancybox-right {
right: 0px;
}
#fancybox-left-ico, #fancybox-right-ico {
position: absolute;
top: 50%;
left: -9999px;
width: 30px;
height: 30px;
margin-top: -15px;
cursor: pointer;
z-index: 11102;
display: block;
}
#fancybox-left-ico {
background-image: url('../images/fancybox/fancybox.png');
background-position: -40px -30px;
}
#fancybox-right-ico {
background-image: url('../images/fancybox/fancybox.png');
background-position: -40px -60px;
}
#fancybox-left:hover, #fancybox-right:hover {
visibility: visible; /* IE6 */
}
#fancybox-left:hover span {
left: 20px;
}
#fancybox-right:hover span {
left: auto;
right: 20px;
}
.fancybox-bg {
position: absolute;
padding: 0;
margin: 0;
border: 0;
width: 20px;
height: 20px;
z-index: 11001;
}
#fancybox-title {
font-family: Helvetica;
font-size: 12px;
z-index: 11102;
text-align: center;
padding-top:10px;
}
#fancybox-title-float {
padding:3px 10px;
background: #000;
display: inline-block;
border:2px solid #fff;
-webkit-border-radius:2em;
-moz-border-radius:2em;
border-radius:2em;
font-weight: bold;
color: #fff;
text-shadow:none;
-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.8);
-moz-box-shadow:0 1px 3px rgba(0,0,0,0.8);
box-shadow:0 1px 3px rgba(0,0,0,0.8);
}

View File

@ -1 +1 @@
#adminmenu #menu-posts-product div.wp-menu-image,#adminmenu #menu-posts-shop_order div.wp-menu-image,#adminmenu #menu-posts-shop_coupon div.wp-menu-image,#adminmenu #toplevel_page_woocommerce div.wp-menu-image{background-image:url(../images/icons/menu_icons.png)}#adminmenu #menu-posts-product div.wp-menu-image{background-position:-32px -32px}#adminmenu #menu-posts-product.wp-menu-open div.wp-menu-image,#adminmenu #menu-posts-product:hover div.wp-menu-image{background-position:-32px 0}#adminmenu #menu-posts-product img{display:none}#adminmenu #menu-posts-shop_order div.wp-menu-image{background-position:-64px -32px}#adminmenu #menu-posts-shop_order.wp-menu-open div.wp-menu-image,#adminmenu #menu-posts-shop_order:hover div.wp-menu-image{background-position:-64px 0}#adminmenu #menu-posts-shop_order img{display:none}#adminmenu #menu-posts-shop_coupon div.wp-menu-image{background-position:-96px -32px}#adminmenu #menu-posts-shop_coupon.wp-menu-open div.wp-menu-image,#adminmenu #menu-posts-shop_coupon:hover div.wp-menu-image{background-position:-96px 0}#adminmenu #menu-posts-shop_coupon img{display:none}#adminmenu #toplevel_page_woocommerce div.wp-menu-image{background-position:0 -32px}#adminmenu #toplevel_page_woocommerce.wp-menu-open div.wp-menu-image,#adminmenu #toplevel_page_woocommerce:hover div.wp-menu-image{background-position:0 0}#adminmenu #toplevel_page_woocommerce img{display:none}@media only screen and (-webkit-min-device-pixel-ratio:1.5){#adminmenu #menu-posts-product div.wp-menu-image,#adminmenu #menu-posts-shop_order div.wp-menu-image,#adminmenu #menu-posts-shop_coupon div.wp-menu-image,#adminmenu #toplevel_page_woocommerce div.wp-menu-image{background-image:url(../images/icons/menu_icons-x2.png);background-size:200px 64px}}span.mce_woocommerce_shortcodes_button{background-image:url(../images/icons/wc_icon.png)!important;background-repeat:no-repeat!important;background-position:center!important}
#adminmenu #menu-posts-product div.wp-menu-image,#adminmenu #menu-posts-shop_order div.wp-menu-image,#adminmenu #menu-posts-shop_coupon div.wp-menu-image,#adminmenu #toplevel_page_woocommerce div.wp-menu-image{background-image:url(../images/icons/menu_icons.png)}#adminmenu #menu-posts-product div.wp-menu-image{background-position:-32px -32px}#adminmenu #menu-posts-product.wp-menu-open div.wp-menu-image,#adminmenu #menu-posts-product:hover div.wp-menu-image{background-position:-32px 0}#adminmenu #menu-posts-product img{display:none}#adminmenu #menu-posts-shop_order div.wp-menu-image{background-position:-64px -32px}#adminmenu #menu-posts-shop_order.wp-menu-open div.wp-menu-image,#adminmenu #menu-posts-shop_order:hover div.wp-menu-image{background-position:-64px 0}#adminmenu #menu-posts-shop_order img{display:none}#adminmenu #menu-posts-shop_coupon div.wp-menu-image{background-position:-96px -32px}#adminmenu #menu-posts-shop_coupon.wp-menu-open div.wp-menu-image,#adminmenu #menu-posts-shop_coupon:hover div.wp-menu-image{background-position:-96px 0}#adminmenu #menu-posts-shop_coupon img{display:none}#adminmenu #toplevel_page_woocommerce div.wp-menu-image{background-position:0 -32px}#adminmenu #toplevel_page_woocommerce.wp-menu-open div.wp-menu-image,#adminmenu #toplevel_page_woocommerce:hover div.wp-menu-image{background-position:0 0}#adminmenu #toplevel_page_woocommerce img{display:none}@media(-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#adminmenu #menu-posts-product div.wp-menu-image,#adminmenu #menu-posts-shop_order div.wp-menu-image,#adminmenu #menu-posts-shop_coupon div.wp-menu-image,#adminmenu #toplevel_page_woocommerce div.wp-menu-image{background-image:url(../images/icons/menu_icons-x2.png);background-size:200px 64px}}span.mce_woocommerce_shortcodes_button{background-image:url(../images/icons/wc_icon.png)!important;background-repeat:no-repeat!important;background-position:center!important}

View File

@ -3,10 +3,10 @@
#menu-posts-product div.wp-menu-image, #menu-posts-shop_order div.wp-menu-image, #menu-posts-shop_coupon div.wp-menu-image, #toplevel_page_woocommerce div.wp-menu-image {
background-image: url(../images/icons/menu_icons.png);
}
#menu-posts-product {
div.wp-menu-image {
background-position: -32px -32px;
background-position: -32px -32px;
}
&.wp-menu-open div.wp-menu-image, &:hover div.wp-menu-image {
background-position: -32px 0px;
@ -17,7 +17,7 @@
}
#menu-posts-shop_order {
div.wp-menu-image {
background-position: -64px -32px;
background-position: -64px -32px;
}
&.wp-menu-open div.wp-menu-image, &:hover div.wp-menu-image {
background-position: -64px 0px;
@ -28,7 +28,7 @@
}
#menu-posts-shop_coupon {
div.wp-menu-image {
background-position: -96px -32px;
background-position: -96px -32px;
}
&.wp-menu-open div.wp-menu-image, &:hover div.wp-menu-image {
background-position: -96px 0px;
@ -39,7 +39,7 @@
}
#toplevel_page_woocommerce {
div.wp-menu-image {
background-position: 0px -32px;
background-position: 0px -32px;
}
&.wp-menu-open div.wp-menu-image, &:hover div.wp-menu-image {
background-position: 0px 0px;
@ -50,7 +50,9 @@
}
}
@media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
@media
(-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
#adminmenu {
#menu-posts-product div.wp-menu-image, #menu-posts-shop_order div.wp-menu-image, #menu-posts-shop_coupon div.wp-menu-image, #toplevel_page_woocommerce div.wp-menu-image {
background-image: url(../images/icons/menu_icons-x2.png);

View File

@ -1,3 +1,5 @@
@woocommerce: #ad74a2;
.clearfix() {
&:after {
content:"";
@ -18,7 +20,7 @@
border-top-right-radius: @radius;
border-bottom-right-radius: @radius;
}
.border_radius_left(@radius:4px) {
.border_radius_left(@radius:4px) {
-webkit-border-top-left-radius: @radius;
-webkit-border-bottom-left-radius: @radius;
-moz-border-radius-topleft: @radius;
@ -75,6 +77,20 @@
transition:@selector @animation @duration;
}
.scale(@ratio:1.5){
-webkit-transform:scale(@ratio);
-moz-transform:scale(@ratio);
-ms-transform:scale(@ratio);
-o-transform:scale(@ratio);
transform:scale(@ratio);
}
.borderbox () {
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
}
.clear { clear: both; }
.nobr { white-space: nowrap; }

File diff suppressed because one or more lines are too long

469
assets/css/prettyPhoto.less Normal file
View File

@ -0,0 +1,469 @@
@import 'mixins.less';
// Functions
.button() {
.border_radius(100%);
height:16px;
width:16px;
color: #666 !important;
.vertical_gradient(#f6f6f6,#e8e8e8);
border:1px solid #ccc;
font-size:14px !important;
font-family: verdana !important;
text-shadow:0 1px 0 #fff;
font-weight: bold !important;
-webkit-box-shadow:
inset 0 -1px 0 rgba(0,0,0,0.05),
inset 0 1px 0 rgba(255,255,255,0.5),
0 1px 2px rgba(0,0,0,0.075);
box-shadow:
inset 0 -1px 0 rgba(0,0,0,0.05),
inset 0 1px 0 rgba(255,255,255,0.5),
0 1px 2px rgba(0,0,0,0.075);
&:hover {
.vertical_gradient(#fff,#e8e8e8);
color: #444 !important;
}
}
// WooCommerce theme
div.pp_woocommerce {
.pp_content_container {
background: #fff;
.border_radius(3px);
.box_shadow(0,1px,3px,0,rgba(0,0,0,0.25));
padding:60px 0 40px 0;
}
.pp_loaderIcon {
background: url(../images/ajax-loader.gif) center no-repeat;
}
div.ppt {
color: black;
}
.pp_gallery {
ul {
li {
a {
border:1px solid rgba(0,0,0,0.5);
background: #fff;
.box_shadow(0,1px,2px,0,rgba(0,0,0,0.2));
.border_radius(2px);
display: block;
&:hover {
border-color:#000;
}
}
&.selected {
a {
border-color:#000;
}
}
}
}
}
// Next / Previous
.pp_arrow_previous, .pp_arrow_next, .pp_previous, .pp_next {
&:before {
line-height: 1.15 !important;
}
}
.pp_previous, .pp_next {
&:before {
.button;
content: "\2039";
text-indent: 0;
display: none;
position: absolute;
top:50%;
margin-top:-10px;
text-align: center;
}
&:hover {
&:before {
display: block;
}
}
}
.pp_previous {
&:before {
left:1em;
}
}
.pp_next {
&:before {
right:1em;
content: "\203a";
}
}
.pp_details {
margin:0;
padding-top:1em;
}
.pp_nav, .pp_description {
font-size:14px;
}
.pp_nav, .pp_nav p, .pp_play, .pp_nav .pp_pause, .pp_arrow_previous, .pp_arrow_next {
margin:0;
}
// Navigation
.pp_nav {
margin-right:1em;
position: relative;
}
.pp_close {
.button;
width:21px;
height:21px;
top:-10px;
right:-10px;
&:before {
content:"\00d7";
display: block;
position: absolute;
top:0;
left:0;
right:0;
bottom:0;
text-align: center;
text-indent: 0;
line-height: 1.45;
}
}
// Buttons
.pp_arrow_previous, .pp_arrow_next {
.button;
position: relative;
margin-top:-1px;
&:before {
content:"\2039";
display: block;
position: absolute;
top:0;
left:0;
right:0;
bottom:0;
text-align: center;
text-indent: 0;
}
}
.pp_arrow_previous {
margin-right:.5em;
}
.pp_arrow_next {
margin-left:.5em;
&:before {
content: "\203a";
}
}
a.pp_expand, a.pp_contract {
.button;
right:auto;
left:-10px;
top:-10px;
height:21px;
width:21px;
&:before {
content:"\2295";
display: block;
position: absolute;
top:0;
left:0;
right:0;
bottom:0;
text-align: center;
text-indent: 0;
line-height:0.9 !important;
font-size:19px !important;
}
}
a.pp_contract {
&:before {
content: "\2297";
}
}
#respond {
margin:0;
width:100%;
background: none;
border:none;
padding:0;
.form-submit {
margin-top:0;
float:none;
}
}
.pp_inline {
padding:0!important;
}
}
/* ------------------------------------------------------------------------
DO NOT CHANGE
------------------------------------------------------------------------- */
div.pp_pic_holder a:focus { outline:none; }
div.pp_overlay {
background: #fff;
display: none;
left: 0;
position: absolute;
top: 0;
width: 100%;
z-index: 9999;
}
div.pp_pic_holder {
display: none;
position: absolute;
width: 100px;
z-index: 10000;
}
.pp_top {
height: 20px;
position: relative;
}
* html .pp_top { padding: 0 20px; }
.pp_top .pp_left {
height: 20px;
left: 0;
position: absolute;
width: 20px;
}
.pp_top .pp_middle {
height: 20px;
left: 20px;
position: absolute;
right: 20px;
}
* html .pp_top .pp_middle {
left: 0;
position: static;
}
.pp_top .pp_right {
height: 20px;
left: auto;
position: absolute;
right: 0;
top: 0;
width: 20px;
}
.pp_content { height: 40px; min-width: 40px; }
* html .pp_content { width: 40px; }
.pp_fade { display: none; }
.pp_content_container {
position: relative;
text-align: left;
width: 100%;
}
.pp_content_container .pp_left { padding-left: 40px; }
.pp_content_container .pp_right { padding-right: 40px; }
.pp_content_container .pp_details {
float: left;
margin: 10px 0 2px 0;
}
.pp_description {
display: none;
margin: 0;
}
.pp_social { float: left; margin: 0; }
.pp_social .facebook { float: left; margin-left: 5px; width: 55px; overflow: hidden; }
.pp_social .twitter { float: left; }
.pp_nav {
clear: right;
float: left;
margin: 3px 10px 0 0;
}
.pp_nav p {
float: left;
margin: 2px 4px;
white-space: nowrap;
}
.pp_nav .pp_play,
.pp_nav .pp_pause {
float: left;
margin-right: 4px;
text-indent: -10000px;
}
a.pp_arrow_previous,
a.pp_arrow_next {
display: block;
float: left;
height: 15px;
margin-top: 3px;
overflow: hidden;
text-indent: -10000px;
width: 14px;
}
.pp_hoverContainer {
position: absolute;
top: 0;
width: 100%;
z-index: 2000;
}
.pp_gallery {
display: none;
left: 50%;
margin-top: -50px;
position: absolute;
z-index: 10000;
}
.pp_gallery div {
float: left;
overflow: hidden;
position: relative;
}
.pp_gallery ul {
float: left;
height: 35px;
margin: 0 0 0 5px;
padding: 0;
position: relative;
white-space: nowrap;
}
.pp_gallery ul a {
border: 1px #000 solid;
border: 1px rgba(0,0,0,0.5) solid;
display: block;
float: left;
height: 33px;
overflow: hidden;
}
.pp_gallery ul a:hover,
.pp_gallery li.selected a { border-color: #fff; }
.pp_gallery ul a img { border: 0; }
.pp_gallery li {
display: block;
float: left;
margin: 0 5px 0 0;
padding: 0;
}
.pp_gallery li.default a {
display: block;
height: 33px;
width: 50px;
}
.pp_gallery li.default a img { display: none; }
.pp_gallery .pp_arrow_previous,
.pp_gallery .pp_arrow_next {
margin-top: 7px !important;
}
a.pp_next {
display: block;
float: right;
height: 100%;
text-indent: -10000px;
width: 49%;
}
a.pp_previous {
display: block;
float: left;
height: 100%;
text-indent: -10000px;
width: 49%;
}
a.pp_expand,
a.pp_contract {
cursor: pointer;
display: none;
height: 20px;
position: absolute;
right: 30px;
text-indent: -10000px;
top: 10px;
width: 20px;
z-index: 20000;
}
a.pp_close {
position: absolute; right: 0; top: 0;
display: block;
line-height:22px;
text-indent: -10000px;
}
.pp_bottom {
height: 20px;
position: relative;
}
* html .pp_bottom { padding: 0 20px; }
.pp_bottom .pp_left {
height: 20px;
left: 0;
position: absolute;
width: 20px;
}
.pp_bottom .pp_middle {
height: 20px;
left: 20px;
position: absolute;
right: 20px;
}
* html .pp_bottom .pp_middle {
left: 0;
position: static;
}
.pp_bottom .pp_right {
height: 20px;
left: auto;
position: absolute;
right: 0;
top: 0;
width: 20px;
}
.pp_loaderIcon {
display: block;
height: 24px;
left: 50%;
margin: -12px 0 0 -12px;
position: absolute;
top: 50%;
width: 24px;
}
#pp_full_res .pp_inline {
text-align: left;
}
div.ppt {
color: #fff;
display: none;
font-size: 17px;
margin: 0 0 5px 15px;
z-index: 9999;
}

File diff suppressed because one or more lines are too long

View File

@ -8,29 +8,45 @@
/* =Global styles/layout
-------------------------------------------------------------- */
.woocommerce_message, .woocommerce_error, .woocommerce_info {
padding: .55em 1em .55em 3em;
.woocommerce-message, .woocommerce-error, .woocommerce-info {
padding: 1em 1em 1em 3.5em;
margin: 0 0 2em;
position: relative;
.border_radius(2px);
.vertical_gradient( @secondary, darken( @secondary, 3 ) );
.border_radius(4px);
.vertical_gradient( lighten( @secondary, 2 ), @secondary );
color: @secondarytext;
.box_shadow( 0, 1px, 2px, 0, rgba(0,0,0,0.25) );
.text_shadow( 0, 1px, 0, lighten( @secondary, 4 ) );
list-style:none outside;
.clearfix();
width: auto;
-webkit-box-shadow:
inset 0 -2px 6px rgba(0,0,0,0.05),
inset 0 -2px 30px rgba(0,0,0,0.015),
inset 0 1px 0 #fff,
0 1px 2px rgba(0,0,0,0.3);
box-shadow:
inset 0 -2px 6px rgba(0,0,0,0.05),
inset 0 -2px 30px rgba(0,0,0,0.015),
inset 0 1px 0 #fff,
0 1px 2px rgba(0,0,0,0.3);
&:before {
content: "";
height: 16px;
width: 16px;
height: 1.5em;
width: 1.5em;
display:block;
position:absolute;
top: .8em;
top: 0;
left: 1em;
background-color: white;
.border_radius(1em);
font-family: sans-serif;
font-size:1em;
line-height: 1.5;
text-align: center;
color: #fff;
text-shadow:0 1px 0 rgba(0,0,0,0.2);
padding-top:1em;
.border_radius_bottom(4px);
.inset_box_shadow(0,-1px,0,0,rgba(0,0,0,0.1));
}
.button {
@ -39,17 +55,34 @@
li {
list-style:none outside;
padding-left:0;
margin-left:0;
}
}
.woocommerce_message:before {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAGCAYAAAAPDoR2AAAAN0lEQVQIHXWMQQ4AMAjCxv7/ZxZIanbYPIhSUbbXo2Jqf0BsA4mjgU1ioAVpSSrDVbPzFgPt7QH7qwoJ3MDCYgAAAABJRU5ErkJggg==) center no-repeat #8fae1b; /* check icon */
.woocommerce-message {
border-top:3px solid #8fae1b;
&:before {
background-color:#8fae1b;
content: "\2713";
}
}
.woocommerce_info:before {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAAFCAYAAABvsz2cAAAAG0lEQVQIHWP8DwQMQMACxIwwBliECcQDATgDAMHrBQqJ6tMZAAAAAElFTkSuQmCC) center no-repeat #18919c; /* info icon */
.woocommerce-info {
border-top:3px solid #1e85be;
&:before {
background-color:#1e85be;
content: "i";
font-family: Times, Georgia, serif;
font-style: italic;
}
}
.woocommerce_error:before {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAAFCAYAAABvsz2cAAAAHUlEQVQIHWP8DwQMQMAEIkAAzmABchhBIiAGWA0Ar6MFCigWCYMAAAAASUVORK5CYII=) center no-repeat #b81c23; /* error icon */
.woocommerce-error {
border-top:3px solid #b81c23;
&:before {
background-color:#b81c23;
content: "\00d7";
font-weight: 700;
}
}
p.demo_store {
@ -65,10 +98,16 @@ p.demo_store {
.vertical_gradient( @primary, darken(@primary, 10) );
border: 1px solid darken(@primary, 10);
color: @primarytext;
z-index: 999999;
z-index: 99998;
.inset_box_shadow( 0, 0, 0, 3px, rgba(255,255,255,0.2) );
}
.admin-bar { // Styles applied when the admin bar is present
p.demo_store {
top:28px;
}
}
.woocommerce, .woocommerce-page { // namespace to avoid conflict with common global class names
small.note {
@ -79,7 +118,7 @@ p.demo_store {
margin-top: 10px;
}
#breadcrumb {
.woocommerce-breadcrumb{
.clearfix();
margin: 0 0 1em;
padding: 0;
@ -198,7 +237,7 @@ p.demo_store {
}
/* Tabs on the product page */
.woocommerce_tabs {
.woocommerce-tabs {
clear:both;
ul.tabs {
@ -294,7 +333,8 @@ p.demo_store {
/* Cart button */
p.cart {
float: right;
margin-bottom: 2em;
.clearfix();
}
/* add to cart forms */
@ -475,18 +515,18 @@ p.demo_store {
}
}
.woocommerce_result_count {
.woocommerce-result-count {
float: left;
margin: 0 0 1em;
}
.woocommerce_ordering {
.woocommerce-ordering {
margin: 0 0 1em;
float: right;
select {
vertical-align: top;
}
}
nav.woocommerce_pagination, #content nav.woocommerce_pagination {
nav.woocommerce-pagination, #content nav.woocommerce-pagination {
text-align: center;
ul {
display: inline-block;
@ -574,7 +614,7 @@ p.demo_store {
}
}
/*&.added {
&.added {
&:before {
content: "";
position:absolute;
@ -584,9 +624,8 @@ p.demo_store {
right: -26px;
text-indent: 0;
background: url(../images/success.png) no-repeat;
background-size:16px 14px;
}
}*/
}
&:hover {
.vertical_gradient( @secondary, darken( @secondary, 15 ) );
@ -616,9 +655,7 @@ p.demo_store {
}
a.added_to_cart {
background: url(../images/success.png) no-repeat left;
background-size:16px 14px;
padding: 0 0 0 22px;
padding-top: .5em;
white-space: nowrap;
display: inline-block;
}
@ -749,6 +786,7 @@ p.demo_store {
margin: 0;
width: 100%;
background:none;
list-style: none;
li {
padding: 00;
margin: 0 0 20px;
@ -760,7 +798,7 @@ p.demo_store {
color: @subtext;
font-size: 0.75em;
}
img {
img.avatar {
float:left;
position:absolute;
top: 0;
@ -793,18 +831,49 @@ p.demo_store {
}
}
/* Start rating */
/* Star rating */
.star-rating {
float: right;
width: 80px;
height: 16px;
background: url(../images/star.png) repeat-x left 0;
overflow: hidden;
position: relative;
height: 1em;
line-height: 1em;
font-size: 1em;
width: 5.4em;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important;
&:before {
content: "\2606\2606\2606\2606\2606";
color: darken( @secondary, 10 );
float: left;
top: 0;
left: 0;
position: absolute;
letter-spacing: 0.1em;
letter-spacing:0\9; // IE8 & below hack ;-(
}
span {
background: url(../images/star.png) repeat-x left -32px;
height: 0;
padding-top: 16px;
overflow:hidden;
float:left;
overflow: hidden;
float: left;
top: 0;
left: 0;
position: absolute;
padding-top: 1.5em;
}
span:before {
content: "\2605\2605\2605\2605\2605";
top: 0;
position: absolute;
left: 0;
letter-spacing: 0.1em;
letter-spacing:0\9; // IE8 & below hack ;-(
}
}
.products {
.star-rating {
display: block;
margin: 0 0 .5em;
float: none;
}
}
@ -841,35 +910,56 @@ p.demo_store {
}
p.stars {
.clearfix();
span {
width: 80px;
height: 16px;
position: relative;
float:left;
background: url(../images/star.png) repeat-x left 0;
a {
float:left;
position:absolute;
left: 0;
top: 0;
width: 16px;
height: 0;
padding-top: 16px;
overflow:hidden;
}
a:hover, a:focus {
background: url(../images/star.png) repeat-x left -16px;
}
a.active {
background: url(../images/star.png) repeat-x left -32px;
}
a.star-1 { width: 16px; z-index: 10; }
a.star-2 { width: 32px; z-index: 9; }
a.star-3 { width: 48px; z-index: 8; }
a.star-4 { width: 64px; z-index: 7; }
a.star-5 { width: 80px; z-index: 6; }
overflow: hidden;
position: relative;
height: 1em;
line-height: 1em;
font-size: 1em;
width: 5.4em;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important;
&:before {
content: "\2606\2606\2606\2606\2606";
float: left;
top: 0;
left: 0;
position: absolute;
letter-spacing: 0.1em;
letter-spacing:0\9; // IE8 & below hack ;-(
color: darken( @secondary, 10 );
}
a {
float: left;
position: absolute;
left: 0;
top: 0;
width: 1em;
height: 0;
padding-top: 1em;
overflow: hidden;
&:before {
content: "\2605\2605\2605\2605\2605";
top: 0;
position: absolute;
left: 0;
letter-spacing: 0.1em;
letter-spacing:0\9; // IE8 & below hack ;-(
visibility: hidden;
}
}
a:hover:before, a:focus:before {
color: @primary;
visibility: visible;
}
a.active:before {
color: @primary;
visibility: visible;
}
a.star-1 { width: 1em; z-index: 10; }
a.star-2 { width: 2.1em; z-index: 9; }
a.star-3 { width: 3.2em; z-index: 8; }
a.star-4 { width: 4.3em; z-index: 7; }
a.star-5 { width: 5.4em; z-index: 6; }
}
/* =Tables
@ -922,12 +1012,13 @@ p.demo_store {
border-top: 1px solid rgba(0,0,0,0.1);
padding: 6px 12px;
vertical-align: middle;
small {
font-weight: normal;
}
}
td.product-quantity {
text-align: center;
}
tfoot td {
tfoot td, tfoot th {
font-weight:bold;
border-top: 1px solid rgba(0,0,0,0.1);
}
}
@ -935,11 +1026,17 @@ p.demo_store {
font-size: 0.85em;
th, td {
padding: 4px 8px;
vertical-align: top;
vertical-align: middle;
}
.button {
white-space:nowrap;
}
.order-actions {
text-align: right;
.button {
margin: .125em 0 .125em .25em;
}
}
}
td.product-name {
@ -982,13 +1079,19 @@ p.demo_store {
}
a.remove {
display:block;
height: 16px;
width: 16px;
text-indent: -9999px;
background: url(../images/remove.png) darken( @secondary, 10 );
font-size:1.5em;
height:1em;
width:1em;
text-align: center;
line-height: 1;
.border_radius(100%);
color: red;
text-decoration: none;
font-weight: bold;
}
a.remove:hover {
background-color: red;
color: #fff;
}
td.actions {
text-align: right;
@ -1227,16 +1330,16 @@ p.demo_store {
-webkit-box-shadow:none;
box-shadow:none;
}
&.wc-validated {
&.woocommerce-validated {
input.input-text {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAAVElEQVQYV2NkIAIw4lNz5syZ/yB5nIpgCkxMTBixKkJWgNUkdAVgRciC2BSAFe3evfu/oKAg3P3v379ncHV1RXEGmIOsEORQdB/DBUAKQZLopoDEAE3dJm1YbTYqAAAAAElFTkSuQmCC);
background-image: url(../images/icons/valid.png);
background-position: 95% center;
background-repeat: no-repeat;
}
}
&.wc-error {
&.woocommerce-invalid {
input.input-text {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAAZUlEQVQYV2NkQAO/6zv+szZWMCILo3BAChjfvgPLs0zpgsthKAKZ8ien7D9WRSBTQCbAFCGbBjeJoCKYAoRJpUBTIfpB1oJZyIpgDmdgANnOCFGEUAARRHYTLBjAPkGECUQhOgAAec48xMU9V4oAAAAASUVORK5CYII=);
background-image: url(../images/icons/invalid.png);
background-position: 95% center;
background-repeat: no-repeat;
}
@ -1265,6 +1368,9 @@ p.demo_store {
.form-row-last {
float: right;
}
.form-row-wide {
clear: both;
}
}
form.login, form.checkout_coupon, form.register {
@ -1637,3 +1743,55 @@ p.demo_store {
}
}
} // end .woocommerce-page namespacing wrap
@media
(-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
.woocommerce, .woocommerce-page {
a.button, button.button, input.button, #respond input#submit, #content input.button {
&.loading {
&:before {
background-image: url(../images/ajax-loader@2x.gif);
background-size: 16px 16px;
}
}
&.added:before {
background: url(../images/success@2x.png) no-repeat;
background-size:16px 14px;
}
}
.woocommerce form .form-row.woocommerce-validated input.input-text, .woocommerce-page form .form-row.woocommerce-validated input.input-text {
background-image: url(../images/icons/valid@2x.png);
background-size: 12px 9px;
}
.woocommerce form .form-row.woocommerce-invalid input.input-text, .woocommerce-page form .form-row.woocommerce-invalid input.input-text {
background-image: url(../images/icons/invalid@2x.png);
background-size: 12px 9px;
}
}
}
// Firefox hack :( (for some reason Firefox doesn't like applying font-size to pseudo-elements containing unicode chars in the content property)
@-moz-document url-prefix() {
.woocommerce .star-rating, .woocommerce-page .star-rating {
width:3.4em;
font-size:1.5em;
}
.woocommerce p.stars, .woocommerce-page p.stars {
width:3.5em;
font-size:1.5em;
a.star-1 {
width:.7em;
}
a.star-2 {
width:1.4em;
}
a.star-3 {
width:2.1em;
}
a.star-4 {
width:2.8em;
}
a.star-5 {
width:3.5em;
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 911 B

After

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 B

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 806 B

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 600 B

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 658 B

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 858 B

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 654 B

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 814 B

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 B

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 587 B

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 378 B

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 643 B

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 444 B

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 831 B

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 B

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Some files were not shown because too many files have changed in this diff Show More