Admin tweaks and mixed cart handling. Closes #651.
This commit is contained in:
parent
0ca05faf52
commit
9554a4c52c
|
@ -194,6 +194,15 @@ function woocommerce_admin_fields($options) {
|
|||
if (!isset( $value['class'] )) $value['class'] = '';
|
||||
if (!isset( $value['css'] )) $value['css'] = '';
|
||||
if (!isset( $value['std'] )) $value['std'] = '';
|
||||
if (!isset( $value['desc'] )) $value['desc'] = '';
|
||||
if (!isset( $value['desc_tip'] )) $value['desc_tip'] = false;
|
||||
|
||||
if ($value['desc_tip']) {
|
||||
$description = '<img class="help_tip" tip="'.$value['desc'].'" src="'.$woocommerce->plugin_url().'/assets/images/help.png" />';
|
||||
} else {
|
||||
$description = '<span class="description">'.$value['desc'].'</span>';
|
||||
}
|
||||
|
||||
switch($value['type']) :
|
||||
case 'title':
|
||||
if (isset($value['name']) && $value['name']) echo '<h3>'.$value['name'].'</h3>';
|
||||
|
@ -209,13 +218,13 @@ function woocommerce_admin_fields($options) {
|
|||
case 'text':
|
||||
?><tr valign="top">
|
||||
<th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
|
||||
<td class="forminp"><input name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" type="<?php echo esc_attr( $value['type'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>" value="<?php if ( get_option( $value['id'] ) !== false && get_option( $value['id'] ) !== null ) { echo esc_attr( stripslashes( get_option($value['id'] ) ) ); } else { echo esc_attr( $value['std'] ); } ?>" /> <span class="description"><?php echo $value['desc']; ?></span></td>
|
||||
<td class="forminp"><input name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" type="<?php echo esc_attr( $value['type'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>" value="<?php if ( get_option( $value['id'] ) !== false && get_option( $value['id'] ) !== null ) { echo esc_attr( stripslashes( get_option($value['id'] ) ) ); } else { echo esc_attr( $value['std'] ); } ?>" /> <?php echo $description; ?></td>
|
||||
</tr><?php
|
||||
break;
|
||||
case 'color' :
|
||||
?><tr valign="top">
|
||||
<th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
|
||||
<td class="forminp"><input name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" type="text" style="<?php echo esc_attr( $value['css'] ); ?>" value="<?php if ( get_option( $value['id'] ) !== false && get_option( $value['id'] ) !== null ) { echo esc_attr( stripslashes( get_option($value['id'] ) ) ); } else { echo esc_attr( $value['std'] ); } ?>" class="colorpick" /> <span class="description"><?php echo $value['desc']; ?></span> <div id="colorPickerDiv_<?php echo esc_attr( $value['id'] ); ?>" class="colorpickdiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div></td>
|
||||
<td class="forminp"><input name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" type="text" style="<?php echo esc_attr( $value['css'] ); ?>" value="<?php if ( get_option( $value['id'] ) !== false && get_option( $value['id'] ) !== null ) { echo esc_attr( stripslashes( get_option($value['id'] ) ) ); } else { echo esc_attr( $value['std'] ); } ?>" class="colorpick" /> <?php echo $description; ?> <div id="colorPickerDiv_<?php echo esc_attr( $value['id'] ); ?>" class="colorpickdiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div></td>
|
||||
</tr><?php
|
||||
break;
|
||||
case 'image_width' :
|
||||
|
@ -229,7 +238,7 @@ function woocommerce_admin_fields($options) {
|
|||
|
||||
<label><?php _e('Hard Crop', 'woocommerce'); ?> <input name="<?php echo esc_attr( $value['id'] ); ?>_crop" id="<?php echo esc_attr( $value['id'] ); ?>_crop" type="checkbox" <?php if (get_option( $value['id'].'_crop')!='') checked(get_option( $value['id'].'_crop'), 1); else checked(1); ?> /></label>
|
||||
|
||||
<span class="description"><?php echo $value['desc'] ?></span></td>
|
||||
<?php echo $description; ?></td>
|
||||
</tr><?php
|
||||
break;
|
||||
case 'select':
|
||||
|
@ -243,7 +252,7 @@ function woocommerce_admin_fields($options) {
|
|||
<?php
|
||||
}
|
||||
?>
|
||||
</select> <span class="description"><?php echo $value['desc'] ?></span>
|
||||
</select> <?php echo $description; ?>
|
||||
</td>
|
||||
</tr><?php
|
||||
break;
|
||||
|
@ -297,7 +306,7 @@ function woocommerce_admin_fields($options) {
|
|||
?><tr valign="top">
|
||||
<th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
|
||||
<td class="forminp">
|
||||
<textarea <?php if ( isset($value['args']) ) echo $value['args'] . ' '; ?>name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>"><?php if (false !== get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea( $value['std'] ); ?></textarea> <span class="description"><?php echo $value['desc'] ?></span>
|
||||
<textarea <?php if ( isset($value['args']) ) echo $value['args'] . ' '; ?>name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>"><?php if (false !== get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea( $value['std'] ); ?></textarea> <?php echo $description; ?>
|
||||
</td>
|
||||
</tr><?php
|
||||
break;
|
||||
|
@ -318,7 +327,7 @@ function woocommerce_admin_fields($options) {
|
|||
?><tr valign="top" class="single_select_page">
|
||||
<th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
|
||||
<td class="forminp">
|
||||
<?php echo str_replace(' id=', " data-placeholder='".__('Select a page...', 'woocommerce')."' style='".$value['css']."' class='".$value['class']."' id=", wp_dropdown_pages($args)); ?> <span class="description"><?php echo $value['desc'] ?></span>
|
||||
<?php echo str_replace(' id=', " data-placeholder='".__('Select a page...', 'woocommerce')."' style='".$value['css']."' class='".$value['class']."' id=", wp_dropdown_pages($args)); ?> <?php echo $description; ?>
|
||||
</td>
|
||||
</tr><?php
|
||||
break;
|
||||
|
@ -336,7 +345,7 @@ function woocommerce_admin_fields($options) {
|
|||
<th scope="rpw" class="titledesc"><?php echo $value['name'] ?></th>
|
||||
<td class="forminp"><select name="<?php echo esc_attr( $value['id'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>" data-placeholder="<?php _e('Choose a country…', 'woocommerce'); ?>" title="Country" class="chosen_select">
|
||||
<?php echo $woocommerce->countries->country_dropdown_options($country, $state); ?>
|
||||
</select> <span class="description"><?php echo $value['desc'] ?></span>
|
||||
</select> <?php echo $description; ?>
|
||||
</td>
|
||||
</tr><?php
|
||||
break;
|
||||
|
|
|
@ -25,7 +25,8 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
'id' => 'woocommerce_default_country',
|
||||
'css' => 'min-width:300px;',
|
||||
'std' => 'GB',
|
||||
'type' => 'single_select_country'
|
||||
'type' => 'single_select_country',
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
|
@ -37,6 +38,7 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
'std' => 'GBP',
|
||||
'type' => 'select',
|
||||
'class' => 'chosen_select',
|
||||
'desc_tip' => true,
|
||||
'options' => array_unique(apply_filters('woocommerce_currencies', array(
|
||||
'USD' => __( 'US Dollars ($)', 'woocommerce' ),
|
||||
'EUR' => __( 'Euros (€)', 'woocommerce' ),
|
||||
|
@ -75,6 +77,7 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
'type' => 'select',
|
||||
'class' => 'chosen_select',
|
||||
'css' => 'min-width:300px;',
|
||||
'desc_tip' => true,
|
||||
'options' => array(
|
||||
'all' => __( 'All Countries', 'woocommerce' ),
|
||||
'specific' => __( 'Specific Countries', 'woocommerce' )
|
||||
|
@ -89,31 +92,18 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
'std' => '',
|
||||
'type' => 'multi_select_countries'
|
||||
),
|
||||
|
||||
|
||||
array(
|
||||
'name' => __( 'Checkout Fields', 'woocommerce' ),
|
||||
'desc' => __( 'Enable coupon form on checkout', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_coupon_form_on_checkout',
|
||||
'name' => __('Localisation', 'woocommerce'),
|
||||
'desc' => __('Use informal localisation file if it exists', 'woocommerce'),
|
||||
'id' => 'woocommerce_informal_localisation_type',
|
||||
'type' => 'checkbox',
|
||||
'std' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start'
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Show order comments section', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_order_comments',
|
||||
'std' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => ''
|
||||
),
|
||||
array( 'type' => 'sectionend', 'id' => 'general_options'),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Allow unregistered users to register from the checkout page', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_signup_and_login_from_checkout',
|
||||
'std' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'end'
|
||||
),
|
||||
array( 'name' => __( 'Checkout and Accounts', 'woocommerce' ), 'type' => 'title','desc' => __('The following options control the behaviour of the checkout process and customer accounts.', 'woocommerce'), 'id' => 'checkout_account_options' ),
|
||||
|
||||
array(
|
||||
'name' => __( 'Security', 'woocommerce' ),
|
||||
|
@ -133,23 +123,47 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
'checkboxgroup' => 'end',
|
||||
'show_if_checked' => 'yes',
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => __( 'Customer Accounts', 'woocommerce' ),
|
||||
'desc' => __( 'Allow unregistered users to register from the My Account page', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_myaccount_registration',
|
||||
'std' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start'
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => __( 'Checkout', 'woocommerce' ),
|
||||
'desc' => __( 'Allow users to checkout without signing up for an account', 'woocommerce' ),
|
||||
'desc' => __( 'Enable Guest Checkout (no account required)', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_guest_checkout',
|
||||
'std' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => ''
|
||||
'checkboxgroup' => 'start'
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Enable coupon form on checkout', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_coupon_form_on_checkout',
|
||||
'std' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => ''
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Show order comments section', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_order_comments',
|
||||
'std' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'end'
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => __( 'Customer Accounts', 'woocommerce' ),
|
||||
'desc' => __( 'Allow unregistered users to register from the Checkout', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_signup_and_login_from_checkout',
|
||||
'std' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start'
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Allow unregistered users to register from "My Account"', 'woocommerce' ),
|
||||
'id' => 'woocommerce_enable_myaccount_registration',
|
||||
'std' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => ''
|
||||
),
|
||||
|
||||
array(
|
||||
|
@ -167,6 +181,10 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'end'
|
||||
),
|
||||
|
||||
array( 'type' => 'sectionend', 'id' => 'checkout_account_options'),
|
||||
|
||||
array( 'name' => __( 'Styles and Scripts', 'woocommerce' ), 'type' => 'title','desc' => __('The following options affect the styling of your store, as well as how certain features behave.', 'woocommerce'), 'id' => 'script_styling_options' ),
|
||||
|
||||
array(
|
||||
'name' => __( 'Styling', 'woocommerce' ),
|
||||
|
@ -219,13 +237,17 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Output WooCommerce JavaScript in the footer (<code>wp_footer</code>)', 'woocommerce' ),
|
||||
'desc' => __( 'Output WooCommerce JavaScript in the footer', 'woocommerce' ),
|
||||
'id' => 'woocommerce_scripts_position',
|
||||
'std' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'end'
|
||||
),
|
||||
|
||||
array( 'type' => 'sectionend', 'id' => 'script_styling_options'),
|
||||
|
||||
array( 'name' => __( 'Digital Downloads', 'woocommerce' ), 'type' => 'title','desc' => __('The following options are specific to downloadable products.', 'woocommerce'), 'id' => 'digital_download_options' ),
|
||||
|
||||
array(
|
||||
'name' => __('File download method', 'woocommerce'),
|
||||
'desc' => __('Forcing downloads will keep URLs hidden, but some servers may serve large files unreliably. If supported, <code>X-Accel-Redirect</code>/ <code>X-Sendfile</code> can be used to serve downloads instead (server requires <code>mod_xsendfile</code>).', 'woocommerce'),
|
||||
|
@ -234,6 +256,7 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
'class' => 'chosen_select',
|
||||
'css' => 'min-width:300px;',
|
||||
'std' => 'force',
|
||||
'desc_tip' => true,
|
||||
'options' => array(
|
||||
'force' => __( 'Force Downloads', 'woocommerce' ),
|
||||
'xsendfile' => __( 'X-Accel-Redirect/X-Sendfile', 'woocommerce' ),
|
||||
|
@ -250,14 +273,14 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings',
|
|||
),
|
||||
|
||||
array(
|
||||
'name' => __('Localisation', 'woocommerce'),
|
||||
'desc' => __('Use informal localisation file if it exists', 'woocommerce'),
|
||||
'id' => 'woocommerce_informal_localisation_type',
|
||||
'name' => __('Mixed cart handling', 'woocommerce'),
|
||||
'desc' => __('Grant access to downloadable products after payment. Turn this option off to only grant access when an order is "complete".', 'woocommerce'),
|
||||
'id' => 'woocommerce_downloads_grant_access_after_payment',
|
||||
'type' => 'checkbox',
|
||||
'std' => 'no',
|
||||
'std' => 'yes',
|
||||
),
|
||||
|
||||
array( 'type' => 'sectionend', 'id' => 'general_options'),
|
||||
array( 'type' => 'sectionend', 'id' => 'digital_download_options' ),
|
||||
|
||||
)); // End general settings
|
||||
|
||||
|
|
2252
assets/css/admin.css
2252
assets/css/admin.css
File diff suppressed because one or more lines are too long
|
@ -1022,6 +1022,7 @@ table.wc_gateways, table.wc_shipping {
|
|||
}
|
||||
}
|
||||
table.form-table {
|
||||
margin: 0 0 0;
|
||||
textarea.input-text {
|
||||
height: 100%;
|
||||
min-width: 150px;
|
||||
|
@ -1029,6 +1030,12 @@ table.wc_gateways, table.wc_shipping {
|
|||
textarea.wide-input {
|
||||
width: 100%;
|
||||
}
|
||||
img.help_tip {
|
||||
padding: 0;
|
||||
margin: -4px 0 0 5px;
|
||||
vertical-align: middle;
|
||||
cursor: help;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1611,6 +1618,10 @@ img.tips {
|
|||
box-shadow: 1px 1px 3px rgba(0,0,0,0.10);
|
||||
-webkit-box-shadow: 1px 1px 3px rgba(0,0,0,0.10);
|
||||
-moz-box-shadow: 1px 1px 3px rgba(0,0,0,0.10);
|
||||
code {
|
||||
background: #855c76;
|
||||
padding: 1px;
|
||||
}
|
||||
}
|
||||
#tiptip_arrow, #tiptip_arrow_inner {
|
||||
position: absolute;
|
||||
|
@ -1702,7 +1713,7 @@ img.ui-datepicker-trigger { vertical-align: middle; margin-top: -1px; cursor: po
|
|||
-o-border-radius:4px;
|
||||
-khtml-border-radius:4px;
|
||||
border-radius:4px;
|
||||
opacity: 0.80
|
||||
opacity: 0.80;
|
||||
}
|
||||
|
||||
/* Custom charts */
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 426 B |
Binary file not shown.
Before Width: | Height: | Size: 443 B |
|
@ -104,7 +104,7 @@ function clearPlaceholdersBeforeSubmit(form){form.find(':input[placeholder]').ea
|
|||
*/
|
||||
jQuery(function(){
|
||||
|
||||
jQuery(".tips").tipTip({
|
||||
jQuery(".tips, .help_tip").tipTip({
|
||||
'attribute' : 'tip',
|
||||
'fadeIn' : 50,
|
||||
'fadeOut' : 50
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -146,6 +146,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
= 1.4.5 =
|
||||
* Quick edit products
|
||||
* Bulk edit products
|
||||
* Better mixed cart handling - option to give access to downloads after payment (processing order status)
|
||||
* Added basic API for payment gateways to hook into (for IPN etc)
|
||||
* Added Bulgarian translation
|
||||
* Fixed SKU sort in admin
|
||||
|
@ -174,6 +175,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
* Made links in customer notes clickable links
|
||||
* Product option for customise the button text for external products
|
||||
* Function for getting placeholder.png - woocommerce_placeholder_img_src() with filter woocommerce_placeholder_img_src
|
||||
* Slight settings cleanup
|
||||
|
||||
= 1.4.4 - 18/02/2012 =
|
||||
* Fix for remove coupon links after ajax update of shipping
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
?>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?php echo $order->email_order_items_table( false, true ); ?>
|
||||
<?php echo $order->email_order_items_table( (get_option('woocommerce_downloads_grant_access_after_payment')=='yes') ? true : false, true ); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ $order = new WC_Order( $order_id );
|
|||
$item_meta = new order_item_meta( $item['item_meta'] );
|
||||
$item_meta->display();
|
||||
|
||||
if ($_product->exists && $_product->is_downloadable() && $order->status=='completed') :
|
||||
if ($_product->exists && $_product->is_downloadable() && ($order->status=='completed' || (get_option('woocommerce_downloads_grant_access_after_payment')=='yes' && $order->status=='processing'))) :
|
||||
|
||||
echo '<br/><small><a href="' . $order->get_downloadable_file_url( $item['id'], $item['variation_id'] ) . '">' . __('Download file →', 'woocommerce') . '</a></small>';
|
||||
|
||||
|
|
|
@ -447,9 +447,13 @@ function woocommerce_exclude_order_comments_from_feed_where( $where ) {
|
|||
**/
|
||||
add_action('woocommerce_order_status_completed', 'woocommerce_downloadable_product_permissions');
|
||||
|
||||
if (get_option('woocommerce_downloads_grant_access_after_payment')=='yes') add_action('woocommerce_order_status_processing', 'woocommerce_downloadable_product_permissions');
|
||||
|
||||
function woocommerce_downloadable_product_permissions( $order_id ) {
|
||||
global $wpdb;
|
||||
|
||||
if (get_post_meta( $order_id, '_downloadable_product_permissions_granted', true)==1) return; // Only do this once
|
||||
|
||||
$order = new WC_Order( $order_id );
|
||||
|
||||
if (sizeof($order->get_items())>0) foreach ($order->get_items() as $item) :
|
||||
|
@ -502,6 +506,8 @@ function woocommerce_downloadable_product_permissions( $order_id ) {
|
|||
endif;
|
||||
|
||||
endforeach;
|
||||
|
||||
update_post_meta( $order_id, '_downloadable_product_permissions_granted', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -745,7 +745,6 @@ function woocommerce_download_product() {
|
|||
$order_id = $download_result->order_id;
|
||||
$downloads_remaining = $download_result->downloads_remaining;
|
||||
$user_id = $download_result->user_id;
|
||||
|
||||
|
||||
if ($user_id && get_option('woocommerce_downloads_require_login')=='yes'):
|
||||
if (!is_user_logged_in()):
|
||||
|
|
Loading…
Reference in New Issue