Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Julian Jöris 2011-11-18 17:55:10 +01:00
commit e469a838bb
12 changed files with 80 additions and 41 deletions

View File

@ -35,7 +35,7 @@ function woocommerce_admin_menu() {
if ( current_user_can( 'manage_woocommerce' ) ) $menu[] = array( '', 'read', 'separator-woocommerce', '', 'wp-menu-separator woocommerce' );
add_menu_page(__('WooCommerce', 'woothemes'), __('WooCommerce', 'woothemes'), 'manage_woocommerce', 'woocommerce' , 'woocommerce_settings', $woocommerce->plugin_url() . '/assets/images/icons/menu_icon_wc.png', 55);
add_submenu_page('woocommerce', __('General Settings', 'woothemes'), __('Settings', 'woothemes') , 'manage_woocommerce', 'woocommerce', 'woocommerce_settings');
add_submenu_page('woocommerce', __('WooCommerce Settings', 'woothemes'), __('Settings', 'woothemes') , 'manage_woocommerce', 'woocommerce', 'woocommerce_settings');
add_submenu_page('woocommerce', __('Reports', 'woothemes'), __('Reports', 'woothemes') , 'manage_woocommerce', 'woocommerce_reports', 'woocommerce_reports');
add_submenu_page('edit.php?post_type=product', __('Attributes', 'woothemes'), __('Attributes', 'woothemes'), 'manage_categories', 'woocommerce_attributes', 'woocommerce_attributes');

View File

@ -442,7 +442,7 @@ function woocommerce_custom_order_columns($column) {
switch ($column) {
case "order_status" :
echo sprintf( __('<mark class="%s">%s</mark>', 'woothemes'), sanitize_title($order->status), $order->status );
echo sprintf( __('<mark class="%s">%s</mark>', 'woothemes'), sanitize_title($order->status), __($order->status, 'woothemes') );
break;
case "order_title" :
@ -595,7 +595,7 @@ function woocommerce_orders_by_status() {
foreach($terms as $term) :
$output .="<option value='$term->slug' ";
if ( isset( $wp_query->query['shop_order_status'] ) ) $output .=selected($term->slug, $wp_query->query['shop_order_status'], false);
$output .=">$term->name ($term->count)</option>";
$output .=">".__($term->name, 'woothemes')." ($term->count)</option>";
endforeach;
$output .="</select>";
echo $output;

View File

@ -136,6 +136,14 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
'type' => 'checkbox',
),
array(
'name' => __( 'Admin access', 'woothemes' ),
'desc' => __( 'Prevent customers from accessing WordPress admin', 'woothemes' ),
'id' => 'woocommerce_lock_down_admin',
'std' => 'no',
'type' => 'checkbox'
),
array(
'name' => __( 'Shop Styling', 'woothemes' ),
'desc' => __( 'Enable WooCommerce CSS styles', 'woothemes' ),

View File

@ -62,7 +62,7 @@ function woocommerce_order_data_meta_box($post) {
foreach ($statuses as $status) :
echo '<option value="'.$status->slug.'" ';
if ($status->slug==$order_status) echo 'selected="selected"';
echo '>'.$status->name.'</option>';
echo '>'.__($status->name, 'woothemes').'</option>';
endforeach;
?>
</select></p>

View File

@ -607,7 +607,7 @@ function woocommerce_process_product_meta( $post_id, $post ) {
'orderby' => 'meta_value_num',
'order' => 'asc',
'meta_key' => 'price',
'posts_per_page' => 1,
'posts_per_page'=> 1,
'post_type' => 'product',
'fields' => 'ids'
));

View File

@ -3,11 +3,10 @@ jQuery(document).ready(function($) {
$('table.widefat.wp-list-table tbody th, table.widefat tbody td').css('cursor','move');
$("table.widefat.wp-list-table tbody").sortable({
items: 'tr:not(.inline-edit-row)',
$("table.widefat.wp-list-table").sortable({
items: 'tbody tr:not(.inline-edit-row)',
cursor: 'move',
axis: 'y',
//containment: 'table.widefat',
placeholder: 'product-cat-placeholder',
scrollSensitivity: 40,
helper: function(e, ui) {

View File

@ -134,6 +134,8 @@ class woocommerce_paypal extends woocommerce_payment_gateway {
$paypal_adr = $this->liveurl . '?';
endif;
if ($this->debug=='yes') $woocommerce->log->add( 'paypal', 'Generating payment form for order #' . $order_id . '. Notify URL: ' . trailingslashit(home_url()).'?paypalListener=paypal_standard_IPN');
$shipping_name = explode(' ', $order->shipping_method);
if (in_array($order->billing_country, array('US','CA'))) :
@ -170,7 +172,7 @@ class woocommerce_paypal extends woocommerce_payment_gateway {
'custom' => $order_id,
// IPN
'notify_url' => trailingslashit(get_bloginfo('wpurl')).'?paypalListener=paypal_standard_IPN',
'notify_url' => trailingslashit(home_url()).'?paypalListener=paypal_standard_IPN',
// Address info
'first_name' => $order->billing_first_name,

View File

@ -431,6 +431,8 @@ class woocommerce_order {
unset($_SESSION['order_awaiting_payment']);
if ( $this->status=='on-hold' || $this->status=='pending' ) :
$downloadable_order = false;
if (sizeof($this->items)>0) foreach ($this->items as $item) :
@ -461,11 +463,12 @@ class woocommerce_order {
$this->update_status($new_order_status);
// Payment is complete so reduce stock levels and record sales
$this->record_product_sales();
// Payment is complete so reduce stock levels
$this->reduce_order_stock();
do_action( 'woocommerce_payment_complete', $this->id );
endif;
}
/**
@ -473,6 +476,8 @@ class woocommerce_order {
*/
function record_product_sales() {
if ( get_post_meta( $this->id, '_recorded_sales', true )=='yes' ) return;
if (sizeof($this->items)>0) foreach ($this->items as $item) :
if ($item['id']>0) :
$sales = (int) get_post_meta( $item['id'], 'total_sales', true );
@ -481,6 +486,8 @@ class woocommerce_order {
endif;
endforeach;
update_post_meta( $this->id, '_recorded_sales', 'yes' );
}
/**

View File

@ -888,7 +888,7 @@ class woocommerce_product {
if (has_post_thumbnail($this->id)) :
echo get_the_post_thumbnail($this->id, $size);
elseif ($parent_id = wp_get_post_parent_id( $this->id ) && has_post_thumbnail($parent_id)) :
elseif (($parent_id = wp_get_post_parent_id( $this->id )) && has_post_thumbnail($parent_id)) :
echo get_the_post_thumbnail($parent_id, $size);
else :
echo '<img src="'.$woocommerce->plugin_url(). '/assets/images/placeholder.png" alt="Placeholder" width="'.$woocommerce->get_image_size('shop_thumbnail_image_width').'" height="'.$woocommerce->get_image_size('shop_thumbnail_image_height').'" />';

View File

@ -88,6 +88,12 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
* Related product fix when no categories are set
* Fix for price filter + variations with multiple prices
* Grouped product link/quantity fix
* Made record_product_sales trigger once only
* Payment complete only when on-hold/pending
* More logging in paypal gateway
* Feature to prevent admin access to customers (optional)
* Fixed quick edit
* text/html email headers
= 1.2.3 - 17/11/2011 =
* Fix for sale price logic

View File

@ -4,6 +4,7 @@
*
* Actions/functions/hooks for WooCommerce related events.
*
* - Prevent non-admin access to backend
* - Update catalog ordering if posted
* - AJAX update shipping method on cart page
* - AJAX update order review on checkout
@ -27,6 +28,21 @@
* @author WooThemes
*/
/**
* Prevent non-admin access to backend
*/
if (get_option('woocommerce_lock_down_admin')=='yes') add_action('admin_init', 'woocommerce_prevent_admin_access');
function woocommerce_prevent_admin_access() {
if ( is_admin() && !is_ajax() && !current_user_can('edit_posts') ) :
wp_safe_redirect(get_permalink(get_option('woocommerce_myaccount_page_id')));
exit;
endif;
}
/**
* Update catalog ordering if posted
*/

View File

@ -29,7 +29,8 @@ function woocommerce_mail( $to, $subject, $message ) {
add_filter( 'wp_mail_content_type', 'woocommerce_email_content_type' );
// Send the mail
wp_mail( $to, $subject, $message );
$headers = "Content-Type: text/html" . "\r\n";
wp_mail( $to, $subject, $message, $headers );
// Unhook
remove_filter( 'wp_mail_from', 'woocommerce_mail_from' );