Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
f186cc4a4f
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* CssMin - A (simple) css minifier with benefits
|
* CssMin - A (simple) css minifier with benefits
|
||||||
*
|
*
|
||||||
|
@ -5078,5 +5078,5 @@ class CssAtCharsetParserPlugin extends aCssParserPlugin
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -77,7 +77,7 @@ function woocommerce_custom_order_columns($column) {
|
||||||
$user = __('Guest', 'woocommerce');
|
$user = __('Guest', 'woocommerce');
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
echo '<a href="'.admin_url('post.php?post='.$post->ID.'&action=edit').'"><strong>'.sprintf( __('Order #%s', 'woocommerce'), $post->ID ).'</strong></a> ' . __('made by', 'woocommerce') . ' ' . $user;
|
echo '<a href="'.admin_url('post.php?post='.$post->ID.'&action=edit').'"><strong>'.sprintf( __('Order %s', 'woocommerce'), $order->get_order_number() ).'</strong></a> ' . __('made by', 'woocommerce') . ' ' . $user;
|
||||||
|
|
||||||
if ($order->billing_email) :
|
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>';
|
echo '<small class="meta">'.__('Email:', 'woocommerce') . ' ' . '<a href="' . esc_url( 'mailto:'.$order->billing_email ).'">'.esc_html( $order->billing_email ).'</a></small>';
|
||||||
|
@ -330,7 +330,7 @@ function woocommerce_shop_order_search_custom_fields( $wp ) {
|
||||||
if( !isset( $wp->query_vars['s'] ) || !$wp->query_vars['s'] ) 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 ($wp->query_vars['post_type']!='shop_order') return $wp;
|
||||||
|
|
||||||
$search_fields = array(
|
$search_fields = apply_filters( 'woocommerce_shop_order_search_fields', array(
|
||||||
'_order_key',
|
'_order_key',
|
||||||
'_billing_first_name',
|
'_billing_first_name',
|
||||||
'_billing_last_name',
|
'_billing_last_name',
|
||||||
|
@ -344,7 +344,7 @@ function woocommerce_shop_order_search_custom_fields( $wp ) {
|
||||||
'_billing_email',
|
'_billing_email',
|
||||||
'_order_items',
|
'_order_items',
|
||||||
'_billing_phone'
|
'_billing_phone'
|
||||||
);
|
) );
|
||||||
|
|
||||||
// Query matching custom fields - this seems faster than meta_query
|
// 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']) ));
|
$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']) ));
|
||||||
|
|
|
@ -52,7 +52,7 @@ function woocommerce_order_data_meta_box($post) {
|
||||||
|
|
||||||
<div class="order_data_left">
|
<div class="order_data_left">
|
||||||
|
|
||||||
<h2><?php _e('Order Details', 'woocommerce'); ?> — #<?php echo $thepostid; ?></h2>
|
<h2><?php _e('Order Details', 'woocommerce'); ?> — <?php echo $order->get_order_number(); ?></h2>
|
||||||
|
|
||||||
<p class="form-field"><label for="order_status"><?php _e('Order status:', 'woocommerce') ?></label>
|
<p class="form-field"><label for="order_status"><?php _e('Order status:', 'woocommerce') ?></label>
|
||||||
<select id="order_status" name="order_status" class="chosen_select">
|
<select id="order_status" name="order_status" class="chosen_select">
|
||||||
|
|
|
@ -10,6 +10,19 @@
|
||||||
function woocommerce_debug() {
|
function woocommerce_debug() {
|
||||||
global $woocommerce;
|
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' ),
|
||||||
|
),
|
||||||
|
'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' ),
|
||||||
|
),
|
||||||
|
) );
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="wrap woocommerce">
|
<div class="wrap woocommerce">
|
||||||
<div class="icon32 icon32-woocommerce-status" id="icon-woocommerce"><br /></div>
|
<div class="icon32 icon32-woocommerce-status" id="icon-woocommerce"><br /></div>
|
||||||
|
@ -17,6 +30,7 @@ function woocommerce_debug() {
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ( ! empty( $_GET['action'] ) && ! empty( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'debug_action' ) ) {
|
if ( ! empty( $_GET['action'] ) && ! empty( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'debug_action' ) ) {
|
||||||
|
|
||||||
switch ( $_GET['action'] ) {
|
switch ( $_GET['action'] ) {
|
||||||
case "clear_transients" :
|
case "clear_transients" :
|
||||||
$woocommerce->clear_product_transients();
|
$woocommerce->clear_product_transients();
|
||||||
|
@ -37,6 +51,20 @@ function woocommerce_debug() {
|
||||||
|
|
||||||
echo '<div class="updated"><p>' . __('Roles successfully reset', 'woocommerce') . '</p></div>';
|
echo '<div class="updated"><p>' . __('Roles successfully reset', 'woocommerce') . '</p></div>';
|
||||||
break;
|
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>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -51,7 +79,7 @@ function woocommerce_debug() {
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="alternate">
|
<tr>
|
||||||
<td><?php _e('WooCommerce version','woocommerce')?></td>
|
<td><?php _e('WooCommerce version','woocommerce')?></td>
|
||||||
<td><?php echo $woocommerce->version; ?></td>
|
<td><?php echo $woocommerce->version; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -59,7 +87,7 @@ function woocommerce_debug() {
|
||||||
<td><?php _e('WordPress version','woocommerce')?></td>
|
<td><?php _e('WordPress version','woocommerce')?></td>
|
||||||
<td><?php if ( is_multisite() ) echo 'WPMU'; else echo 'WP'; ?> <?php echo bloginfo('version'); ?></td>
|
<td><?php if ( is_multisite() ) echo 'WPMU'; else echo 'WP'; ?> <?php echo bloginfo('version'); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="alternate">
|
<tr>
|
||||||
<td><?php _e('Installed plugins','woocommerce')?></td>
|
<td><?php _e('Installed plugins','woocommerce')?></td>
|
||||||
<td><?php
|
<td><?php
|
||||||
$active_plugins = (array) get_option( 'active_plugins', array() );
|
$active_plugins = (array) get_option( 'active_plugins', array() );
|
||||||
|
@ -97,7 +125,7 @@ function woocommerce_debug() {
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="alternate">
|
<tr>
|
||||||
<td><?php _e('Home URL','woocommerce')?></td>
|
<td><?php _e('Home URL','woocommerce')?></td>
|
||||||
<td><?php echo home_url(); ?></td>
|
<td><?php echo home_url(); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -105,7 +133,7 @@ function woocommerce_debug() {
|
||||||
<td><?php _e('Site URL','woocommerce')?></td>
|
<td><?php _e('Site URL','woocommerce')?></td>
|
||||||
<td><?php echo site_url(); ?></td>
|
<td><?php echo site_url(); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="alternate">
|
<tr>
|
||||||
<td><?php _e('Force SSL','woocommerce')?></td>
|
<td><?php _e('Force SSL','woocommerce')?></td>
|
||||||
<td><?php echo ucwords(get_option('woocommerce_force_ssl_checkout')); ?></td>
|
<td><?php echo ucwords(get_option('woocommerce_force_ssl_checkout')); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -162,7 +190,7 @@ function woocommerce_debug() {
|
||||||
|
|
||||||
foreach ( $check_pages as $page_name => $values ) {
|
foreach ( $check_pages as $page_name => $values ) {
|
||||||
|
|
||||||
if ( $alt == 1 ) echo '<tr class="alternate">'; else echo '<tr>';
|
if ( $alt == 1 ) echo '<tr>'; else echo '<tr>';
|
||||||
|
|
||||||
echo '<td>' . $page_name . '</td><td>';
|
echo '<td>' . $page_name . '</td><td>';
|
||||||
|
|
||||||
|
@ -206,7 +234,7 @@ function woocommerce_debug() {
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="alternate">
|
<tr>
|
||||||
<td><?php _e('PHP Version','woocommerce')?></td>
|
<td><?php _e('PHP Version','woocommerce')?></td>
|
||||||
<td><?php
|
<td><?php
|
||||||
if ( function_exists( 'phpversion' ) ) echo phpversion();
|
if ( function_exists( 'phpversion' ) ) echo phpversion();
|
||||||
|
@ -218,7 +246,7 @@ function woocommerce_debug() {
|
||||||
echo $_SERVER['SERVER_SOFTWARE'];
|
echo $_SERVER['SERVER_SOFTWARE'];
|
||||||
?></td>
|
?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="alternate">
|
<tr>
|
||||||
<td><?php _e('WP Max Upload Size','woocommerce'); ?></td>
|
<td><?php _e('WP Max Upload Size','woocommerce'); ?></td>
|
||||||
<td><?php
|
<td><?php
|
||||||
echo wp_convert_bytes_to_hr( wp_max_upload_size() );
|
echo wp_convert_bytes_to_hr( wp_max_upload_size() );
|
||||||
|
@ -231,7 +259,7 @@ function woocommerce_debug() {
|
||||||
echo wp_convert_bytes_to_hr( woocommerce_let_to_num( ini_get('upload_max_filesize') ) );
|
echo wp_convert_bytes_to_hr( woocommerce_let_to_num( ini_get('upload_max_filesize') ) );
|
||||||
?></td>
|
?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="alternate">
|
<tr>
|
||||||
<td><?php _e('Server post_max_size','woocommerce')?></td>
|
<td><?php _e('Server post_max_size','woocommerce')?></td>
|
||||||
<td><?php
|
<td><?php
|
||||||
if(function_exists('phpversion'))
|
if(function_exists('phpversion'))
|
||||||
|
@ -244,7 +272,7 @@ function woocommerce_debug() {
|
||||||
echo wp_convert_bytes_to_hr( woocommerce_let_to_num( WP_MEMORY_LIMIT ) );
|
echo wp_convert_bytes_to_hr( woocommerce_let_to_num( WP_MEMORY_LIMIT ) );
|
||||||
?></td>
|
?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="alternate">
|
<tr>
|
||||||
<td><?php _e('WP Debug Mode','woocommerce')?></td>
|
<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>
|
<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>
|
||||||
|
@ -266,7 +294,7 @@ function woocommerce_debug() {
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="alternate">
|
<tr>
|
||||||
<td><?php _e('Session save path','woocommerce')?></td>
|
<td><?php _e('Session save path','woocommerce')?></td>
|
||||||
<td><?php
|
<td><?php
|
||||||
$save_path = session_save_path();
|
$save_path = session_save_path();
|
||||||
|
@ -288,31 +316,49 @@ function woocommerce_debug() {
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$posting = array();
|
||||||
|
|
||||||
|
// fsockopen/Curl
|
||||||
|
$posting['fsockopen_curl']['name'] = __('fsockopen/Curl','woocommerce');
|
||||||
|
if( function_exists('fsockopen') || function_exists('curl_init') ) {
|
||||||
|
$posting['fsockopen_curl']['note'] = __('Your server has fsockopen or Curl enabled.', 'woocommerce');
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// WP Remote Post Check
|
||||||
|
$posting['wp_remote_post']['name'] = __('WP Remote Post Check','woocommerce');
|
||||||
|
$params = array(
|
||||||
|
'sslverify' => false,
|
||||||
|
'timeout' => 30,
|
||||||
|
'user-agent' => 'WooCommerce/'.$woocommerce->version
|
||||||
|
);
|
||||||
|
$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;
|
||||||
|
} else {
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
|
$posting = apply_filters( 'wc_debug_posting', $posting );
|
||||||
|
?>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="alternate">
|
<?php foreach($posting as $post) { $mark = ( isset( $post['success'] ) && $post['success'] == true ) ? 'yes' : 'error'; ?>
|
||||||
<td><?php _e('fsockopen/Curl','woocommerce')?></td>
|
<tr>
|
||||||
<td><?php
|
<td><?php echo $post['name']; ?></td>
|
||||||
if( function_exists('fsockopen') || function_exists('curl_init') )
|
<td>
|
||||||
echo '<mark class="yes">' . __('Your server has fsockopen or Curl enabled.', 'woocommerce'). '</mark>';
|
<mark class="<?php echo $mark; ?>">
|
||||||
else
|
<?php echo $post['note']; ?>
|
||||||
echo '<mark class="error">' . __('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>'; ?></td>
|
</mark>
|
||||||
</tr>
|
</td>
|
||||||
<tr>
|
|
||||||
<td><?php _e('WP Remote Post Check','woocommerce')?></td>
|
|
||||||
<td><?php
|
|
||||||
$params = array(
|
|
||||||
'sslverify' => false,
|
|
||||||
'timeout' => 30,
|
|
||||||
'user-agent' => 'WooCommerce/'.$woocommerce->version
|
|
||||||
);
|
|
||||||
$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 )
|
|
||||||
echo '<mark class="yes">' . __('wp_remote_post() was successful - PayPal IPN is working.', 'woocommerce'). '</mark>';
|
|
||||||
else
|
|
||||||
echo '<mark class="error">' . __('wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider. Error: ', 'woocommerce') . $response->get_error_message() . '</mark>';
|
|
||||||
?></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
<thead class="tools">
|
<thead class="tools">
|
||||||
|
@ -320,26 +366,19 @@ function woocommerce_debug() {
|
||||||
<th colspan="2"><?php _e( 'Tools', 'woocommerce' ); ?></th>
|
<th colspan="2"><?php _e( 'Tools', 'woocommerce' ); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody class="tools">
|
<tbody class="tools">
|
||||||
<tr class="alternate">
|
<?php foreach($tools as $action => $tool) { ?>
|
||||||
<td><?php _e('Transients','woocommerce')?></td>
|
|
||||||
<td>
|
|
||||||
<p>
|
|
||||||
<a href="<?php echo wp_nonce_url( admin_url('tools.php?page=woocommerce_debug&action=clear_transients'), 'debug_action' ); ?>" class="button"><?php _e('Clear Transients','woocommerce')?></a>
|
|
||||||
<span class="description"><?php _e( 'This tool will clear the product/shop transients cache.', 'woocommerce' ); ?></span>
|
|
||||||
</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php _e('Capabilities','woocommerce')?></td>
|
<td><?php echo $tool['name']; ?></td>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
<a href="<?php echo wp_nonce_url( admin_url('tools.php?page=woocommerce_debug&action=reset_roles'), 'debug_action' ); ?>" class="button"><?php _e('Reset Capabilities','woocommerce')?></a>
|
<a href="<?php echo wp_nonce_url( admin_url('tools.php?page=woocommerce_debug&action=' . $action ), 'debug_action' ); ?>" class="button"><?php echo $tool['button']; ?></a>
|
||||||
<span class="description"><?php _e( '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' ); ?></span>
|
<span class="description"><?php echo $tool['desc']; ?></span>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ function do_install_woocommerce() {
|
||||||
// Do install
|
// Do install
|
||||||
woocommerce_default_options();
|
woocommerce_default_options();
|
||||||
woocommerce_tables_install();
|
woocommerce_tables_install();
|
||||||
woocommerce_install_custom_fields();
|
|
||||||
|
|
||||||
// Register post types
|
// Register post types
|
||||||
$woocommerce->init_taxonomy();
|
$woocommerce->init_taxonomy();
|
||||||
|
@ -27,23 +26,25 @@ function do_install_woocommerce() {
|
||||||
woocommerce_default_taxonomies();
|
woocommerce_default_taxonomies();
|
||||||
|
|
||||||
// Install folder for uploading files and prevent hotlinking
|
// Install folder for uploading files and prevent hotlinking
|
||||||
$upload_dir = wp_upload_dir();
|
$upload_dir = wp_upload_dir();
|
||||||
$downloads_url = $upload_dir['basedir'] . '/woocommerce_uploads';
|
$downloads_url = $upload_dir['basedir'] . '/woocommerce_uploads';
|
||||||
if ( wp_mkdir_p($downloads_url) && !file_exists($downloads_url.'/.htaccess') ) :
|
|
||||||
if ($file_handle = @fopen( $downloads_url . '/.htaccess', 'w' )) :
|
if ( wp_mkdir_p( $downloads_url ) && ! file_exists( $downloads_url.'/.htaccess' ) ) {
|
||||||
|
if ( $file_handle = @fopen( $downloads_url . '/.htaccess', 'w' ) ) {
|
||||||
fwrite($file_handle, 'deny from all');
|
fwrite($file_handle, 'deny from all');
|
||||||
fclose($file_handle);
|
fclose($file_handle);
|
||||||
endif;
|
}
|
||||||
endif;
|
}
|
||||||
|
|
||||||
// Install folder for logs
|
// Install folder for logs
|
||||||
$logs_url = WP_PLUGIN_DIR . "/" . plugin_basename( dirname(dirname(__FILE__))) . '/logs';
|
$logs_url = WP_PLUGIN_DIR . "/" . plugin_basename( dirname(dirname(__FILE__))) . '/logs';
|
||||||
if ( wp_mkdir_p($logs_url) && !file_exists($logs_url.'/.htaccess') ) :
|
|
||||||
if ($file_handle = @fopen( $logs_url . '/.htaccess', 'w' )) :
|
if ( wp_mkdir_p( $logs_url ) && ! file_exists( $logs_url . '/.htaccess' ) ) {
|
||||||
|
if ( $file_handle = @fopen( $logs_url . '/.htaccess', 'w' ) ) {
|
||||||
fwrite($file_handle, 'deny from all');
|
fwrite($file_handle, 'deny from all');
|
||||||
fclose($file_handle);
|
fclose($file_handle);
|
||||||
endif;
|
}
|
||||||
endif;
|
}
|
||||||
|
|
||||||
// Clear transient cache
|
// Clear transient cache
|
||||||
$woocommerce->clear_product_transients();
|
$woocommerce->clear_product_transients();
|
||||||
|
@ -52,7 +53,7 @@ function do_install_woocommerce() {
|
||||||
if ( get_option('woocommerce_frontend_css') == 'yes' ) {
|
if ( get_option('woocommerce_frontend_css') == 'yes' ) {
|
||||||
|
|
||||||
// Handle Colour Settings
|
// Handle Colour Settings
|
||||||
$colors = get_option( 'woocommerce_frontend_css_colors' );
|
$colors = get_option( 'woocommerce_frontend_css_colors' );
|
||||||
|
|
||||||
if ( (
|
if ( (
|
||||||
! empty( $colors['primary'] ) &&
|
! empty( $colors['primary'] ) &&
|
||||||
|
@ -79,24 +80,6 @@ function do_install_woocommerce() {
|
||||||
update_option( "woocommerce_db_version", $woocommerce->version );
|
update_option( "woocommerce_db_version", $woocommerce->version );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add required post meta so queries work
|
|
||||||
*/
|
|
||||||
function woocommerce_install_custom_fields() {
|
|
||||||
|
|
||||||
// Attachment exclusion
|
|
||||||
$args = array(
|
|
||||||
'post_type' => 'attachment',
|
|
||||||
'numberposts' => -1,
|
|
||||||
'post_status' => null,
|
|
||||||
'fields' => 'ids'
|
|
||||||
);
|
|
||||||
$attachments = get_posts($args);
|
|
||||||
if ($attachments) foreach ($attachments as $id) :
|
|
||||||
update_post_meta($id, '_woocommerce_exclude_image', 0);
|
|
||||||
endforeach;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default options
|
* Default options
|
||||||
*
|
*
|
||||||
|
@ -108,30 +91,30 @@ function woocommerce_default_options() {
|
||||||
// Include settings so that we can run through defaults
|
// Include settings so that we can run through defaults
|
||||||
include_once( 'woocommerce-admin-settings.php' );
|
include_once( 'woocommerce-admin-settings.php' );
|
||||||
|
|
||||||
foreach ($woocommerce_settings as $section) :
|
foreach ($woocommerce_settings as $section) {
|
||||||
|
|
||||||
foreach ($section as $value) :
|
foreach ( $section as $value ) {
|
||||||
|
|
||||||
if (isset($value['std']) && isset($value['id'])) :
|
if ( isset( $value['std'] ) && isset( $value['id'] ) ) {
|
||||||
|
|
||||||
if ($value['type']=='image_width') :
|
if ( $value['type'] == 'image_width' ) {
|
||||||
|
|
||||||
add_option($value['id'].'_width', $value['std']);
|
add_option($value['id'].'_width', $value['std']);
|
||||||
add_option($value['id'].'_height', $value['std']);
|
add_option($value['id'].'_height', $value['std']);
|
||||||
|
|
||||||
else :
|
} else {
|
||||||
|
|
||||||
add_option($value['id'], $value['std']);
|
add_option($value['id'], $value['std']);
|
||||||
|
|
||||||
endif;
|
}
|
||||||
|
|
||||||
endif;
|
}
|
||||||
|
|
||||||
endforeach;
|
}
|
||||||
|
|
||||||
endforeach;
|
}
|
||||||
|
|
||||||
add_option('woocommerce_shop_slug', 'shop');
|
add_option( 'woocommerce_shop_slug', 'shop' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -142,33 +125,29 @@ function woocommerce_create_page( $slug, $option, $page_title = '', $page_conten
|
||||||
|
|
||||||
$option_value = get_option($option);
|
$option_value = get_option($option);
|
||||||
|
|
||||||
if ($option_value>0) :
|
if ( $option_value > 0 && get_post( $option_value ) )
|
||||||
if (get_post( $option_value )) :
|
return;
|
||||||
// Page exists
|
|
||||||
return;
|
|
||||||
endif;
|
|
||||||
endif;
|
|
||||||
|
|
||||||
$page_found = $wpdb->get_var("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = '$slug' LIMIT 1;");
|
$page_found = $wpdb->get_var("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = '$slug' LIMIT 1;");
|
||||||
if ($page_found) :
|
if ( $page_found ) :
|
||||||
// Page exists
|
if ( ! $option_value )
|
||||||
if (!$option_value) update_option($option, $page_found);
|
update_option( $option, $page_found );
|
||||||
return;
|
return;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
$page_data = array(
|
$page_data = array(
|
||||||
'post_status' => 'publish',
|
'post_status' => 'publish',
|
||||||
'post_type' => 'page',
|
'post_type' => 'page',
|
||||||
'post_author' => 1,
|
'post_author' => 1,
|
||||||
'post_name' => $slug,
|
'post_name' => $slug,
|
||||||
'post_title' => $page_title,
|
'post_title' => $page_title,
|
||||||
'post_content' => $page_content,
|
'post_content' => $page_content,
|
||||||
'post_parent' => $post_parent,
|
'post_parent' => $post_parent,
|
||||||
'comment_status' => 'closed'
|
'comment_status' => 'closed'
|
||||||
);
|
);
|
||||||
$page_id = wp_insert_post($page_data);
|
$page_id = wp_insert_post( $page_data );
|
||||||
|
|
||||||
update_option($option, $page_id);
|
update_option( $option, $page_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -221,7 +200,7 @@ function woocommerce_tables_install() {
|
||||||
$wpdb->hide_errors();
|
$wpdb->hide_errors();
|
||||||
|
|
||||||
$collate = '';
|
$collate = '';
|
||||||
if( $wpdb->supports_collation() ) {
|
if ( $wpdb->supports_collation() ) {
|
||||||
if( ! empty($wpdb->charset ) ) $collate .= "DEFAULT CHARACTER SET $wpdb->charset";
|
if( ! empty($wpdb->charset ) ) $collate .= "DEFAULT CHARACTER SET $wpdb->charset";
|
||||||
if( ! empty($wpdb->collate ) ) $collate .= " COLLATE $wpdb->collate";
|
if( ! empty($wpdb->collate ) ) $collate .= " COLLATE $wpdb->collate";
|
||||||
}
|
}
|
||||||
|
@ -277,13 +256,14 @@ CREATE TABLE ". $wpdb->prefix . "woocommerce_termmeta (
|
||||||
// Update woocommerce_downloadable_product_permissions table to include order ID's as well as keys
|
// Update woocommerce_downloadable_product_permissions table to include order ID's as well as keys
|
||||||
$results = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."woocommerce_downloadable_product_permissions WHERE order_id = 0;" );
|
$results = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."woocommerce_downloadable_product_permissions WHERE order_id = 0;" );
|
||||||
|
|
||||||
if ($results) foreach ($results as $result) :
|
if ( $results ) foreach ( $results as $result ) {
|
||||||
|
|
||||||
if (!$result->order_key) continue;
|
if ( ! $result->order_key )
|
||||||
|
continue;
|
||||||
|
|
||||||
$order_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM ".$wpdb->postmeta." WHERE meta_key = '_order_key' AND meta_value = '%s' LIMIT 1;", $result->order_key) );
|
$order_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_order_key' AND meta_value = '%s' LIMIT 1;", $result->order_key ) );
|
||||||
|
|
||||||
if ($order_id) :
|
if ( $order_id ) {
|
||||||
|
|
||||||
$wpdb->update( $wpdb->prefix . "woocommerce_downloadable_product_permissions", array(
|
$wpdb->update( $wpdb->prefix . "woocommerce_downloadable_product_permissions", array(
|
||||||
'order_id' => $order_id,
|
'order_id' => $order_id,
|
||||||
|
@ -292,24 +272,22 @@ CREATE TABLE ". $wpdb->prefix . "woocommerce_termmeta (
|
||||||
'order_key' => $result->order_key
|
'order_key' => $result->order_key
|
||||||
), array( '%s' ), array( '%s', '%s' ) );
|
), array( '%s' ), array( '%s', '%s' ) );
|
||||||
|
|
||||||
endif;
|
}
|
||||||
|
|
||||||
endforeach;
|
}
|
||||||
|
|
||||||
// Upgrade old meta keys for product data
|
// Upgrade old meta keys for product data
|
||||||
$meta = array('sku', 'downloadable', 'virtual', 'price', 'visibility', 'stock', 'stock_status', 'backorders', 'manage_stock', 'sale_price', 'regular_price', 'weight', 'length', 'width', 'height', 'tax_status', 'tax_class', 'upsell_ids', 'crosssell_ids', 'sale_price_dates_from', 'sale_price_dates_to', 'min_variation_price', 'max_variation_price', 'featured', 'product_attributes', 'file_path', 'download_limit', 'product_url', 'min_variation_price', 'max_variation_price');
|
$meta = array('sku', 'downloadable', 'virtual', 'price', 'visibility', 'stock', 'stock_status', 'backorders', 'manage_stock', 'sale_price', 'regular_price', 'weight', 'length', 'width', 'height', 'tax_status', 'tax_class', 'upsell_ids', 'crosssell_ids', 'sale_price_dates_from', 'sale_price_dates_to', 'min_variation_price', 'max_variation_price', 'featured', 'product_attributes', 'file_path', 'download_limit', 'product_url', 'min_variation_price', 'max_variation_price');
|
||||||
|
|
||||||
$wpdb->query("
|
$wpdb->query("
|
||||||
UPDATE $wpdb->postmeta
|
UPDATE {$wpdb->postmeta}
|
||||||
LEFT JOIN $wpdb->posts ON ( $wpdb->postmeta.post_id = $wpdb->posts.ID )
|
LEFT JOIN {$wpdb->posts} ON ( {$wpdb->postmeta}.post_id = {$wpdb->posts}.ID )
|
||||||
SET meta_key = CONCAT('_', meta_key)
|
SET meta_key = CONCAT( '_', meta_key )
|
||||||
WHERE meta_key IN ('". implode("', '", $meta) ."')
|
WHERE meta_key IN ( '" . implode( "', '", $meta ) . "' )
|
||||||
AND $wpdb->posts.post_type IN ('product', 'product_variation')
|
AND {$wpdb->posts}.post_type IN ('product', 'product_variation')
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
$wpdb->show_errors();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -326,9 +304,9 @@ function woocommerce_default_taxonomies() {
|
||||||
'external'
|
'external'
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($product_types as $type) {
|
foreach ( $product_types as $type ) {
|
||||||
if (!get_term_by( 'slug', sanitize_title($type), 'product_type')) {
|
if ( ! get_term_by( 'slug', sanitize_title( $type ), 'product_type' ) ) {
|
||||||
wp_insert_term($type, 'product_type');
|
wp_insert_term( $type, 'product_type' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,31 +320,31 @@ function woocommerce_default_taxonomies() {
|
||||||
'cancelled'
|
'cancelled'
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($order_status as $status) {
|
foreach ( $order_status as $status ) {
|
||||||
if (!get_term_by( 'slug', sanitize_title($status), 'shop_order_status')) {
|
if ( ! get_term_by( 'slug', sanitize_title($status), 'shop_order_status' ) ) {
|
||||||
wp_insert_term($status, 'shop_order_status');
|
wp_insert_term( $status, 'shop_order_status' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upgrade from old downloadable/virtual product types
|
// Upgrade from old downloadable/virtual product types
|
||||||
$downloadable_type = get_term_by('slug', 'downloadable', 'product_type');
|
$downloadable_type = get_term_by( 'slug', 'downloadable', 'product_type' );
|
||||||
if ($downloadable_type) :
|
if ( $downloadable_type ) {
|
||||||
$products = get_objects_in_term( $downloadable_type->term_id, 'product_type' );
|
$products = get_objects_in_term( $downloadable_type->term_id, 'product_type' );
|
||||||
foreach ($products as $product) :
|
foreach ( $products as $product ) {
|
||||||
update_post_meta( $product, '_downloadable', 'yes' );
|
update_post_meta( $product, '_downloadable', 'yes' );
|
||||||
update_post_meta( $product, '_virtual', 'yes' );
|
update_post_meta( $product, '_virtual', 'yes' );
|
||||||
wp_set_object_terms( $product, 'simple', 'product_type');
|
wp_set_object_terms( $product, 'simple', 'product_type');
|
||||||
endforeach;
|
}
|
||||||
endif;
|
}
|
||||||
|
|
||||||
$virtual_type = get_term_by('slug', 'virtual', 'product_type');
|
$virtual_type = get_term_by( 'slug', 'virtual', 'product_type' );
|
||||||
if ($virtual_type) :
|
if ( $virtual_type ) {
|
||||||
$products = get_objects_in_term( $virtual_type->term_id, 'product_type' );
|
$products = get_objects_in_term( $virtual_type->term_id, 'product_type' );
|
||||||
foreach ($products as $product) :
|
foreach ( $products as $product ) {
|
||||||
update_post_meta( $product, '_downloadable', 'no' );
|
update_post_meta( $product, '_downloadable', 'no' );
|
||||||
update_post_meta( $product, '_virtual', 'yes' );
|
update_post_meta( $product, '_virtual', 'yes' );
|
||||||
wp_set_object_terms( $product, 'simple', 'product_type');
|
wp_set_object_terms( $product, 'simple', 'product_type');
|
||||||
endforeach;
|
}
|
||||||
endif;
|
}
|
||||||
|
|
||||||
}
|
}
|
File diff suppressed because one or more lines are too long
|
@ -160,12 +160,6 @@ input.wc-error {
|
||||||
background-color: #FFBABA;
|
background-color: #FFBABA;
|
||||||
}
|
}
|
||||||
|
|
||||||
span.mce_woocommerce_shortcodes_button {
|
|
||||||
background-image: url(../images/icons/wc_icon.png) !important;
|
|
||||||
background-repeat: no-repeat !important;
|
|
||||||
background-position: center !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Status page */
|
/* Status page */
|
||||||
table.wc_status_table {
|
table.wc_status_table {
|
||||||
th {
|
th {
|
||||||
|
|
|
@ -1,12 +1,47 @@
|
||||||
#adminmenu #menu-posts-product div.wp-menu-image{background:transparent url(../images/icons/menu_icons.png) no-repeat -32px -32px;}
|
/* Menu */
|
||||||
#adminmenu #menu-posts-product.wp-menu-open div.wp-menu-image,#adminmenu #menu-posts-product:hover div.wp-menu-image{background-position:-32px 0px;}
|
#adminmenu #menu-posts-product div.wp-menu-image {
|
||||||
#adminmenu #menu-posts-product img{display:none;}
|
background: transparent url(../images/icons/menu_icons.png) no-repeat -32px -32px;
|
||||||
#adminmenu #menu-posts-shop_order div.wp-menu-image{background:transparent url(../images/icons/menu_icons.png) no-repeat -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 0px;}
|
#adminmenu #menu-posts-product.wp-menu-open div.wp-menu-image,
|
||||||
#adminmenu #menu-posts-shop_order img{display:none;}
|
#adminmenu #menu-posts-product:hover div.wp-menu-image {
|
||||||
#adminmenu #menu-posts-shop_coupon div.wp-menu-image{background:transparent url(../images/icons/menu_icons.png) no-repeat -96px -32px;}
|
background-position: -32px 0px;
|
||||||
#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 0px;}
|
}
|
||||||
#adminmenu #menu-posts-shop_coupon img{display:none;}
|
#adminmenu #menu-posts-product img {
|
||||||
#adminmenu #toplevel_page_woocommerce div.wp-menu-image{background:transparent url(../images/icons/menu_icons.png) no-repeat 0px -32px;}
|
display: none;
|
||||||
#adminmenu #toplevel_page_woocommerce.wp-menu-open div.wp-menu-image,#adminmenu #toplevel_page_woocommerce:hover div.wp-menu-image{background-position:0px 0px;}
|
}
|
||||||
#adminmenu #toplevel_page_woocommerce img{display:none;}
|
#adminmenu #menu-posts-shop_order div.wp-menu-image {
|
||||||
|
background: transparent url(../images/icons/menu_icons.png) no-repeat -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 0px;
|
||||||
|
}
|
||||||
|
#adminmenu #menu-posts-shop_order img {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#adminmenu #menu-posts-shop_coupon div.wp-menu-image {
|
||||||
|
background: transparent url(../images/icons/menu_icons.png) no-repeat -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 0px;
|
||||||
|
}
|
||||||
|
#adminmenu #menu-posts-shop_coupon img {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#adminmenu #toplevel_page_woocommerce div.wp-menu-image {
|
||||||
|
background: transparent url(../images/icons/menu_icons.png) no-repeat 0px -32px;
|
||||||
|
}
|
||||||
|
#adminmenu #toplevel_page_woocommerce.wp-menu-open div.wp-menu-image,
|
||||||
|
#adminmenu #toplevel_page_woocommerce:hover div.wp-menu-image {
|
||||||
|
background-position: 0px 0px;
|
||||||
|
}
|
||||||
|
#adminmenu #toplevel_page_woocommerce img {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
/* Editor button */
|
||||||
|
span.mce_woocommerce_shortcodes_button {
|
||||||
|
background-image: url(../images/icons/wc_icon.png) !important;
|
||||||
|
background-repeat: no-repeat !important;
|
||||||
|
background-position: center !important;
|
||||||
|
}
|
||||||
|
|
|
@ -44,4 +44,11 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Editor button */
|
||||||
|
span.mce_woocommerce_shortcodes_button {
|
||||||
|
background-image: url(../images/icons/wc_icon.png) !important;
|
||||||
|
background-repeat: no-repeat !important;
|
||||||
|
background-position: center !important;
|
||||||
}
|
}
|
|
@ -262,11 +262,11 @@ jQuery(document).ready(function($) {
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Tabs */
|
/* Tabs */
|
||||||
$('div.woocommerce_tabs .panel').hide();
|
$('.woocommerce_tabs .panel').hide();
|
||||||
$('div.woocommerce_tabs ul.tabs li a').click(function(){
|
$('.woocommerce_tabs ul.tabs li a').click(function(){
|
||||||
|
|
||||||
var $tab = $(this);
|
var $tab = $(this);
|
||||||
var $tabs_wrapper = $tab.closest('div.woocommerce_tabs');
|
var $tabs_wrapper = $tab.closest('.woocommerce_tabs');
|
||||||
|
|
||||||
$('ul.tabs li', $tabs_wrapper).removeClass('active');
|
$('ul.tabs li', $tabs_wrapper).removeClass('active');
|
||||||
$('div.panel', $tabs_wrapper).hide();
|
$('div.panel', $tabs_wrapper).hide();
|
||||||
|
@ -275,7 +275,7 @@ jQuery(document).ready(function($) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
$('div.woocommerce_tabs').each(function() {
|
$('.woocommerce_tabs').each(function() {
|
||||||
var hash = window.location.hash;
|
var hash = window.location.hash;
|
||||||
if (hash.toLowerCase().indexOf("comment-") >= 0) {
|
if (hash.toLowerCase().indexOf("comment-") >= 0) {
|
||||||
$('ul.tabs li.reviews_tab a', $(this)).click();
|
$('ul.tabs li.reviews_tab a', $(this)).click();
|
||||||
|
@ -425,8 +425,6 @@ jQuery(document).ready(function($) {
|
||||||
$('.single_variation_wrap').find('input[name=quantity]').removeAttr('data-max');
|
$('.single_variation_wrap').find('input[name=quantity]').removeAttr('data-max');
|
||||||
}
|
}
|
||||||
|
|
||||||
alert(variation.is_sold_individually);
|
|
||||||
|
|
||||||
if ( variation.is_sold_individually == 'yes' ) {
|
if ( variation.is_sold_individually == 'yes' ) {
|
||||||
$('.single_variation_wrap').find('input[name=quantity]').val('1');
|
$('.single_variation_wrap').find('input[name=quantity]').val('1');
|
||||||
$('.single_variation_wrap').find('.quantity').hide();
|
$('.single_variation_wrap').find('.quantity').hide();
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -121,7 +121,7 @@ class WC_Email {
|
||||||
|
|
||||||
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
||||||
|
|
||||||
$subject = apply_filters( 'woocommerce_email_subject_new_order', sprintf( __( '[%s] New Customer Order (# %s)', 'woocommerce' ), $blogname, $order_id ), $order );
|
$subject = apply_filters( 'woocommerce_email_subject_new_order', sprintf( __( '[%s] New Customer Order (%s)', 'woocommerce' ), $blogname, $order->get_order_number() ), $order );
|
||||||
|
|
||||||
// Buffer
|
// Buffer
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
|
@ -404,6 +404,9 @@ class WC_Product {
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function get_stock_quantity() {
|
function get_stock_quantity() {
|
||||||
|
if ( get_option( 'woocommerce_manage_stock' ) == 'no' )
|
||||||
|
return '';
|
||||||
|
|
||||||
return (int) $this->stock;
|
return (int) $this->stock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -692,7 +695,7 @@ class WC_Product {
|
||||||
endif;
|
endif;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
return $price;
|
return apply_filters('woocommerce_get_price_html', $price, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Functions for getting parts of a price, in html, used by get_price_html */
|
/** Functions for getting parts of a price, in html, used by get_price_html */
|
||||||
|
|
|
@ -54,14 +54,10 @@ class WC_Query {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
( ! $query ) // Abort if theres no query
|
( ! $query ) // Abort if theres no query
|
||||||
||
|
|| ( empty( $this->post__in ) ) // Abort if we're not filtering posts
|
||||||
( empty( $this->post__in ) ) // Abort if we're not filtering posts
|
|| ( ! empty( $query->wc_query ) ) // Abort if this query is already done
|
||||||
||
|
|| ( empty( $query->query_vars["s"] ) ) // Abort if this isn't a search query
|
||||||
( ! empty( $query->wc_query ) ) // Abort if this query is already done
|
|| ( ! $query->is_post_type_archive( 'product' ) && ! $query->is_tax( array_merge( array('product_cat', 'product_tag'), $woocommerce->get_attribute_taxonomy_names() ) ) ) // Abort if we're not on a post type archive/prduct taxonomy
|
||||||
||
|
|
||||||
( empty( $query->query_vars["s"] ) ) // Abort if this isn't a search query
|
|
||||||
||
|
|
||||||
( ! $query->is_post_type_archive( 'product' ) && ! $query->is_tax( array_merge( array('product_cat', 'product_tag'), $woocommerce->get_attribute_taxonomy_names() ) ) ) // Abort if we're not on a post type archive/prduct taxonomy
|
|
||||||
)
|
)
|
||||||
return $posts;
|
return $posts;
|
||||||
|
|
||||||
|
@ -110,13 +106,15 @@ class WC_Query {
|
||||||
// Ordering query vars
|
// Ordering query vars
|
||||||
$q->set( 'orderby', $ordering['orderby'] );
|
$q->set( 'orderby', $ordering['orderby'] );
|
||||||
$q->set( 'order', $ordering['order'] );
|
$q->set( 'order', $ordering['order'] );
|
||||||
if (isset($ordering['meta_key'])) $q->set( 'meta_key', $ordering['meta_key'] );
|
if ( isset( $ordering['meta_key'] ) )
|
||||||
|
$q->set( 'meta_key', $ordering['meta_key'] );
|
||||||
|
|
||||||
// Query vars that affect posts shown
|
// Query vars that affect posts shown
|
||||||
if (!$q->is_tax( 'product_cat' ) && !$q->is_tax( 'product_tag' )) $q->set( 'post_type', 'product' );
|
if ( ! $q->is_tax( 'product_cat' ) && ! $q->is_tax( 'product_tag' ) )
|
||||||
|
$q->set( 'post_type', 'product' );
|
||||||
$q->set( 'meta_query', $meta_query );
|
$q->set( 'meta_query', $meta_query );
|
||||||
$q->set( 'post__in', $post__in );
|
$q->set( 'post__in', $post__in );
|
||||||
$q->set( 'posts_per_page', ($q->get('posts_per_page')) ? $q->get('posts_per_page') : apply_filters('loop_shop_per_page', get_option('posts_per_page') ) );
|
$q->set( 'posts_per_page', $q->get('posts_per_page') ? $q->get('posts_per_page') : apply_filters('loop_shop_per_page', get_option('posts_per_page') ) );
|
||||||
|
|
||||||
// Set a special variable
|
// Set a special variable
|
||||||
$q->set( 'wc_query', true );
|
$q->set( 'wc_query', true );
|
||||||
|
@ -143,14 +141,14 @@ class WC_Query {
|
||||||
|
|
||||||
// Get WP Query for current page (without 'paged')
|
// Get WP Query for current page (without 'paged')
|
||||||
$current_wp_query = $wp_query->query;
|
$current_wp_query = $wp_query->query;
|
||||||
unset($current_wp_query['paged']);
|
unset( $current_wp_query['paged'] );
|
||||||
|
|
||||||
// Generate a transient name based on current query
|
// Generate a transient name based on current query
|
||||||
$transient_name = 'wc_uf_pid_' . md5( http_build_query($current_wp_query) );
|
$transient_name = 'wc_uf_pid_' . md5( http_build_query($current_wp_query) );
|
||||||
$transient_name = (is_search()) ? $transient_name . '_s' : $transient_name;
|
$transient_name = ( is_search() ) ? $transient_name . '_s' : $transient_name;
|
||||||
|
|
||||||
if ( false === ( $unfiltered_product_ids = get_transient( $transient_name ) ) ) {
|
if ( false === ( $unfiltered_product_ids = get_transient( $transient_name ) ) ) {
|
||||||
|
|
||||||
// Get all visible posts, regardless of filters
|
// Get all visible posts, regardless of filters
|
||||||
$unfiltered_product_ids = get_posts(
|
$unfiltered_product_ids = get_posts(
|
||||||
array_merge(
|
array_merge(
|
||||||
|
@ -255,33 +253,5 @@ class WC_Query {
|
||||||
endif;
|
endif;
|
||||||
return $meta_query;
|
return $meta_query;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a list of product id's which should be hidden from the frontend; useful for custom queries and loops. Makes use of transients.
|
|
||||||
*/
|
|
||||||
function get_hidden_product_ids() {
|
|
||||||
|
|
||||||
$transient_name = (is_search()) ? 'wc_hidden_product_ids_search' : 'wc_hidden_product_ids';
|
|
||||||
|
|
||||||
if ( false === ( $hidden_product_ids = get_transient( $transient_name ) ) ) {
|
|
||||||
|
|
||||||
$meta_query = array();
|
|
||||||
$meta_query[] = $this->visibility_meta_query( 'NOT IN' );
|
|
||||||
$meta_query[] = $this->stock_status_meta_query( 'outofstock' );
|
|
||||||
|
|
||||||
$hidden_product_ids = get_posts(array(
|
|
||||||
'post_type' => 'product',
|
|
||||||
'numberposts' => -1,
|
|
||||||
'post_status' => 'publish',
|
|
||||||
'meta_query' => $meta_query,
|
|
||||||
'fields' => 'ids',
|
|
||||||
'no_found_rows' => true
|
|
||||||
));
|
|
||||||
|
|
||||||
set_transient( $transient_name, $hidden_product_ids );
|
|
||||||
}
|
|
||||||
|
|
||||||
return (array) $hidden_product_ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -68,7 +68,7 @@ class WC_Payment_Gateways {
|
||||||
|
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
return $_available_gateways;
|
return apply_filters( 'woocommerce_available_payment_gateways', $_available_gateways );
|
||||||
}
|
}
|
||||||
|
|
||||||
function process_admin_options() {
|
function process_admin_options() {
|
||||||
|
|
|
@ -172,8 +172,10 @@ class WC_Google_Analytics extends WC_Integration {
|
||||||
} else {
|
} else {
|
||||||
$out = array();
|
$out = array();
|
||||||
$categories = get_the_terms($_product->id, 'product_cat');
|
$categories = get_the_terms($_product->id, 'product_cat');
|
||||||
foreach ( $categories as $category ){
|
if ( $categories ) {
|
||||||
$out[] = $category->name;
|
foreach ( $categories as $category ){
|
||||||
|
$out[] = $category->name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
echo join( "/", $out);
|
echo join( "/", $out);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ class WC_ShareThis extends WC_Integration {
|
||||||
|
|
||||||
$this->default_code = '<div class="social">
|
$this->default_code = '<div class="social">
|
||||||
<iframe src="https://www.facebook.com/plugins/like.php?href={permalink}&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
|
<iframe src="https://www.facebook.com/plugins/like.php?href={permalink}&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
|
||||||
<span class="st_twitter"></span><span class="st_email"></span><span class="st_sharethis"></span><span class="st_plusone_button"></span>
|
<span class="st_twitter"></span><span class="st_email"></span><span class="st_sharethis" st_image="{image}"></span><span class="st_plusone_button"></span>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
// Load the form fields.
|
// Load the form fields.
|
||||||
|
@ -33,7 +33,7 @@ class WC_ShareThis extends WC_Integration {
|
||||||
$this->publisher_id = $this->settings['publisher_id'];
|
$this->publisher_id = $this->settings['publisher_id'];
|
||||||
$this->sharethis_code = $this->settings['sharethis_code'];
|
$this->sharethis_code = $this->settings['sharethis_code'];
|
||||||
|
|
||||||
if ( ! $this->sharethis_code ) $this->sharethis_code = $this->default_code;
|
if ( ! $this->sharethis_code ) $this->settings['sharethis_code'] = $this->sharethis_code = $this->default_code;
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
add_action( 'woocommerce_update_options_integration_sharethis', array( &$this, 'process_admin_options') );
|
add_action( 'woocommerce_update_options_integration_sharethis', array( &$this, 'process_admin_options') );
|
||||||
|
@ -73,10 +73,15 @@ class WC_ShareThis extends WC_Integration {
|
||||||
global $post;
|
global $post;
|
||||||
|
|
||||||
if ( $this->publisher_id ) {
|
if ( $this->publisher_id ) {
|
||||||
|
|
||||||
|
$thumbnail = ( $thumbnail_id = get_post_thumbnail_id( $post->ID ) ) ? current(wp_get_attachment_image_src( $thumbnail_id, 'large' )) : '';
|
||||||
|
|
||||||
$sharethis = ( is_ssl() ) ? 'https://ws.sharethis.com/button/buttons.js' : 'http://w.sharethis.com/button/buttons.js';
|
$sharethis = ( is_ssl() ) ? 'https://ws.sharethis.com/button/buttons.js' : 'http://w.sharethis.com/button/buttons.js';
|
||||||
|
|
||||||
echo str_replace( '{permalink}', urlencode(get_permalink($post->ID)), $this->sharethis_code );
|
$sharethis_code = str_replace( '{permalink}', urlencode( get_permalink( $post->ID ) ), $this->sharethis_code );
|
||||||
|
if ( isset( $thumbnail ) ) $sharethis_code = str_replace( '{image}', urlencode( $thumbnail ), $sharethis_code );
|
||||||
|
|
||||||
|
echo $sharethis_code;
|
||||||
|
|
||||||
echo '<script type="text/javascript">var switchTo5x=true;</script><script type="text/javascript" src="' . $sharethis . '"></script>';
|
echo '<script type="text/javascript">var switchTo5x=true;</script><script type="text/javascript" src="' . $sharethis . '"></script>';
|
||||||
echo '<script type="text/javascript">stLight.options({publisher:"' . $this->publisher_id . '"});</script>';
|
echo '<script type="text/javascript">stLight.options({publisher:"' . $this->publisher_id . '"});</script>';
|
||||||
|
|
|
@ -10,23 +10,21 @@
|
||||||
* @author WooThemes
|
* @author WooThemes
|
||||||
*/
|
*/
|
||||||
class WC_Flat_Rate extends WC_Shipping_Method {
|
class WC_Flat_Rate extends WC_Shipping_Method {
|
||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
$this->id = 'flat_rate';
|
$this->id = 'flat_rate';
|
||||||
$this->method_title = __('Flat rate', 'woocommerce');
|
$this->method_title = __( 'Flat rate', 'woocommerce' );
|
||||||
|
|
||||||
$this->flat_rate_option = 'woocommerce_flat_rates';
|
$this->flat_rate_option = 'woocommerce_flat_rates';
|
||||||
$this->admin_page_heading = __('Flat Rates', 'woocommerce');
|
$this->admin_page_heading = __( 'Flat Rates', 'woocommerce' );
|
||||||
$this->admin_page_description = __('Flat rates let you define a standard rate per item, or per order.', 'woocommerce');
|
$this->admin_page_description = __( 'Flat rates let you define a standard rate per item, or per order.', 'woocommerce' );
|
||||||
|
|
||||||
add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_admin_options'));
|
add_action( 'woocommerce_update_options_shipping_' . $this->id, array( &$this, 'process_admin_options' ) );
|
||||||
add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_flat_rates'));
|
add_action( 'woocommerce_update_options_shipping_' . $this->id, array( &$this, 'process_flat_rates' ) );
|
||||||
|
|
||||||
$this->init();
|
$this->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
|
||||||
// Load the form fields.
|
// Load the form fields.
|
||||||
$this->init_form_fields();
|
$this->init_form_fields();
|
||||||
|
|
||||||
|
@ -34,19 +32,20 @@ class WC_Flat_Rate extends WC_Shipping_Method {
|
||||||
$this->init_settings();
|
$this->init_settings();
|
||||||
|
|
||||||
// Define user set variables
|
// Define user set variables
|
||||||
$this->enabled = $this->settings['enabled'];
|
$this->enabled = $this->settings['enabled'];
|
||||||
$this->title = $this->settings['title'];
|
$this->title = $this->settings['title'];
|
||||||
$this->availability = $this->settings['availability'];
|
$this->availability = $this->settings['availability'];
|
||||||
$this->countries = $this->settings['countries'];
|
$this->countries = $this->settings['countries'];
|
||||||
$this->type = $this->settings['type'];
|
$this->type = $this->settings['type'];
|
||||||
$this->tax_status = $this->settings['tax_status'];
|
$this->tax_status = $this->settings['tax_status'];
|
||||||
$this->cost = $this->settings['cost'];
|
$this->cost = $this->settings['cost'];
|
||||||
$this->fee = $this->settings['fee'];
|
$this->cost_per_order = isset( $this->settings['cost_per_order'] ) ? $this->settings['cost_per_order'] : '';
|
||||||
$this->minimum_fee = isset($this->settings['minimum_fee']) ? $this->settings['minimum_fee'] : '';
|
$this->fee = $this->settings['fee'];
|
||||||
$this->options = isset($this->settings['options']) ? $this->settings['options'] : '';
|
$this->minimum_fee = isset( $this->settings['minimum_fee'] ) ? $this->settings['minimum_fee'] : '';
|
||||||
|
$this->options = isset( $this->settings['options'] ) ? $this->settings['options'] : '';
|
||||||
|
|
||||||
// Get options
|
// Get options
|
||||||
$this->options = (array) explode("\n", $this->options);
|
$this->options = (array) explode( "\n", $this->options );
|
||||||
|
|
||||||
// Load Flat rates
|
// Load Flat rates
|
||||||
$this->get_flat_rates();
|
$this->get_flat_rates();
|
||||||
|
@ -63,13 +62,19 @@ class WC_Flat_Rate extends WC_Shipping_Method {
|
||||||
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'label' => __( 'Enable this shipping method', 'woocommerce' ),
|
'label' => __( 'Enable this shipping method', 'woocommerce' ),
|
||||||
'default' => 'no'
|
'default' => 'no',
|
||||||
),
|
),
|
||||||
'title' => array(
|
'title' => array(
|
||||||
'title' => __( 'Method Title', 'woocommerce' ),
|
'title' => __( 'Method Title', 'woocommerce' ),
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
|
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
|
||||||
'default' => __( 'Flat Rate', 'woocommerce' )
|
'default' => __( 'Flat Rate', 'woocommerce' ),
|
||||||
|
),
|
||||||
|
'cost_per_order' => array(
|
||||||
|
'title' => __( 'Cost per order', 'woocommerce' ),
|
||||||
|
'type' => 'text',
|
||||||
|
'description' => __( 'Enter a cost per order, e.g. 5.00. Leave blank to disable.', 'woocommerce' ),
|
||||||
|
'default' => '',
|
||||||
),
|
),
|
||||||
'availability' => array(
|
'availability' => array(
|
||||||
'title' => __( 'Method availability', 'woocommerce' ),
|
'title' => __( 'Method availability', 'woocommerce' ),
|
||||||
|
@ -77,9 +82,9 @@ class WC_Flat_Rate extends WC_Shipping_Method {
|
||||||
'default' => 'all',
|
'default' => 'all',
|
||||||
'class' => 'availability',
|
'class' => 'availability',
|
||||||
'options' => array(
|
'options' => array(
|
||||||
'all' => __('All allowed countries', 'woocommerce'),
|
'all' => __( 'All allowed countries', 'woocommerce' ),
|
||||||
'specific' => __('Specific Countries', 'woocommerce')
|
'specific' => __( 'Specific Countries', 'woocommerce' ),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
'countries' => array(
|
'countries' => array(
|
||||||
'title' => __( 'Specific Countries', 'woocommerce' ),
|
'title' => __( 'Specific Countries', 'woocommerce' ),
|
||||||
|
@ -87,7 +92,7 @@ class WC_Flat_Rate extends WC_Shipping_Method {
|
||||||
'class' => 'chosen_select',
|
'class' => 'chosen_select',
|
||||||
'css' => 'width: 450px;',
|
'css' => 'width: 450px;',
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'options' => $woocommerce->countries->countries
|
'options' => $woocommerce->countries->countries,
|
||||||
),
|
),
|
||||||
'type' => array(
|
'type' => array(
|
||||||
'title' => __( 'Calculation Type', 'woocommerce' ),
|
'title' => __( 'Calculation Type', 'woocommerce' ),
|
||||||
|
@ -95,10 +100,10 @@ class WC_Flat_Rate extends WC_Shipping_Method {
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'default' => 'order',
|
'default' => 'order',
|
||||||
'options' => array(
|
'options' => array(
|
||||||
'order' => __('Per Order - charge shipping for the entire order as a whole', 'woocommerce'),
|
'order' => __( 'Per Order - charge shipping for the entire order as a whole', 'woocommerce' ),
|
||||||
'item' => __('Per Item - charge shipping for each item individually', 'woocommerce'),
|
'item' => __( 'Per Item - charge shipping for each item individually', 'woocommerce' ),
|
||||||
'class' => __('Per Class - charge shipping for each shipping class in an order', 'woocommerce')
|
'class' => __( 'Per Class - charge shipping for each shipping class in an order', 'woocommerce' ),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
'tax_status' => array(
|
'tax_status' => array(
|
||||||
'title' => __( 'Tax Status', 'woocommerce' ),
|
'title' => __( 'Tax Status', 'woocommerce' ),
|
||||||
|
@ -106,33 +111,33 @@ class WC_Flat_Rate extends WC_Shipping_Method {
|
||||||
'description' => '',
|
'description' => '',
|
||||||
'default' => 'taxable',
|
'default' => 'taxable',
|
||||||
'options' => array(
|
'options' => array(
|
||||||
'taxable' => __('Taxable', 'woocommerce'),
|
'taxable' => __( 'Taxable', 'woocommerce' ),
|
||||||
'none' => __('None', 'woocommerce')
|
'none' => __( 'None', 'woocommerce' ),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
'cost' => array(
|
'cost' => array(
|
||||||
'title' => __( 'Default Cost', 'woocommerce' ),
|
'title' => __( 'Default Cost', 'woocommerce' ),
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'description' => __('Cost excluding tax. Enter an amount, e.g. 2.50.', 'woocommerce'),
|
'description' => __( 'Cost excluding tax. Enter an amount, e.g. 2.50.', 'woocommerce' ),
|
||||||
'default' => ''
|
'default' => '',
|
||||||
),
|
),
|
||||||
'fee' => array(
|
'fee' => array(
|
||||||
'title' => __( 'Default Handling Fee', 'woocommerce' ),
|
'title' => __( 'Default Handling Fee', 'woocommerce' ),
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'description' => __('Fee excluding tax. Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to disable.', 'woocommerce'),
|
'description' => __( 'Fee excluding tax. Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to disable.', 'woocommerce' ),
|
||||||
'default' => ''
|
'default' => '',
|
||||||
),
|
),
|
||||||
'minimum_fee' => array(
|
'minimum_fee' => array(
|
||||||
'title' => __( 'Minimum Fee', 'woocommerce' ),
|
'title' => __( 'Minimum Fee', 'woocommerce' ),
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'description' => __('Enter a minimum fee amount. Fee\'s less than this will be increased. Leave blank to disable.', 'woocommerce'),
|
'description' => __( 'Enter a minimum fee amount. Fee\'s less than this will be increased. Leave blank to disable.', 'woocommerce' ),
|
||||||
'default' => ''
|
'default' => '',
|
||||||
),
|
),
|
||||||
'options' => array(
|
'options' => array(
|
||||||
'title' => __( 'Shipping Options', 'woocommerce' ),
|
'title' => __( 'Shipping Options', 'woocommerce' ),
|
||||||
'type' => 'textarea',
|
'type' => 'textarea',
|
||||||
'description' => __('Optional extra shipping options with additional costs (one per line). Example: <code>Option Name|Cost|Per-order (yes or no)</code>. Example: <code>Priority Mail|6.95|yes</code>. If per-order is set to no, it will use the "Calculation Type" setting.', 'woocommerce'),
|
'description' => __( 'Optional extra shipping options with additional costs (one per line). Example: <code>Option Name|Cost|Per-order (yes or no)</code>. Example: <code>Priority Mail|6.95|yes</code>. If per-order is set to no, it will use the "Calculation Type" setting.', 'woocommerce' ),
|
||||||
'default' => ''
|
'default' => '',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -142,63 +147,58 @@ class WC_Flat_Rate extends WC_Shipping_Method {
|
||||||
global $woocommerce;
|
global $woocommerce;
|
||||||
|
|
||||||
$this->rates = array();
|
$this->rates = array();
|
||||||
|
$cost_per_order = ( isset( $this->cost_per_order ) && ! empty( $this->cost_per_order ) ) ? $this->cost_per_order : 0;
|
||||||
|
|
||||||
if ( $this->type == 'order' ) {
|
if ( $this->type == 'order' ) {
|
||||||
|
|
||||||
$shipping_total = $this->order_shipping( $package );
|
$shipping_total = $this->order_shipping( $package );
|
||||||
|
|
||||||
$rate = array(
|
$rate = array(
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'label' => $this->title,
|
'label' => $this->title,
|
||||||
'cost' => $shipping_total
|
'cost' => $shipping_total + $cost_per_order,
|
||||||
);
|
);
|
||||||
|
|
||||||
} elseif ( $this->type == 'class' ) {
|
} elseif ( $this->type == 'class' ) {
|
||||||
|
|
||||||
$shipping_total = $this->class_shipping( $package );
|
$shipping_total = $this->class_shipping( $package );
|
||||||
|
|
||||||
$rate = array(
|
$rate = array(
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'label' => $this->title,
|
'label' => $this->title,
|
||||||
'cost' => $shipping_total
|
'cost' => $shipping_total + $cost_per_order,
|
||||||
);
|
);
|
||||||
|
|
||||||
} elseif ( $this->type == 'item' ) {
|
} elseif ( $this->type == 'item' ) {
|
||||||
|
|
||||||
$costs = $this->item_shipping( $package );
|
$costs = $this->item_shipping( $package );
|
||||||
|
$costs['order'] = $cost_per_order;
|
||||||
|
|
||||||
$rate = array(
|
$rate = array(
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'label' => $this->title,
|
'label' => $this->title,
|
||||||
'cost' => $costs,
|
'cost' => $costs,
|
||||||
'calc_tax' => 'per_item'
|
'calc_tax' => 'per_item',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register the rate
|
// Register the rate
|
||||||
$this->add_rate( $rate );
|
$this->add_rate( $rate );
|
||||||
|
|
||||||
// Add any extra rates
|
// Add any extra rates
|
||||||
if ( sizeof( $this->options ) > 0) foreach ( $this->options as $option ) {
|
if ( sizeof( $this->options ) > 0) foreach ( $this->options as $option ) {
|
||||||
|
|
||||||
$this_option = preg_split( '~\s*\|\s*~', trim( $option ) );
|
$this_option = preg_split( '~\s*\|\s*~', trim( $option ) );
|
||||||
|
|
||||||
if (sizeof($this_option)!==3) continue;
|
if ( sizeof( $this_option ) !== 3 ) continue;
|
||||||
|
|
||||||
$extra_rate = $rate;
|
$extra_rate = $rate;
|
||||||
|
|
||||||
$extra_rate['id'] = $this->id . ':' . sanitize_title($this_option[0]);
|
$extra_rate['id'] = $this->id . ':' . sanitize_title($this_option[0]);
|
||||||
$extra_rate['label'] = $this_option[0];
|
$extra_rate['label'] = $this_option[0];
|
||||||
|
|
||||||
$per_order_cost = ($this_option[2]=='yes') ? 1 : 0;
|
$per_order_cost = ( $this_option[2] == 'yes' ) ? 1 : 0;
|
||||||
$this_cost = $this_option[1];
|
$this_cost = $this_option[1];
|
||||||
|
|
||||||
if (is_array($extra_rate['cost'])) {
|
if ( is_array( $extra_rate['cost'] ) ) {
|
||||||
|
if ( $per_order_cost ) {
|
||||||
if ($per_order_cost) {
|
|
||||||
$extra_rate['cost']['order'] = $this_cost;
|
$extra_rate['cost']['order'] = $this_cost;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$total_quantity = 0;
|
$total_quantity = 0;
|
||||||
|
|
||||||
// Shipping per item
|
// Shipping per item
|
||||||
|
@ -209,19 +209,16 @@ class WC_Flat_Rate extends WC_Shipping_Method {
|
||||||
// Per-product shipping
|
// Per-product shipping
|
||||||
$extra_rate['cost']['order'] = $this_cost * $total_quantity;
|
$extra_rate['cost']['order'] = $this_cost * $total_quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// If using shipping per class, multiple the cost by the classes we found
|
// If using shipping per class, multiple the cost by the classes we found
|
||||||
if (!$per_order_cost && $this->type=='class') {
|
if ( ! $per_order_cost && $this->type == 'class' ) {
|
||||||
$this_cost = $this_cost * $found_shipping_classes;
|
$this_cost = $this_cost * $found_shipping_classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
$extra_rate['cost'] = $extra_rate['cost'] + $this_cost;
|
$extra_rate['cost'] = $extra_rate['cost'] + $this_cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->add_rate( $extra_rate );
|
$this->add_rate( $extra_rate );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,14 +242,14 @@ class WC_Flat_Rate extends WC_Shipping_Method {
|
||||||
|
|
||||||
// Find most expensive class (if found)
|
// Find most expensive class (if found)
|
||||||
foreach ( $found_shipping_classes as $shipping_class ) {
|
foreach ( $found_shipping_classes as $shipping_class ) {
|
||||||
if (isset($this->flat_rates[$shipping_class])) {
|
if ( isset( $this->flat_rates[ $shipping_class ] ) ) {
|
||||||
if ($this->flat_rates[$shipping_class]['cost'] > $cost) {
|
if ( $this->flat_rates[ $shipping_class ]['cost'] > $cost ) {
|
||||||
$cost = $this->flat_rates[$shipping_class]['cost'];
|
$cost = $this->flat_rates[ $shipping_class ]['cost'];
|
||||||
$fee = $this->flat_rates[$shipping_class]['fee'];
|
$fee = $this->flat_rates[ $shipping_class ]['fee'];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No matching classes so use defaults
|
// No matching classes so use defaults
|
||||||
if ($this->cost > $cost) {
|
if ( $this->cost > $cost ) {
|
||||||
$cost = $this->cost;
|
$cost = $this->cost;
|
||||||
$fee = $this->fee;
|
$fee = $this->fee;
|
||||||
}
|
}
|
||||||
|
@ -276,36 +273,34 @@ class WC_Flat_Rate extends WC_Shipping_Method {
|
||||||
$fee = null;
|
$fee = null;
|
||||||
|
|
||||||
if ( sizeof( $this->flat_rates ) > 0 ) {
|
if ( sizeof( $this->flat_rates ) > 0 ) {
|
||||||
|
|
||||||
$found_shipping_classes = array();
|
$found_shipping_classes = array();
|
||||||
|
|
||||||
// Find shipping classes for products in the cart. Store prices too, so we can calc a fee for the class.
|
// Find shipping classes for products in the cart. Store prices too, so we can calc a fee for the class.
|
||||||
if ( sizeof( $package['contents'] ) > 0 ) {
|
if ( sizeof( $package['contents'] ) > 0 ) {
|
||||||
foreach ( $package['contents'] as $item_id => $values ) {
|
foreach ( $package['contents'] as $item_id => $values ) {
|
||||||
if ( $values['data']->needs_shipping() ) :
|
if ( $values['data']->needs_shipping() ) {
|
||||||
if ( isset( $found_shipping_classes[$values['data']->get_shipping_class()] ) ) {
|
if ( isset( $found_shipping_classes[ $values['data']->get_shipping_class() ] ) ) {
|
||||||
$found_shipping_classes[$values['data']->get_shipping_class()] = ($values['data']->get_price() * $values['quantity']) + $found_shipping_classes[$values['data']->get_shipping_class()];
|
$found_shipping_classes[ $values['data']->get_shipping_class() ] = ( $values['data']->get_price() * $values['quantity'] ) + $found_shipping_classes[ $values['data']->get_shipping_class() ];
|
||||||
} else {
|
} else {
|
||||||
$found_shipping_classes[$values['data']->get_shipping_class()] = ($values['data']->get_price() * $values['quantity']);
|
$found_shipping_classes[ $values['data']->get_shipping_class() ] = ( $values['data']->get_price() * $values['quantity'] );
|
||||||
}
|
}
|
||||||
endif;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$found_shipping_classes = array_unique($found_shipping_classes);
|
$found_shipping_classes = array_unique( $found_shipping_classes );
|
||||||
|
|
||||||
// For each found class, add up the costs and fees
|
// For each found class, add up the costs and fees
|
||||||
foreach ($found_shipping_classes as $shipping_class => $class_price) :
|
foreach ( $found_shipping_classes as $shipping_class => $class_price ) {
|
||||||
if (isset($this->flat_rates[$shipping_class])) :
|
if ( isset( $this->flat_rates[ $shipping_class ] ) ) {
|
||||||
$cost += $this->flat_rates[$shipping_class]['cost'];
|
$cost += $this->flat_rates[ $shipping_class ]['cost'];
|
||||||
$fee += $this->get_fee( $this->flat_rates[$shipping_class]['fee'], $class_price );
|
$fee += $this->get_fee( $this->flat_rates[ $shipping_class ]['fee'], $class_price );
|
||||||
else :
|
} else {
|
||||||
// Class not set so we use default rate
|
// Class not set so we use default rate
|
||||||
$cost += $this->cost;
|
$cost += $this->cost;
|
||||||
$fee += $this->get_fee( $this->fee, $class_price );
|
$fee += $this->get_fee( $this->fee, $class_price );
|
||||||
endif;
|
}
|
||||||
endforeach;
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total
|
// Total
|
||||||
|
@ -318,22 +313,20 @@ class WC_Flat_Rate extends WC_Shipping_Method {
|
||||||
|
|
||||||
// Shipping per item
|
// Shipping per item
|
||||||
foreach ( $package['contents'] as $item_id => $values ) {
|
foreach ( $package['contents'] as $item_id => $values ) {
|
||||||
|
|
||||||
$_product = $values['data'];
|
$_product = $values['data'];
|
||||||
|
|
||||||
if ( $values['quantity'] > 0 && $_product->needs_shipping() ) {
|
if ( $values['quantity'] > 0 && $_product->needs_shipping() ) {
|
||||||
|
|
||||||
$shipping_class = $_product->get_shipping_class();
|
$shipping_class = $_product->get_shipping_class();
|
||||||
|
|
||||||
if ( isset( $this->flat_rates[$shipping_class] ) ) {
|
if ( isset( $this->flat_rates[ $shipping_class ] ) ) {
|
||||||
$cost = $this->flat_rates[$shipping_class]['cost'];
|
$cost = $this->flat_rates[ $shipping_class ]['cost'];
|
||||||
$fee = $this->get_fee( $this->flat_rates[$shipping_class]['fee'], $_product->get_price() );
|
$fee = $this->get_fee( $this->flat_rates[ $shipping_class ]['fee'], $_product->get_price() );
|
||||||
} else {
|
} else {
|
||||||
$cost = $this->cost;
|
$cost = $this->cost;
|
||||||
$fee = $this->get_fee( $this->fee, $_product->get_price() );
|
$fee = $this->get_fee( $this->fee, $_product->get_price() );
|
||||||
}
|
}
|
||||||
|
|
||||||
$costs[$item_id] = ( ( $cost + $fee ) * $values['quantity'] );
|
$costs[ $item_id ] = ( ( $cost + $fee ) * $values['quantity'] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,46 +350,50 @@ class WC_Flat_Rate extends WC_Shipping_Method {
|
||||||
$this->generate_settings_html();
|
$this->generate_settings_html();
|
||||||
?>
|
?>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<th scope="row" class="titledesc"><?php _e('Flat Rates', 'woocommerce'); ?>:</th>
|
<th scope="row" class="titledesc"><?php _e( 'Flat Rates', 'woocommerce' ); ?>:</th>
|
||||||
<td class="forminp" id="<?php echo $this->id; ?>_flat_rates">
|
<td class="forminp" id="<?php echo $this->id; ?>_flat_rates">
|
||||||
<table class="shippingrows widefat" cellspacing="0">
|
<table class="shippingrows widefat" cellspacing="0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="check-column"><input type="checkbox"></th>
|
<th class="check-column"><input type="checkbox"></th>
|
||||||
<th class="shipping_class"><?php _e('Shipping Class', 'woocommerce'); ?></th>
|
<th class="shipping_class"><?php _e( 'Shipping Class', 'woocommerce' ); ?></th>
|
||||||
<th><?php _e('Cost', 'woocommerce'); ?> <a class="tips" data-tip="<?php _e('Cost, excluding tax.', 'woocommerce'); ?>">[?]</a></th>
|
<th><?php _e( 'Cost', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Cost, excluding tax.', 'woocommerce' ); ?>">[?]</a></th>
|
||||||
<th><?php _e('Handling Fee', 'woocommerce'); ?> <a class="tips" data-tip="<?php _e('Fee excluding tax. Enter an amount, e.g. 2.50, or a percentage, e.g. 5%.', 'woocommerce'); ?>">[?]</a></th>
|
<th><?php _e( 'Handling Fee', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Fee excluding tax. Enter an amount, e.g. 2.50, or a percentage, e.g. 5%.', 'woocommerce' ); ?>">[?]</a></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2"><a href="#" class="add button"><?php _e('+ Add Flat Rate', 'woocommerce'); ?></a></th>
|
<th colspan="2"><a href="#" class="add button"><?php _e( '+ Add Flat Rate', 'woocommerce' ); ?></a></th>
|
||||||
<th colspan="2"><small><?php _e('Add rates for shipping classes here — they will override the default costs defined above.', 'woocommerce'); ?></small> <a href="#" class="remove button"><?php _e('Delete selected rates', 'woocommerce'); ?></a></th>
|
<th colspan="2"><small><?php _e( 'Add rates for shipping classes here — they will override the default costs defined above.', 'woocommerce' ); ?></small> <a href="#" class="remove button"><?php _e( 'Delete selected rates', 'woocommerce' ); ?></a></th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
<tbody class="flat_rates">
|
<tbody class="flat_rates">
|
||||||
<?php
|
<?php
|
||||||
$i = -1; if ($this->flat_rates) foreach( $this->flat_rates as $class => $rate ) : $i++;
|
$i = -1;
|
||||||
|
if ( $this->flat_rates ) {
|
||||||
|
foreach ( $this->flat_rates as $class => $rate ) {
|
||||||
|
$i++;
|
||||||
|
|
||||||
echo '<tr class="flat_rate">
|
echo '<tr class="flat_rate">
|
||||||
<td class="check-column"><input type="checkbox" name="select" /></td>
|
<td class="check-column"><input type="checkbox" name="select" /></td>
|
||||||
<td class="flat_rate_class">
|
<td class="flat_rate_class">
|
||||||
<select name="'. $this->id .'_class['.$i.']" class="select">';
|
<select name="'. $this->id .'_class[' . $i . ']" class="select">';
|
||||||
|
|
||||||
if ($woocommerce->shipping->get_shipping_classes()) :
|
if ( $woocommerce->shipping->get_shipping_classes() ) {
|
||||||
foreach ($woocommerce->shipping->get_shipping_classes() as $shipping_class) :
|
foreach ( $woocommerce->shipping->get_shipping_classes() as $shipping_class ) {
|
||||||
echo '<option value="'.$shipping_class->slug.'" '.selected($shipping_class->slug, $class, false).'>'.$shipping_class->name.'</option>';
|
echo '<option value="'.$shipping_class->slug.'" '.selected($shipping_class->slug, $class, false).'>'.$shipping_class->name.'</option>';
|
||||||
endforeach;
|
}
|
||||||
else :
|
} else {
|
||||||
echo '<option value="">'.__('Select a class…', 'woocommerce').'</option>';
|
echo '<option value="">'.__('Select a class…', 'woocommerce').'</option>';
|
||||||
endif;
|
}
|
||||||
|
|
||||||
echo '</select>
|
echo '</select>
|
||||||
</td>
|
</td>
|
||||||
<td><input type="text" value="'.$rate['cost'].'" name="'. $this->id .'_cost['.$i.']" placeholder="'.__('0.00', 'woocommerce').'" size="4" /></td>
|
<td><input type="text" value="' . $rate['cost'] . '" name="'. $this->id .'_cost[' . $i . ']" placeholder="'.__( '0.00', 'woocommerce' ).'" size="4" /></td>
|
||||||
<td><input type="text" value="'.$rate['fee'].'" name="'. $this->id .'_fee['.$i.']" placeholder="'.__('0.00', 'woocommerce').'" size="4" /></td>
|
<td><input type="text" value="' . $rate['fee'] . '" name="'. $this->id .'_fee[' . $i . ']" placeholder="'.__( '0.00', 'woocommerce' ).'" size="4" /></td>
|
||||||
</tr>';
|
</tr>';
|
||||||
endforeach;
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -449,46 +446,42 @@ class WC_Flat_Rate extends WC_Shipping_Method {
|
||||||
} // End admin_options()
|
} // End admin_options()
|
||||||
|
|
||||||
function process_flat_rates() {
|
function process_flat_rates() {
|
||||||
|
|
||||||
// Save the rates
|
// Save the rates
|
||||||
$flat_rate_class = array();
|
$flat_rate_class = array();
|
||||||
$flat_rate_cost = array();
|
$flat_rate_cost = array();
|
||||||
$flat_rate_fee = array();
|
$flat_rate_fee = array();
|
||||||
$flat_rates = array();
|
$flat_rates = array();
|
||||||
|
|
||||||
if (isset($_POST[$this->id . '_class'])) $flat_rate_class = array_map('woocommerce_clean', $_POST[$this->id . '_class']);
|
if ( isset( $_POST[ $this->id . '_class'] ) ) $flat_rate_class = array_map( 'woocommerce_clean', $_POST[ $this->id . '_class'] );
|
||||||
if (isset($_POST[$this->id . '_cost'])) $flat_rate_cost = array_map('woocommerce_clean', $_POST[$this->id . '_cost']);
|
if ( isset( $_POST[ $this->id . '_cost'] ) ) $flat_rate_cost = array_map( 'woocommerce_clean', $_POST[ $this->id . '_cost'] );
|
||||||
if (isset($_POST[$this->id . '_fee'])) $flat_rate_fee = array_map('woocommerce_clean', $_POST[$this->id . '_fee']);
|
if ( isset( $_POST[ $this->id . '_fee'] ) ) $flat_rate_fee = array_map( 'woocommerce_clean', $_POST[ $this->id . '_fee'] );
|
||||||
|
|
||||||
// Get max key
|
// Get max key
|
||||||
$values = $flat_rate_class;
|
$values = $flat_rate_class;
|
||||||
ksort($values);
|
ksort( $values );
|
||||||
$value = end($values);
|
$value = end( $values );
|
||||||
$key = key($values);
|
$key = key( $values );
|
||||||
|
|
||||||
for ($i=0; $i<=$key; $i++) :
|
for ( $i = 0; $i <= $key; $i++ ) {
|
||||||
|
if ( isset( $flat_rate_class[ $i ] ) && isset( $flat_rate_cost[ $i ] ) && isset( $flat_rate_fee[ $i ] ) ) {
|
||||||
if (isset($flat_rate_class[$i]) && isset($flat_rate_cost[$i]) && isset($flat_rate_fee[$i])) :
|
|
||||||
|
|
||||||
$flat_rate_cost[$i] = number_format($flat_rate_cost[$i], 2, '.', '');
|
$flat_rate_cost[$i] = number_format($flat_rate_cost[$i], 2, '.', '');
|
||||||
|
|
||||||
// Add to flat rates array
|
// Add to flat rates array
|
||||||
$flat_rates[ sanitize_title($flat_rate_class[$i]) ] = array(
|
$flat_rates[ sanitize_title($flat_rate_class[$i]) ] = array(
|
||||||
'cost' => $flat_rate_cost[$i],
|
'cost' => $flat_rate_cost[ $i ],
|
||||||
'fee' => $flat_rate_fee[$i]
|
'fee' => $flat_rate_fee[ $i ],
|
||||||
);
|
);
|
||||||
|
}
|
||||||
endif;
|
}
|
||||||
|
|
||||||
endfor;
|
|
||||||
|
|
||||||
update_option($this->flat_rate_option, $flat_rates);
|
update_option( $this->flat_rate_option, $flat_rates );
|
||||||
|
|
||||||
$this->get_flat_rates();
|
$this->get_flat_rates();
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_flat_rates() {
|
function get_flat_rates() {
|
||||||
$this->flat_rates = array_filter((array) get_option($this->flat_rate_option));
|
$this->flat_rates = array_filter( (array) get_option( $this->flat_rate_option ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -497,4 +490,4 @@ function add_flat_rate_method( $methods ) {
|
||||||
$methods[] = 'WC_Flat_Rate'; return $methods;
|
$methods[] = 'WC_Flat_Rate'; return $methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter('woocommerce_shipping_methods', 'add_flat_rate_method' );
|
add_filter( 'woocommerce_shipping_methods', 'add_flat_rate_method' );
|
||||||
|
|
18
readme.txt
18
readme.txt
|
@ -1,10 +1,10 @@
|
||||||
=== WooCommerce – excelling eCommerce ===
|
=== WooCommerce - excelling eCommerce ===
|
||||||
Contributors: woothemes, mikejolley, jameskoster, CoenJacobs
|
Contributors: woothemes, mikejolley, jameskoster, CoenJacobs
|
||||||
Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, affiliate, store, sales, sell, shop, shopping, cart, checkout, configurable, variable, widgets, reports, download, downloadable, digital, inventory, stock, reports, shipping, tax
|
Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, affiliate, store, sales, sell, shop, shopping, cart, checkout, configurable, variable, widgets, reports, download, downloadable, digital, inventory, stock, reports, shipping, tax
|
||||||
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@woothemes.com&item_name=Donation+for+WooCommerce
|
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@woothemes.com&item_name=Donation+for+WooCommerce
|
||||||
Requires at least: 3.3
|
Requires at least: 3.3
|
||||||
Tested up to: 3.4
|
Tested up to: 3.4
|
||||||
Stable tag: 1.5.5
|
Stable tag: 1.5.6
|
||||||
|
|
||||||
WooCommerce is a powerful, extendable eCommerce plugin that helps you sell anything. Beautifully.
|
WooCommerce is a powerful, extendable eCommerce plugin that helps you sell anything. Beautifully.
|
||||||
|
|
||||||
|
@ -147,15 +147,27 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
= 1.5.6 =
|
==
|
||||||
|
|
||||||
|
* Fix - Strange error where detecting the page (is_page etc) would break the canonical redirect in some instances when hooked into 'wp'. Used the later get_header hook instead.
|
||||||
|
|
||||||
|
= 1.5.6 - 17/05/2012 =
|
||||||
* Feature - Default display for shipping methods is radio buttons. Before, when methods were enabled/disabled based on coupons or customer, changed methods could go unnoticed. Radio options are always visible.
|
* Feature - Default display for shipping methods is radio buttons. Before, when methods were enabled/disabled based on coupons or customer, changed methods could go unnoticed. Radio options are always visible.
|
||||||
* Feature - Option to display shipping methods as a select box vs. radio buttons
|
* Feature - Option to display shipping methods as a select box vs. radio buttons
|
||||||
|
* Feature - Added support for cost per order to Flat Rate shipping
|
||||||
|
* Feature - image support added to sharethis
|
||||||
* Tweak - When the count of available shipping methods changes, reset to default
|
* Tweak - When the count of available shipping methods changes, reset to default
|
||||||
* Tweak - Optimisations to monthly and product reports
|
* Tweak - Optimisations to monthly and product reports
|
||||||
* Tweak - Individually sold variation handling
|
* Tweak - Individually sold variation handling
|
||||||
* Tweak - Removed mdash; from shipping options
|
* Tweak - Removed mdash; from shipping options
|
||||||
|
* Tweak - Made woocommerce_locate_template more useful for third party plugins - ability to pass a full path
|
||||||
|
* Tweak - WC Debug page hooks
|
||||||
|
* Tweak - Tidied up installer
|
||||||
|
* Tweak - Removed unused get_hidden_product_ids
|
||||||
* Fix - Google Analytics options fix
|
* Fix - Google Analytics options fix
|
||||||
* Fix - % discount rounding
|
* Fix - % discount rounding
|
||||||
|
* Fix - get_stock_quantity returns '' if stock management is off in global settings
|
||||||
|
* Fix - Prevent error in ecommerce tracking if no categories set
|
||||||
|
|
||||||
= 1.5.5 - 10/05/2012 =
|
= 1.5.5 - 10/05/2012 =
|
||||||
* Feature - New 'default' sorting order using menu_order, with drag and drop sorting (based on http://wordpress.org/extend/plugins/simple-page-ordering/)
|
* Feature - New 'default' sorting order using menu_order, with drag and drop sorting (based on http://wordpress.org/extend/plugins/simple-page-ordering/)
|
||||||
|
|
|
@ -27,10 +27,10 @@ function woocommerce_order_tracking( $atts ) {
|
||||||
|
|
||||||
$woocommerce->verify_nonce( 'order_tracking' );
|
$woocommerce->verify_nonce( 'order_tracking' );
|
||||||
|
|
||||||
if (isset($_POST['orderid']) && $_POST['orderid'] > 0) $order_id = (int) $_POST['orderid']; else $order_id = 0;
|
if (isset($_POST['orderid']) && $_POST['orderid']) $order_id = $_POST['orderid']; else $order_id = 0;
|
||||||
if (isset($_POST['order_email']) && $_POST['order_email']) $order_email = trim($_POST['order_email']); else $order_email = '';
|
if (isset($_POST['order_email']) && $_POST['order_email']) $order_email = trim($_POST['order_email']); else $order_email = '';
|
||||||
|
|
||||||
$order = new WC_Order( $order_id );
|
$order = new WC_Order( apply_filters( 'woocommerce_shortcode_order_tracking_order_id', $order_id ) );
|
||||||
|
|
||||||
if ($order->id && $order_email) :
|
if ($order->id && $order_email) :
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,12 @@ class WooCommerce_Widget_Best_Sellers extends WP_Widget {
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( isset( $instance['hide_free'] ) && 1 == $instance['hide_free'] ) {
|
if ( isset( $instance['hide_free'] ) && 1 == $instance['hide_free'] ) {
|
||||||
$query_args['meta_query'] = array( array( 'key' => '_price', 'value' => 0, 'compare' => '>' ) );
|
$query_args['meta_query'] = array( array(
|
||||||
|
'key' => '_price',
|
||||||
|
'value' => 0,
|
||||||
|
'compare' => '>',
|
||||||
|
'type' => 'DECIMAL',
|
||||||
|
) );
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = new WP_Query($query_args);
|
$r = new WP_Query($query_args);
|
||||||
|
@ -125,7 +130,7 @@ class WooCommerce_Widget_Best_Sellers extends WP_Widget {
|
||||||
function form( $instance ) {
|
function form( $instance ) {
|
||||||
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
||||||
if ( !isset($instance['number']) || !$number = (int) $instance['number'] ) $number = 5;
|
if ( !isset($instance['number']) || !$number = (int) $instance['number'] ) $number = 5;
|
||||||
if ( isset( $instance['hide_free'] ) && 1 == $instance['hide_free'] ) $hide_free_checked = ' checked="checked"';
|
$hide_free_checked = ( isset( $instance['hide_free'] ) && 1 == $instance['hide_free'] ) ? ' checked="checked"' : '';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'woocommerce'); ?></label>
|
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'woocommerce'); ?></label>
|
||||||
|
|
|
@ -90,6 +90,7 @@ class WooCommerce_Widget_Featured_Products extends WP_Widget {
|
||||||
echo $content;
|
echo $content;
|
||||||
|
|
||||||
wp_cache_set('widget_featured_products', $cache, 'widget');
|
wp_cache_set('widget_featured_products', $cache, 'widget');
|
||||||
|
wp_reset_postdata();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @see WP_Widget->update */
|
/** @see WP_Widget->update */
|
||||||
|
|
|
@ -262,13 +262,13 @@ function woocommerce_get_template_part( $slug, $name = '' ) {
|
||||||
/**
|
/**
|
||||||
* Get other templates (e.g. product attributes) passing attributes and including the file
|
* Get other templates (e.g. product attributes) passing attributes and including the file
|
||||||
*/
|
*/
|
||||||
function woocommerce_get_template( $template_name, $args = array(), $template_path = '' ) {
|
function woocommerce_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
|
||||||
global $woocommerce;
|
global $woocommerce;
|
||||||
|
|
||||||
if ( $args && is_array($args) )
|
if ( $args && is_array($args) )
|
||||||
extract( $args );
|
extract( $args );
|
||||||
|
|
||||||
$located = woocommerce_locate_template( $template_name, $template_path );
|
$located = woocommerce_locate_template( $template_name, $template_path, $default_path );
|
||||||
|
|
||||||
do_action( 'woocommerce_before_template_part', $template_name, $template_path, $located );
|
do_action( 'woocommerce_before_template_part', $template_name, $template_path, $located );
|
||||||
|
|
||||||
|
@ -278,19 +278,33 @@ function woocommerce_get_template( $template_name, $args = array(), $template_pa
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locate a template and return the path for inclusion
|
* Locate a template and return the path for inclusion.
|
||||||
|
*
|
||||||
|
* This is the load order:
|
||||||
|
*
|
||||||
|
* yourtheme / $template_path / $template_name
|
||||||
|
* yourtheme / $template_name
|
||||||
|
* $default_path / $template_name
|
||||||
*/
|
*/
|
||||||
function woocommerce_locate_template( $template_name, $template_path = '' ) {
|
function woocommerce_locate_template( $template_name, $template_path = '', $default_path = '' ) {
|
||||||
global $woocommerce;
|
global $woocommerce;
|
||||||
|
|
||||||
$template = ( ! empty( $template_path ) ) ? locate_template( array( $template_path . $template_name , $template_name ) ) : '';
|
if ( ! $template_path ) $template_path = $woocommerce->template_url;
|
||||||
|
if ( ! $default_path ) $default_path = $woocommerce->plugin_path() . '/templates/';
|
||||||
// Look in yourtheme/woocommerce/template-name and yourtheme/template-name
|
|
||||||
if ( ! $template ) $template = locate_template( array( $woocommerce->template_url . $template_name , $template_name ) );
|
|
||||||
|
|
||||||
// Get default template
|
// Look within passed path within the theme - this is priority
|
||||||
if ( ! $template ) $template = $woocommerce->plugin_path() . '/templates/' . $template_name;
|
$template = locate_template(
|
||||||
|
array(
|
||||||
|
$template_path . $template_name,
|
||||||
|
$template_name
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Get default template
|
||||||
|
if ( ! $template )
|
||||||
|
$template = $default_path . $template_name;
|
||||||
|
|
||||||
|
// Return what we found
|
||||||
return apply_filters('woocommerce_locate_template', $template, $template_name, $template_path);
|
return apply_filters('woocommerce_locate_template', $template, $template_name, $template_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ if ( !is_admin() || defined('DOING_AJAX') ) {
|
||||||
/* Shop Page Handling and Support */
|
/* Shop Page Handling and Support */
|
||||||
add_action( 'template_redirect', 'woocommerce_redirects' );
|
add_action( 'template_redirect', 'woocommerce_redirects' );
|
||||||
add_filter( 'wp_nav_menu_objects', 'woocommerce_nav_menu_item_classes', 2, 20 );
|
add_filter( 'wp_nav_menu_objects', 'woocommerce_nav_menu_item_classes', 2, 20 );
|
||||||
add_action( 'wp', 'woocommerce_front_page_archive_paging_fix', 1 );
|
add_action( 'get_header', 'woocommerce_front_page_archive_paging_fix', 1 );
|
||||||
add_action( 'woocommerce_before_shop_loop', 'woocommerce_front_page_archive', 1 );
|
add_action( 'woocommerce_before_shop_loop', 'woocommerce_front_page_archive', 1 );
|
||||||
add_filter( 'wp_list_pages', 'woocommerce_list_pages' );
|
add_filter( 'wp_list_pages', 'woocommerce_list_pages' );
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ add_filter( 'wp_nav_menu_items', 'woocommerce_nav_menu_items', 10, 2 );
|
||||||
|
|
||||||
/* Clear the cart */
|
/* Clear the cart */
|
||||||
if (get_option('woocommerce_clear_cart_on_logout')=='yes') add_action( 'wp_logout', 'woocommerce_empty_cart' );
|
if (get_option('woocommerce_clear_cart_on_logout')=='yes') add_action( 'wp_logout', 'woocommerce_empty_cart' );
|
||||||
add_action( 'wp', 'woocommerce_clear_cart_after_payment' );
|
add_action( 'get_header', 'woocommerce_clear_cart_after_payment' );
|
||||||
|
|
||||||
/* Disable admin bar */
|
/* Disable admin bar */
|
||||||
add_action( 'init', 'woocommerce_disable_admin_bar' );
|
add_action( 'init', 'woocommerce_disable_admin_bar' );
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* Plugin Name: WooCommerce
|
* Plugin Name: WooCommerce
|
||||||
* Plugin URI: http://www.woothemes.com/woocommerce/
|
* Plugin URI: http://www.woothemes.com/woocommerce/
|
||||||
* Description: An e-commerce toolkit that helps you sell anything. Beautifully.
|
* Description: An e-commerce toolkit that helps you sell anything. Beautifully.
|
||||||
* Version: 1.5.5
|
* Version: 1.5.6
|
||||||
* Author: WooThemes
|
* Author: WooThemes
|
||||||
* Author URI: http://woothemes.com
|
* Author URI: http://woothemes.com
|
||||||
* Requires at least: 3.3
|
* Requires at least: 3.3
|
||||||
|
@ -32,7 +32,7 @@ class Woocommerce {
|
||||||
|
|
||||||
/** Version ***************************************************************/
|
/** Version ***************************************************************/
|
||||||
|
|
||||||
var $version = '1.5.5';
|
var $version = '1.5.6';
|
||||||
|
|
||||||
/** URLS ******************************************************************/
|
/** URLS ******************************************************************/
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ class Woocommerce {
|
||||||
add_filter( 'template_include', array(&$this, 'template_loader') );
|
add_filter( 'template_include', array(&$this, 'template_loader') );
|
||||||
add_filter( 'comments_template', array(&$this, 'comments_template_loader') );
|
add_filter( 'comments_template', array(&$this, 'comments_template_loader') );
|
||||||
add_filter( 'wp_redirect', array(&$this, 'redirect'), 1, 2 );
|
add_filter( 'wp_redirect', array(&$this, 'redirect'), 1, 2 );
|
||||||
add_action( 'wp', array(&$this, 'buffer_checkout') );
|
add_action( 'get_header', array(&$this, 'buffer_checkout') );
|
||||||
add_action( 'wp_enqueue_scripts', array(&$this, 'frontend_scripts') );
|
add_action( 'wp_enqueue_scripts', array(&$this, 'frontend_scripts') );
|
||||||
add_action( 'wp_head', array(&$this, 'generator') );
|
add_action( 'wp_head', array(&$this, 'generator') );
|
||||||
add_action( 'wp_head', array(&$this, 'wp_head') );
|
add_action( 'wp_head', array(&$this, 'wp_head') );
|
||||||
|
@ -239,7 +239,7 @@ class Woocommerce {
|
||||||
|
|
||||||
// Actions for SSL
|
// Actions for SSL
|
||||||
if ( ! is_admin() || defined('DOING_AJAX') ) {
|
if ( ! is_admin() || defined('DOING_AJAX') ) {
|
||||||
add_action( 'wp', array( &$this, 'ssl_redirect' ) );
|
add_action( 'get_header', array( &$this, 'ssl_redirect' ) );
|
||||||
|
|
||||||
$filters = array( 'post_thumbnail_html', 'widget_text', 'wp_get_attachment_url', 'wp_get_attachment_image_attributes', 'wp_get_attachment_url', 'option_siteurl', 'option_homeurl', 'option_home', 'option_url', 'option_wpurl', 'option_stylesheet_url', 'option_template_url', 'script_loader_src', 'style_loader_src', 'template_directory_uri', 'stylesheet_directory_uri', 'site_url' );
|
$filters = array( 'post_thumbnail_html', 'widget_text', 'wp_get_attachment_url', 'wp_get_attachment_image_attributes', 'wp_get_attachment_url', 'option_siteurl', 'option_homeurl', 'option_home', 'option_url', 'option_wpurl', 'option_stylesheet_url', 'option_template_url', 'script_loader_src', 'style_loader_src', 'template_directory_uri', 'stylesheet_directory_uri', 'site_url' );
|
||||||
foreach ( $filters as $filter ) add_filter( $filter, array( &$this, 'force_ssl') );
|
foreach ( $filters as $filter ) add_filter( $filter, array( &$this, 'force_ssl') );
|
||||||
|
|
Loading…
Reference in New Issue