Merge branch 'update-shareyourcart' of https://github.com/andreibarabas/woocommerce into update-shareyourcart

This commit is contained in:
Andrei Barabas 2012-11-22 15:27:15 +02:00
commit f32b01fdf7
70 changed files with 712 additions and 609 deletions

View File

@ -207,37 +207,3 @@ foreach ( $order_tax_rows as $order_tax_row ) {
}
}
}
// Update manual counters for product categories (only counting visible products, so visibility: 'visible' or 'catalog')
// Loop through all products and put the IDs in array with each product category term id as index
$products_query_args = array(
'post_type' => 'product',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => '_visibility',
'value' => array( 'visible', 'catalog' ),
'compare' => 'IN',
),
),
);
$products_query = new WP_Query( $products_query_args );
$counted_ids = array();
foreach( $products_query->posts as $visible_product ) {
$product_terms = wp_get_post_terms( $visible_product->ID, 'product_cat', array( 'fields' => 'ids' ) );
foreach ( $product_terms as $product_term_id ) {
if ( ! isset( $counted_ids[ $product_term_id ] ) || ! is_array( $counted_ids[ $product_term_id ] ) ) {
$counted_ids[ $product_term_id ] = array();
}
if ( ! in_array( $visible_product->ID, $counted_ids[ $product_term_id ] ) ) {
array_push( $counted_ids[ $product_term_id ], $visible_product->ID );
}
}
}
update_option( 'wc_prod_cat_counts', $counted_ids );

View File

@ -16,11 +16,11 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<label><?php _e( 'Downloads Remaining', 'woocommerce' ); ?>:</label>
<input type="hidden" name="product_id[<?php echo $loop; ?>]" value="<?php echo absint( $download->product_id ); ?>" />
<input type="hidden" name="download_id[<?php echo $loop; ?>]" value="<?php echo esc_attr( $download->download_id ); ?>" />
<input type="text" class="short" name="downloads_remaining[<?php echo $loop; ?>]" value="<?php echo esc_attr( $download->downloads_remaining ); ?>" placeholder="<?php _e( 'Unlimited', 'woocommerce' ); ?>" />
<input type="number" step="1" min="0" class="short" name="downloads_remaining[<?php echo $loop; ?>]" value="<?php echo esc_attr( $download->downloads_remaining ); ?>" placeholder="<?php _e( 'Unlimited', 'woocommerce' ); ?>" />
</td>
<td>
<label><?php _e( 'Access Expires', 'woocommerce' ); ?>:</label>
<input type="text" class="short date-picker" name="access_expires[<?php echo $loop; ?>]" value="<?php echo $download->access_expires > 0 ? date_i18n( 'Y-m-d', strtotime( $download->access_expires ) ) : ''; ?>" maxlength="10" placeholder="<?php _e( 'Never', 'woocommerce' ); ?>" />
<input type="text" class="short date-picker" name="access_expires[<?php echo $loop; ?>]" value="<?php echo $download->access_expires > 0 ? date_i18n( 'Y-m-d', strtotime( $download->access_expires ) ) : ''; ?>" maxlength="10" placeholder="<?php _e( 'Never', 'woocommerce' ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
</td>
</tr>
</tbody>

View File

@ -99,19 +99,19 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
</td>
<td class="quantity" width="1%">
<input type="number" step="any" min="0" autocomplete="off" name="order_item_qty[<?php echo absint( $item_id ); ?>]" placeholder="0" value="<?php echo esc_attr( $item['qty'] ); ?>" size="4" class="quantity" />
<input type="number" step="<?php echo apply_filters( 'woocommerce_quantity_input_step', '1', $_product ); ?>" min="0" autocomplete="off" name="order_item_qty[<?php echo absint( $item_id ); ?>]" placeholder="0" value="<?php echo esc_attr( $item['qty'] ); ?>" size="4" class="quantity" />
</td>
<td class="line_cost" width="1%">
<label><?php _e( 'Total', 'woocommerce' ); ?>: <input type="text" name="line_total[<?php echo absint( $item_id ); ?>]" placeholder="0.00" value="<?php if ( isset( $item['line_total'] ) ) echo esc_attr( $item['line_total'] ); ?>" class="line_total" /></label>
<label><?php _e( 'Total', 'woocommerce' ); ?>: <input type="number" step="any" min="0" name="line_total[<?php echo absint( $item_id ); ?>]" placeholder="0.00" value="<?php if ( isset( $item['line_total'] ) ) echo esc_attr( $item['line_total'] ); ?>" class="line_total" /></label>
<span class="subtotal"><label><?php _e( 'Subtotal', 'woocommerce' ); ?>: <input type="text" name="line_subtotal[<?php echo absint( $item_id ); ?>]" placeholder="0.00" value="<?php if ( isset( $item['line_subtotal'] ) ) echo esc_attr( $item['line_subtotal'] ); ?>" class="line_subtotal" /></label></span>
<span class="subtotal"><label><?php _e( 'Subtotal', 'woocommerce' ); ?>: <input type="number" step="any" min="0" name="line_subtotal[<?php echo absint( $item_id ); ?>]" placeholder="0.00" value="<?php if ( isset( $item['line_subtotal'] ) ) echo esc_attr( $item['line_subtotal'] ); ?>" class="line_subtotal" /></label></span>
</td>
<td class="line_tax" width="1%">
<input type="text" name="line_tax[<?php echo absint( $item_id ); ?>]" placeholder="0.00" value="<?php if ( isset( $item['line_tax'] ) ) echo esc_attr( $item['line_tax'] ); ?>" class="line_tax" />
<input type="number" step="any" min="0" name="line_tax[<?php echo absint( $item_id ); ?>]" placeholder="0.00" value="<?php if ( isset( $item['line_tax'] ) ) echo esc_attr( $item['line_tax'] ); ?>" class="line_tax" />
<span class="subtotal"><input type="text" name="line_subtotal_tax[<?php echo absint( $item_id ); ?>]" placeholder="0.00" value="<?php if ( isset( $item['line_subtotal_tax'] ) ) echo esc_attr( $item['line_subtotal_tax'] ); ?>" class="line_subtotal_tax" /></span>
<span class="subtotal"><input type="number" step="any" min="0" name="line_subtotal_tax[<?php echo absint( $item_id ); ?>]" placeholder="0.00" value="<?php if ( isset( $item['line_subtotal_tax'] ) ) echo esc_attr( $item['line_subtotal_tax'] ); ?>" class="line_subtotal_tax" /></span>
</td>
</tr>

View File

@ -13,11 +13,11 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
</p>
<p class="first">
<label><?php _e( 'Sales Tax:', 'woocommerce' ) ?></label>
<input type="text" name="order_taxes_amount[<?php echo $item_id; ?>]" placeholder="0.00" value="<?php if ( isset( $item['tax_amount'] ) ) echo esc_attr( $item['tax_amount'] ); ?>" />
<input type="number" step="any" min="0" name="order_taxes_amount[<?php echo $item_id; ?>]" placeholder="0.00" value="<?php if ( isset( $item['tax_amount'] ) ) echo esc_attr( $item['tax_amount'] ); ?>" />
</p>
<p class="last">
<label><?php _e( 'Shipping Tax:', 'woocommerce' ) ?></label>
<input type="text" name="order_taxes_shipping_amount[<?php echo $item_id; ?>]" placeholder="0.00" value="<?php if ( isset( $item['shipping_tax_amount'] ) ) echo esc_attr( $item['shipping_tax_amount'] ); ?>" />
<input type="number" step="any" min="0" name="order_taxes_shipping_amount[<?php echo $item_id; ?>]" placeholder="0.00" value="<?php if ( isset( $item['shipping_tax_amount'] ) ) echo esc_attr( $item['shipping_tax_amount'] ); ?>" />
</p>
<a href="#" class="delete_tax_row">&times;</a>
<div class="clear"></div>

View File

@ -55,7 +55,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<tr>
<td>
<label><?php _e( 'Stock Qty:', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enter a quantity to enable stock management for this variation, or leave blank to use the variable product stock options.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<input type="text" size="5" name="variable_stock[<?php echo $loop; ?>]" value="<?php if ( isset( $_stock ) ) echo esc_attr( $_stock ); ?>" />
<input type="number" size="5" name="variable_stock[<?php echo $loop; ?>]" value="<?php if ( isset( $_stock ) ) echo esc_attr( $_stock ); ?>" step="any" />
</td>
<td>&nbsp;</td>
</tr>
@ -64,22 +64,22 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<tr>
<td>
<label><?php _e( 'Price:', 'woocommerce' ); ?></label>
<input type="text" size="5" name="variable_regular_price[<?php echo $loop; ?>]" value="<?php if ( isset( $_regular_price ) ) echo esc_attr( $_regular_price ); ?>" />
<input type="number" size="5" name="variable_regular_price[<?php echo $loop; ?>]" value="<?php if ( isset( $_regular_price ) ) echo esc_attr( $_regular_price ); ?>" step="any" min="0" />
</td>
<td>
<label><?php _e( 'Sale Price:', 'woocommerce' ); ?> <a href="#" class="sale_schedule"><?php _e( 'Schedule', 'woocommerce' ); ?></a><a href="#" class="cancel_sale_schedule" style="display:none"><?php _e( 'Cancel schedule', 'woocommerce' ); ?></a></label>
<input type="text" size="5" name="variable_sale_price[<?php echo $loop; ?>]" value="<?php if ( isset( $_sale_price ) ) echo esc_attr( $_sale_price ); ?>" />
<input type="number" size="5" name="variable_sale_price[<?php echo $loop; ?>]" value="<?php if ( isset( $_sale_price ) ) echo esc_attr( $_sale_price ); ?>" step="any" min="0" />
</td>
</tr>
<tr class="sale_price_dates_fields" style="display:none">
<td>
<label><?php _e( 'Sale start date:', 'woocommerce' ) ?></label>
<input type="text" class="sale_price_dates_from" name="variable_sale_price_dates_from[<?php echo $loop; ?>]" value="<?php echo ! empty( $_sale_price_dates_from ) ? date_i18n( 'Y-m-d', $_sale_price_dates_from ) : ''; ?>" placeholder="<?php echo _x( 'From&hellip;', 'placeholder', 'woocommerce' ) ?>" maxlength="10" />
<input type="text" class="sale_price_dates_from" name="variable_sale_price_dates_from[<?php echo $loop; ?>]" value="<?php echo ! empty( $_sale_price_dates_from ) ? date_i18n( 'Y-m-d', $_sale_price_dates_from ) : ''; ?>" placeholder="<?php echo _x( 'From&hellip;', 'placeholder', 'woocommerce' ) ?> YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
</td>
<td>
<label><?php _e( 'Sale end date:', 'woocommerce' ) ?></label>
<input type="text" name="variable_sale_price_dates_to[<?php echo $loop; ?>]" value="<?php echo ! empty( $_sale_price_dates_to ) ? date_i18n( 'Y-m-d', $_sale_price_dates_to ) : ''; ?>" placeholder="<?php echo _x('To&hellip;', 'placeholder', 'woocommerce') ?>" maxlength="10" />
<input type="text" name="variable_sale_price_dates_to[<?php echo $loop; ?>]" value="<?php echo ! empty( $_sale_price_dates_to ) ? date_i18n( 'Y-m-d', $_sale_price_dates_to ) : ''; ?>" placeholder="<?php echo _x('To&hellip;', 'placeholder', 'woocommerce') ?> YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
</td>
</tr>
@ -88,7 +88,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<?php if ( get_option( 'woocommerce_enable_weight', true ) !== 'no' ) : ?>
<td class="hide_if_variation_virtual">
<label><?php _e( 'Weight', 'woocommerce' ) . ' (' . esc_html( get_option( 'woocommerce_weight_unit' ) ) . '):'; ?> <a class="tips" data-tip="<?php _e( 'Enter a weight for this variation or leave blank to use the parent product weight.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<input type="text" size="5" name="variable_weight[<?php echo $loop; ?>]" value="<?php if ( isset( $_weight ) ) echo esc_attr( $_weight ); ?>" placeholder="<?php echo esc_attr( $parent_data['weight'] ); ?>" />
<input type="number" size="5" name="variable_weight[<?php echo $loop; ?>]" value="<?php if ( isset( $_weight ) ) echo esc_attr( $_weight ); ?>" placeholder="<?php echo esc_attr( $parent_data['weight'] ); ?>" step="any" min="0" />
</td>
<?php else : ?>
<td>&nbsp;</td>
@ -96,9 +96,9 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<?php if ( get_option( 'woocommerce_enable_dimensions', true ) !== 'no' ) : ?>
<td class="dimensions_field hide_if_variation_virtual">
<label for"product_length"><?php echo __( 'Dimensions (L&times;W&times;H)', 'woocommerce' ); ?></label>
<input id="product_length" class="input-text" size="6" type="text" name="variable_length[<?php echo $loop; ?>]" value="<?php if ( isset( $_length ) ) echo esc_attr( $_length ); ?>" placeholder="<?php echo esc_attr( $parent_data['length'] ); ?>" />
<input class="input-text" size="6" type="text" name="variable_width[<?php echo $loop; ?>]" value="<?php if ( isset( $_width ) ) echo esc_attr( $_width ); ?>" placeholder="<?php echo esc_attr( $parent_data['width'] ); ?>" />
<input class="input-text last" size="6" type="text" name="variable_height[<?php echo $loop; ?>]" value="<?php if ( isset( $_height ) ) echo esc_attr( $_height ); ?>" placeholder="<?php echo esc_attr( $parent_data['height'] ); ?>" />
<input id="product_length" class="input-text" size="6" type="number" step="any" min="0" name="variable_length[<?php echo $loop; ?>]" value="<?php if ( isset( $_length ) ) echo esc_attr( $_length ); ?>" placeholder="<?php echo esc_attr( $parent_data['length'] ); ?>" />
<input class="input-text" size="6" type="number" step="any" min="0" name="variable_width[<?php echo $loop; ?>]" value="<?php if ( isset( $_width ) ) echo esc_attr( $_width ); ?>" placeholder="<?php echo esc_attr( $parent_data['width'] ); ?>" />
<input class="input-text last" size="6" type="number" step="any" min="0" name="variable_height[<?php echo $loop; ?>]" value="<?php if ( isset( $_height ) ) echo esc_attr( $_height ); ?>" placeholder="<?php echo esc_attr( $parent_data['height'] ); ?>" />
</td>
<?php else : ?>
<td>&nbsp;</td>
@ -138,7 +138,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<td>
<div>
<label><?php _e( 'Download Limit:', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Leave blank for unlimited re-downloads.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<input type="text" size="5" name="variable_download_limit[<?php echo $loop; ?>]" value="<?php if ( isset( $_download_limit ) ) echo esc_attr( $_download_limit ); ?>" placeholder="<?php _e( 'Unlimited', 'woocommerce' ); ?>" />
<input type="number" size="5" name="variable_download_limit[<?php echo $loop; ?>]" value="<?php if ( isset( $_download_limit ) ) echo esc_attr( $_download_limit ); ?>" placeholder="<?php _e( 'Unlimited', 'woocommerce' ); ?>" step="1" min="0" />
</div>
</td>
</tr>
@ -146,7 +146,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<td>
<div>
<label><?php _e( 'Download Expiry:', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enter the number of days before a download link expires, or leave blank.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<input type="text" size="5" name="variable_download_expiry[<?php echo $loop; ?>]" value="<?php if ( isset( $_download_expiry ) ) echo esc_attr( $_download_expiry ); ?>" placeholder="<?php _e( 'Unlimited', 'woocommerce' ); ?>" />
<input type="number" size="5" name="variable_download_expiry[<?php echo $loop; ?>]" value="<?php if ( isset( $_download_expiry ) ) echo esc_attr( $_download_expiry ); ?>" placeholder="<?php _e( 'Unlimited', 'woocommerce' ); ?>" step="1" min="0" />
</div>
</td>
</tr>

View File

@ -42,7 +42,10 @@ function woocommerce_coupon_data_meta_box( $post ) {
woocommerce_wp_select( array( 'id' => 'discount_type', 'label' => __( 'Discount type', 'woocommerce' ), 'options' => $woocommerce->get_coupon_discount_types() ) );
// Amount
woocommerce_wp_text_input( array( 'id' => 'coupon_amount', 'label' => __( 'Coupon amount', 'woocommerce' ), 'placeholder' => '0.00', 'description' => __( 'Enter an amount e.g. 2.99', 'woocommerce' ) ) );
woocommerce_wp_text_input( array( 'id' => 'coupon_amount', 'label' => __( 'Coupon amount', 'woocommerce' ), 'placeholder' => '0.00', 'description' => __( 'Enter an amount e.g. 2.99', 'woocommerce' ), 'type' => 'number', 'custom_attributes' => array(
'step' => 'any',
'min' => '0'
) ) );
// Free Shipping
woocommerce_wp_checkbox( array( 'id' => 'free_shipping', 'label' => __( 'Enable free shipping', 'woocommerce' ), 'description' => sprintf(__( 'Check this box if the coupon grants free shipping. The <a href="%s">free shipping method</a> must be enabled with the "must use coupon" setting checked.', 'woocommerce' ), admin_url('admin.php?page=woocommerce_settings&tab=shipping&section=WC_Free_Shipping')) ) );
@ -56,7 +59,10 @@ function woocommerce_coupon_data_meta_box( $post ) {
echo '</div><div class="options_group">';
// minimum spend
woocommerce_wp_text_input( array( 'id' => 'minimum_amount', 'label' => __( 'Minimum amount', 'woocommerce' ), 'placeholder' => __( 'No minimum', 'woocommerce' ), 'description' => __( 'This field allows you to set the minimum subtotal needed to use the coupon.', 'woocommerce' ) ) );
woocommerce_wp_text_input( array( 'id' => 'minimum_amount', 'label' => __( 'Minimum amount', 'woocommerce' ), 'placeholder' => __( 'No minimum', 'woocommerce' ), 'description' => __( 'This field allows you to set the minimum subtotal needed to use the coupon.', 'woocommerce' ), 'type' => 'number', 'custom_attributes' => array(
'step' => 'any',
'min' => '0'
) ) );
echo '</div><div class="options_group">';
@ -143,15 +149,20 @@ function woocommerce_coupon_data_meta_box( $post ) {
echo '</div><div class="options_group">';
// Customers
woocommerce_wp_text_input( array( 'id' => 'customer_email', 'label' => __( 'Customer emails', 'woocommerce' ), 'placeholder' => __( 'Any customer', 'woocommerce' ), 'description' => __( 'Comma separate email addresses to restrict this coupon to specific billing and user emails.', 'woocommerce' ), 'value' => implode(', ', (array) get_post_meta( $post->ID, 'customer_email', true )) ) );
woocommerce_wp_text_input( array( 'id' => 'customer_email', 'label' => __( 'Customer emails', 'woocommerce' ), 'placeholder' => __( 'Any customer', 'woocommerce' ), 'description' => __( 'Comma separate email addresses to restrict this coupon to specific billing and user emails.', 'woocommerce' ), 'value' => implode(', ', (array) get_post_meta( $post->ID, 'customer_email', true ) ), 'type' => 'email', 'custom_attributes' => array(
'multiple' => 'multiple'
) ) );
echo '</div><div class="options_group">';
// Usage limit
woocommerce_wp_text_input( array( 'id' => 'usage_limit', 'label' => __( 'Usage limit', 'woocommerce' ), 'placeholder' => _x('Unlimited usage', 'placeholder', 'woocommerce'), 'description' => __( 'How many times this coupon can be used before it is void.', 'woocommerce' ) ) );
woocommerce_wp_text_input( array( 'id' => 'usage_limit', 'label' => __( 'Usage limit', 'woocommerce' ), 'placeholder' => _x('Unlimited usage', 'placeholder', 'woocommerce'), 'description' => __( 'How many times this coupon can be used before it is void.', 'woocommerce' ), 'type' => 'number', 'custom_attributes' => array(
'step' => '1',
'min' => '0'
) ) );
// Expiry date
woocommerce_wp_text_input( array( 'id' => 'expiry_date', 'label' => __( 'Expiry date', 'woocommerce' ), 'placeholder' => _x('Never expire', 'placeholder', 'woocommerce'), 'description' => __( 'The date this coupon will expire, <code>YYYY-MM-DD</code>.', 'woocommerce' ), 'class' => 'short date-picker' ) );
woocommerce_wp_text_input( array( 'id' => 'expiry_date', 'label' => __( 'Expiry date', 'woocommerce' ), 'placeholder' => _x('Never expire', 'placeholder', 'woocommerce'), 'description' => __( 'The date this coupon will expire, <code>YYYY-MM-DD</code>.', 'woocommerce' ), 'class' => 'short date-picker', 'custom_attributes' => array( 'pattern' => "[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" ) ) );
echo '</div>';

View File

@ -71,7 +71,7 @@ function woocommerce_order_data_meta_box($post) {
</select></p>
<p class="form-field last"><label for="order_date"><?php _e( 'Order Date:', 'woocommerce' ) ?></label>
<input type="text" class="date-picker-field" name="order_date" id="order_date" maxlength="10" value="<?php echo date_i18n( 'Y-m-d', strtotime( $post->post_date ) ); ?>" /> @ <input type="text" class="hour" placeholder="<?php _e( 'h', 'woocommerce' ) ?>" name="order_date_hour" id="order_date_hour" maxlength="2" size="2" value="<?php echo date_i18n( 'H', strtotime( $post->post_date ) ); ?>" />:<input type="text" class="minute" placeholder="<?php _e( 'm', 'woocommerce' ) ?>" name="order_date_minute" id="order_date_minute" maxlength="2" size="2" value="<?php echo date_i18n( 'i', strtotime( $post->post_date ) ); ?>" />
<input type="text" class="date-picker-field" name="order_date" id="order_date" maxlength="10" value="<?php echo date_i18n( 'Y-m-d', strtotime( $post->post_date ) ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" /> @ <input type="text" class="hour" placeholder="<?php _e( 'h', 'woocommerce' ) ?>" name="order_date_hour" id="order_date_hour" maxlength="2" size="2" value="<?php echo date_i18n( 'H', strtotime( $post->post_date ) ); ?>" pattern="\-?\d+(\.\d{0,})?" />:<input type="text" class="minute" placeholder="<?php _e( 'm', 'woocommerce' ) ?>" name="order_date_minute" id="order_date_minute" maxlength="2" size="2" value="<?php echo date_i18n( 'i', strtotime( $post->post_date ) ); ?>" pattern="\-?\d+(\.\d{0,})?" />
</p>
<p class="form-field form-field-wide">
@ -369,7 +369,7 @@ function woocommerce_order_items_meta_box( $post ) {
<option value="delete"><?php _e( 'Delete Lines', 'woocommerce' ); ?></option>
<?php
$gateways = $woocommerce->payment_gateways->get_available_payment_gateways();
$gateways = $woocommerce->payment_gateways->payment_gateways();
if ( isset( $gateways[ $order->payment_method ] ) ) {
$gateway = $gateways[ $order->payment_method ];
@ -489,7 +489,7 @@ function woocommerce_order_totals_meta_box( $post ) {
<li class="left">
<label><?php _e( 'Cart Discount:', 'woocommerce' ); ?>&nbsp;<a class="tips" data-tip="<?php _e( 'Discounts before tax - calculated by comparing subtotals to totals.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<input type="text" id="_cart_discount" name="_cart_discount" placeholder="0.00" value="<?php
<input type="number" step="any" min="0" id="_cart_discount" name="_cart_discount" placeholder="0.00" value="<?php
if ( isset( $data['_cart_discount'][0] ) )
echo esc_attr( $data['_cart_discount'][0] );
?>" class="calculated" />
@ -497,7 +497,7 @@ function woocommerce_order_totals_meta_box( $post ) {
<li class="right">
<label><?php _e( 'Order Discount:', 'woocommerce' ); ?>&nbsp;<a class="tips" data-tip="<?php _e( 'Discounts after tax - user defined.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<input type="text" id="_order_discount" name="_order_discount" placeholder="0.00" value="<?php
<input type="number" step="any" min="0" id="_order_discount" name="_order_discount" placeholder="0.00" value="<?php
if ( isset( $data['_order_discount'][0] ) )
echo esc_attr( $data['_order_discount'][0] );
?>" />
@ -520,7 +520,7 @@ function woocommerce_order_totals_meta_box( $post ) {
<li class="left">
<label><?php _e( 'Cost:', 'woocommerce' ); ?></label>
<input type="text" id="_order_shipping" name="_order_shipping" placeholder="0.00 <?php _e( '(ex. tax)', 'woocommerce' ); ?>" value="<?php
<input type="number" step="any" min="0" id="_order_shipping" name="_order_shipping" placeholder="0.00 <?php _e( '(ex. tax)', 'woocommerce' ); ?>" value="<?php
if ( isset( $data['_order_shipping'][0] ) )
echo esc_attr( $data['_order_shipping'][0] );
?>" class="first" />
@ -573,7 +573,7 @@ function woocommerce_order_totals_meta_box( $post ) {
<li class="left">
<label><?php _e( 'Sales Tax:', 'woocommerce' ); ?>&nbsp;<a class="tips" data-tip="<?php _e( 'Total tax for line items + fees.', 'woocommerce' ); ?>" href="#">[?]</a></label>
<input type="text" id="_order_tax" name="_order_tax" placeholder="0.00" value="<?php
<input type="number" step="any" min="0" id="_order_tax" name="_order_tax" placeholder="0.00" value="<?php
if ( isset( $data['_order_tax'][0] ) )
echo esc_attr( $data['_order_tax'][0] );
?>" class="calculated" />
@ -581,7 +581,7 @@ function woocommerce_order_totals_meta_box( $post ) {
<li class="right">
<label><?php _e( 'Shipping Tax:', 'woocommerce' ); ?></label>
<input type="text" id="_order_shipping_tax" name="_order_shipping_tax" placeholder="0.00" value="<?php
<input type="number" step="any" min="0" id="_order_shipping_tax" name="_order_shipping_tax" placeholder="0.00" value="<?php
if ( isset( $data['_order_shipping_tax'][0] ) )
echo esc_attr( $data['_order_shipping_tax'][0] );
?>" />
@ -596,7 +596,7 @@ function woocommerce_order_totals_meta_box( $post ) {
<li class="left">
<label><?php _e( 'Order Total:', 'woocommerce' ); ?></label>
<input type="text" id="_order_total" name="_order_total" placeholder="0.00" value="<?php
<input type="number" step="any" min="0" id="_order_total" name="_order_total" placeholder="0.00" value="<?php
if ( isset( $data['_order_total'][0] ) )
echo esc_attr( $data['_order_total'][0] );
?>" class="calculated" />
@ -789,7 +789,7 @@ function woocommerce_process_shop_order_meta( $post_id, $post ) {
);
if ( isset( $order_item_qty[ $item_id ] ) )
woocommerce_update_order_item_meta( $item_id, '_qty', absint( $order_item_qty[ $item_id ] ) );
woocommerce_update_order_item_meta( $item_id, '_qty', apply_filters( 'woocommerce_stock_amount', $order_item_qty[ $item_id ] ) );
if ( isset( $item_tax_class[ $item_id ] ) )
woocommerce_update_order_item_meta( $item_id, '_tax_class', woocommerce_clean( $item_tax_class[ $item_id ] ) );

View File

@ -116,10 +116,16 @@ function woocommerce_product_data_box() {
echo '<div class="options_group pricing show_if_simple show_if_external">';
// Price
woocommerce_wp_text_input( array( 'id' => '_regular_price', 'class' => 'wc_input_price short', 'label' => __( 'Regular Price', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol().')' ) );
woocommerce_wp_text_input( array( 'id' => '_regular_price', 'class' => 'wc_input_price short', 'label' => __( 'Regular Price', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol().')', 'type' => 'number', 'custom_attributes' => array(
'step' => 'any',
'min' => '0'
) ) );
// Special Price
woocommerce_wp_text_input( array( 'id' => '_sale_price', 'class' => 'wc_input_price short', 'label' => __( 'Sale Price', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol().')', 'description' => '<a href="#" class="sale_schedule">' . __( 'Schedule', 'woocommerce' ) . '</a>' ) );
woocommerce_wp_text_input( array( 'id' => '_sale_price', 'class' => 'wc_input_price short', 'label' => __( 'Sale Price', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol().')', 'description' => '<a href="#" class="sale_schedule">' . __( 'Schedule', 'woocommerce' ) . '</a>', 'type' => 'number', 'custom_attributes' => array(
'step' => 'any',
'min' => '0'
) ) );
// Special Price date range
$sale_price_dates_from = ( $date = get_post_meta( $thepostid, '_sale_price_dates_from', true ) ) ? date_i18n( 'Y-m-d', $date ) : '';
@ -127,8 +133,8 @@ function woocommerce_product_data_box() {
echo ' <p class="form-field sale_price_dates_fields">
<label for="_sale_price_dates_from">' . __( 'Sale Price Dates', 'woocommerce' ) . '</label>
<input type="text" class="short" name="_sale_price_dates_from" id="_sale_price_dates_from" value="' . $sale_price_dates_from . '" placeholder="' . _x( 'From&hellip;', 'placeholder', 'woocommerce' ) . '" maxlength="10" />
<input type="text" class="short" name="_sale_price_dates_to" id="_sale_price_dates_to" value="' . $sale_price_dates_to . '" placeholder="' . _x( 'To&hellip;', 'placeholder', 'woocommerce' ) . '" maxlength="10" />
<input type="text" class="short" name="_sale_price_dates_from" id="_sale_price_dates_from" value="' . $sale_price_dates_from . '" placeholder="' . _x( 'From&hellip;', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
<input type="text" class="short" name="_sale_price_dates_to" id="_sale_price_dates_to" value="' . $sale_price_dates_to . '" placeholder="' . _x( 'To&hellip;', 'placeholder', 'woocommerce' ) . ' YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
<a href="#" class="cancel_sale_schedule">'. __( 'Cancel', 'woocommerce' ) .'</a>
</p>';
@ -149,10 +155,16 @@ function woocommerce_product_data_box() {
</p>';
// Download Limit
woocommerce_wp_text_input( array( 'id' => '_download_limit', 'label' => __( 'Download Limit', 'woocommerce' ), 'placeholder' => __( 'Unlimited', 'woocommerce' ), 'description' => __( 'Leave blank for unlimited re-downloads.', 'woocommerce' ) ) );
woocommerce_wp_text_input( array( 'id' => '_download_limit', 'label' => __( 'Download Limit', 'woocommerce' ), 'placeholder' => __( 'Unlimited', 'woocommerce' ), 'description' => __( 'Leave blank for unlimited re-downloads.', 'woocommerce' ), 'type' => 'number', 'custom_attributes' => array(
'step' => '1',
'min' => '0'
) ) );
// Expirey
woocommerce_wp_text_input( array( 'id' => '_download_expiry', 'label' => __( 'Download Expiry', 'woocommerce' ), 'placeholder' => __( 'Never', 'woocommerce' ), 'description' => __( 'Enter the number of days before a download link expires, or leave blank.', 'woocommerce' ) ) );
woocommerce_wp_text_input( array( 'id' => '_download_expiry', 'label' => __( 'Download Expiry', 'woocommerce' ), 'placeholder' => __( 'Never', 'woocommerce' ), 'description' => __( 'Enter the number of days before a download link expires, or leave blank.', 'woocommerce' ), 'type' => 'number', 'custom_attributes' => array(
'step' => '1',
'min' => '0'
) ) );
do_action( 'woocommerce_product_options_downloads' );
@ -198,7 +210,9 @@ function woocommerce_product_data_box() {
echo '<div class="stock_fields show_if_simple show_if_variable">';
// Stock
woocommerce_wp_text_input( array( 'id' => '_stock', 'label' => __( 'Stock Qty', 'woocommerce' ), 'desc_tip' => true, 'description' => __( 'Stock quantity. If this is a variable product this value will be used to control stock for all variations, unless you define stock at variation level.', 'woocommerce' ) ) );
woocommerce_wp_text_input( array( 'id' => '_stock', 'label' => __( 'Stock Qty', 'woocommerce' ), 'desc_tip' => true, 'description' => __( 'Stock quantity. If this is a variable product this value will be used to control stock for all variations, unless you define stock at variation level.', 'woocommerce' ), 'type' => 'number', 'custom_attributes' => array(
'step' => 'any'
) ) );
do_action('woocommerce_product_options_stock_fields');
@ -239,7 +253,10 @@ function woocommerce_product_data_box() {
// Weight
if( get_option('woocommerce_enable_weight', true) !== 'no' ) :
woocommerce_wp_text_input( array( 'id' => '_weight', 'label' => __( 'Weight', 'woocommerce' ) . ' ('.get_option('woocommerce_weight_unit').')', 'placeholder' => '0.00', 'description' => __( 'Weight in decimal form', 'woocommerce' ) ) );
woocommerce_wp_text_input( array( 'id' => '_weight', 'label' => __( 'Weight', 'woocommerce' ) . ' ('.get_option('woocommerce_weight_unit').')', 'placeholder' => '0.00', 'description' => __( 'Weight in decimal form', 'woocommerce' ), 'type' => 'number', 'custom_attributes' => array(
'step' => 'any',
'min' => '0'
) ) );
else:
echo '<input type="hidden" name="_weight" value="' . esc_attr( get_post_meta( $thepostid, '_weight', true ) ) . '" />';
endif;
@ -249,9 +266,9 @@ function woocommerce_product_data_box() {
?><p class="form-field dimensions_field">
<label for"product_length"><?php echo __( 'Dimensions', 'woocommerce' ) . ' (' . get_option( 'woocommerce_dimension_unit' ) . ')'; ?></label>
<span class="wrap">
<input id="product_length" placeholder="<?php _e( 'Length', 'woocommerce' ); ?>" class="input-text" size="6" type="text" name="_length" value="<?php echo esc_attr( get_post_meta( $thepostid, '_length', true ) ); ?>" />
<input placeholder="<?php _e( 'Width', 'woocommerce' ); ?>" class="input-text" size="6" type="text" name="_width" value="<?php echo esc_attr( get_post_meta( $thepostid, '_width', true ) ); ?>" />
<input placeholder="<?php _e( 'Height', 'woocommerce' ); ?>" class="input-text last" size="6" type="text" name="_height" value="<?php echo esc_attr( get_post_meta( $thepostid, '_height', true ) ); ?>" />
<input id="product_length" placeholder="<?php _e( 'Length', 'woocommerce' ); ?>" class="input-text" size="6" type="number" name="_length" value="<?php echo esc_attr( get_post_meta( $thepostid, '_length', true ) ); ?>" step="any" min="0" />
<input placeholder="<?php _e( 'Width', 'woocommerce' ); ?>" class="input-text" size="6" type="number" name="_width" value="<?php echo esc_attr( get_post_meta( $thepostid, '_width', true ) ); ?>" step="any" min="0" />
<input placeholder="<?php _e( 'Height', 'woocommerce' ); ?>" class="input-text last" size="6" type="number" name="_height" value="<?php echo esc_attr( get_post_meta( $thepostid, '_height', true ) ); ?>" step="any" min="0" />
</span>
<span class="description"><?php _e( 'LxWxH in decimal form', 'woocommerce' ); ?></span>
</p><?php
@ -522,7 +539,9 @@ function woocommerce_product_data_box() {
echo '<div class="options_group">';
// menu_order
woocommerce_wp_text_input( array( 'id' => 'menu_order', 'label' => __( 'Menu order', 'woocommerce' ), 'description' => __( 'Custom ordering position.', 'woocommerce' ), 'value' => intval( $post->menu_order ) ) );
woocommerce_wp_text_input( array( 'id' => 'menu_order', 'label' => __( 'Menu order', 'woocommerce' ), 'description' => __( 'Custom ordering position.', 'woocommerce' ), 'value' => intval( $post->menu_order ), 'type' => 'number', 'custom_attributes' => array(
'step' => '1'
) ) );
echo '</div>';

View File

@ -319,8 +319,16 @@ function woocommerce_wp_text_input( $field ) {
$field['class'] = isset( $field['class'] ) ? $field['class'] : 'short';
$field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true );
$field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id'];
$field['type'] = isset( $field['type'] ) ? $field['type'] : 'text';
echo '<p class="form-field ' . esc_attr( $field['id'] ) . '_field"><label for="' . esc_attr( $field['id'] ) . '">' . wp_kses_post( $field['label'] ) . '</label><input type="text" class="' . esc_attr( $field['class'] ) . '" name="' . esc_attr( $field['name'] ) . '" id="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $field['value'] ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" /> ';
// Custom attribute handling
$custom_attributes = array();
if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) )
foreach ( $field['custom_attributes'] as $attribute => $value )
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';
echo '<p class="form-field ' . esc_attr( $field['id'] ) . '_field"><label for="' . esc_attr( $field['id'] ) . '">' . wp_kses_post( $field['label'] ) . '</label><input type="' . esc_attr( $field['type'] ) . '" class="' . esc_attr( $field['class'] ) . '" name="' . esc_attr( $field['name'] ) . '" id="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $field['value'] ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" ' . implode( ' ', $custom_attributes ) . ' /> ';
if ( ! empty( $field['description'] ) ) {

View File

@ -685,7 +685,7 @@ $woocommerce_settings['catalog'] = apply_filters('woocommerce_catalog_settings',
'name' => __( 'Thousand Separator', 'woocommerce' ),
'desc' => __( 'This sets the thousand separator of displayed prices.', 'woocommerce' ),
'id' => 'woocommerce_price_thousand_sep',
'css' => 'width:30px;',
'css' => 'width:50px;',
'std' => ',',
'type' => 'text',
'desc_tip' => true,
@ -695,7 +695,7 @@ $woocommerce_settings['catalog'] = apply_filters('woocommerce_catalog_settings',
'name' => __( 'Decimal Separator', 'woocommerce' ),
'desc' => __( 'This sets the decimal separator of displayed prices.', 'woocommerce' ),
'id' => 'woocommerce_price_decimal_sep',
'css' => 'width:30px;',
'css' => 'width:50px;',
'std' => '.',
'type' => 'text',
'desc_tip' => true,
@ -705,10 +705,14 @@ $woocommerce_settings['catalog'] = apply_filters('woocommerce_catalog_settings',
'name' => __( 'Number of Decimals', 'woocommerce' ),
'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'woocommerce' ),
'id' => 'woocommerce_price_num_decimals',
'css' => 'width:30px;',
'css' => 'width:50px;',
'std' => '2',
'type' => 'text',
'desc_tip' => true,
'type' => 'number',
'custom_attributes' => array(
'min' => 0,
'step' => 1
)
),
array(
@ -791,8 +795,12 @@ $woocommerce_settings['inventory'] = apply_filters('woocommerce_inventory_settin
'name' => __( 'Low Stock Threshold', 'woocommerce' ),
'desc' => '',
'id' => 'woocommerce_notify_low_stock_amount',
'css' => 'width:30px;',
'type' => 'text',
'css' => 'width:50px;',
'type' => 'number',
'custom_attributes' => array(
'min' => 0,
'step' => 1
),
'std' => '2'
),
@ -800,8 +808,12 @@ $woocommerce_settings['inventory'] = apply_filters('woocommerce_inventory_settin
'name' => __( 'Out Of Stock Threshold', 'woocommerce' ),
'desc' => '',
'id' => 'woocommerce_notify_no_stock_amount',
'css' => 'width:30px;',
'type' => 'text',
'css' => 'width:50px;',
'type' => 'number',
'custom_attributes' => array(
'min' => 0,
'step' => 1
),
'std' => '0'
),
@ -1044,7 +1056,10 @@ $woocommerce_settings['email'] = apply_filters('woocommerce_email_settings', arr
'name' => __( '"From" Email Address', 'woocommerce' ),
'desc' => '',
'id' => 'woocommerce_email_from_address',
'type' => 'text',
'type' => 'email',
'custom_attributes' => array(
'multiple' => 'multiple'
),
'css' => 'min-width:300px;',
'std' => get_option('admin_email')
),

View File

@ -89,7 +89,7 @@ function woocommerce_tax_rates_setting() {
<input type="text" class="text" value="<?php if (isset($rate['label'])) echo esc_attr( $rate['label'] ); ?>" name="tax_label[<?php echo $i; ?>]" title="<?php _e( 'Label', 'woocommerce' ); ?>" size="16" />
</td>
<td class="rate">
<input type="text" class="text" value="<?php echo esc_attr( $rate['rate'] ); ?>" name="tax_rate[<?php echo $i; ?>]" title="<?php _e( 'Rate', 'woocommerce' ); ?>" placeholder="<?php _e( 'Rate', 'woocommerce' ); ?>" maxlength="8" size="4" />%
<input type="number" step="any" min="0" class="text" value="<?php echo esc_attr( $rate['rate'] ); ?>" name="tax_rate[<?php echo $i; ?>]" title="<?php _e( 'Rate', 'woocommerce' ); ?>" placeholder="<?php _e( 'Rate', 'woocommerce' ); ?>" maxlength="8" size="4" />%
</td>
<td class="compound">
<input type="checkbox" class="checkbox" name="tax_compound[<?php echo $i; ?>]" <?php if (isset($rate['compound'])) checked($rate['compound'], 'yes'); ?> />
@ -175,7 +175,7 @@ function woocommerce_tax_rates_setting() {
<input type="text" class="text" value="<?php if (isset($rate['label'])) echo esc_attr( $rate['label'] ); ?>" name="local_tax_label[<?php echo $i; ?>]" title="<?php _e( 'Label', 'woocommerce' ); ?>" size="16" />
</td>
<td class="rate">
<input type="text" class="text" value="<?php echo esc_attr( $rate['rate'] ); ?>" name="local_tax_rate[<?php echo $i; ?>]" title="<?php _e( 'Rate', 'woocommerce' ); ?>" placeholder="<?php _e( 'Rate', 'woocommerce' ); ?>" maxlength="8" size="4" />%
<input type="number" step="any" min="0" class="text" value="<?php echo esc_attr( $rate['rate'] ); ?>" name="local_tax_rate[<?php echo $i; ?>]" title="<?php _e( 'Rate', 'woocommerce' ); ?>" placeholder="<?php _e( 'Rate', 'woocommerce' ); ?>" maxlength="8" size="4" />%
</td>
<td class="compound">
<input type="checkbox" class="checkbox" name="local_tax_compound[<?php echo $i; ?>]" <?php if (isset($rate['compound'])) checked($rate['compound'], 'yes'); ?> />

View File

@ -183,7 +183,7 @@ function woocommerce_admin_install_notices() {
include( 'includes/notice-install.php' );
} elseif ( ! isset( $_GET['page'] ) || $_GET['page'] != 'woocommerce' ) {
} elseif ( ! isset( $_GET['page'] ) || $_GET['page'] != 'woocommerce_settings' ) {
include( 'includes/notice-installed.php' );

View File

@ -373,7 +373,9 @@ if ( ! function_exists( 'woocommerce_settings' ) ) {
endswitch;
?>
<p class="submit">
<?php if ( ! isset( $GLOBALS['hide_save_button'] ) ) : ?>
<input name="save" class="button-primary" type="submit" value="<?php _e( 'Save changes', 'woocommerce' ); ?>" />
<?php endif; ?>
<input type="hidden" name="subtab" id="last_tab" />
</p>
</form>
@ -509,6 +511,13 @@ function woocommerce_admin_fields( $options ) {
if ( ! isset( $value['desc'] ) ) $value['desc'] = '';
if ( ! isset( $value['desc_tip'] ) ) $value['desc_tip'] = false;
// Custom attribute handling
$custom_attributes = array();
if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) )
foreach ( $value['custom_attributes'] as $attribute => $attribute_value )
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
if ( $value['desc_tip'] === true ) {
$description = '<img class="help_tip" data-tip="' . esc_attr( $value['desc'] ) . '" src="' . $woocommerce->plugin_url() . '/assets/images/help.png" />';
} elseif ( $value['desc_tip'] ) {
@ -530,11 +539,13 @@ function woocommerce_admin_fields( $options ) {
if ( isset($value['id'] ) && $value['id'] ) do_action( 'woocommerce_settings_' . sanitize_title( $value['id'] ) . '_after' );
break;
case 'text':
case 'email':
case 'number':
?><tr valign="top">
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['name'] ); ?></label>
</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'] ); } ?>" /> <?php echo $description; ?></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 implode( ' ', $custom_attributes ); ?> /> <?php echo $description; ?></td>
</tr><?php
break;
case 'color' :
@ -542,7 +553,7 @@ function woocommerce_admin_fields( $options ) {
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['name'] ); ?></label>
</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" /> <?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>
<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 implode( ' ', $custom_attributes ); ?> /> <?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' :
@ -564,7 +575,7 @@ function woocommerce_admin_fields( $options ) {
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['name'] ); ?></label>
</th>
<td class="forminp"><select name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>" class="<?php if (isset($value['class'])) echo $value['class']; ?>">
<td class="forminp"><select name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" style="<?php echo esc_attr( $value['css'] ); ?>" class="<?php if (isset($value['class'])) echo $value['class']; ?>" <?php echo implode( ' ', $custom_attributes ); ?>>
<?php
foreach ($value['options'] as $key => $val) {
$_current = get_option( $value['id'] );
@ -609,7 +620,7 @@ function woocommerce_admin_fields( $options ) {
?>
<legend class="screen-reader-text"><span><?php echo esc_html( $value['name'] ) ?></span></legend>
<label for="<?php echo $value['id'] ?>">
<input name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" type="checkbox" value="1" <?php checked(get_option($value['id']), 'yes'); ?> />
<input name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" type="checkbox" value="1" <?php checked(get_option($value['id']), 'yes'); ?> <?php echo implode( ' ', $custom_attributes ); ?> />
<?php echo wp_kses_post( $value['desc'] ) ?></label> <?php if ( $value['desc_tip'] ) echo $description; ?><br />
<?php
@ -634,7 +645,7 @@ function woocommerce_admin_fields( $options ) {
<td class="forminp">
<?php if ( ! empty( $value['desc'] ) ) echo '<p style="margin-top:0;">' . wp_kses_post( $value['desc'] ) . '</p>'; ?>
<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>
<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 echo implode( ' ', $custom_attributes ); ?>><?php if (false !== get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea( $value['std'] ); ?></textarea>
</td>
</tr><?php
break;

View File

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

View File

@ -41,6 +41,7 @@
a.button-primary {
font-size: 16px !important;
line-height: 16px !important;
height: auto !important;
margin: 0 5px 0 0;
padding: 6px 15px;
vertical-align: middle;

File diff suppressed because one or more lines are too long

View File

@ -186,9 +186,11 @@ mark.amount {
background: transparent none;
color: inherit;
}
input.wc-error {
color: #D8000C;
background-color: #FFBABA;
.postbox, .woocommerce {
input:invalid {
border: 1px solid #cc010b;
background: #ffebe8 url(../images/icons/invalid.png) right center no-repeat;
}
}
/* Status page */
@ -291,6 +293,9 @@ table.wc_status_table {
/* Orders */
.tablenav .actions {
overflow: visible;
}
.alignleft.actions .chzn-container-single {
display: inline-block;
vertical-align: middle;

File diff suppressed because one or more lines are too long

View File

@ -622,6 +622,11 @@ p.demo_store {
overflow:hidden;
zoom: 1;
/* Disable input[type=number] buttons until the world is ready */
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
display:none;
}
input.qty {
width: 40px;
height: 28px;
@ -636,6 +641,11 @@ p.demo_store {
.border_radius_left(2px);
}
/* Hide buttons for opera */
noindex:-o-prefocus, input[type=number] {
padding-right: 1.2em;
}
.plus, .minus {
display:block;
padding: 0;

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

View File

@ -3,21 +3,6 @@
*/
jQuery(function(){
// Live validation
jQuery('body').on(
'keyup',
'.wc_input_price',
function() {
var $this = jQuery(this);
var value = jQuery(this).val();
if ( value !== '' && !jQuery.isNumeric( value ) ) {
$this.addClass('wc-error');
} else {
$this.removeClass('wc-error');
}
}
).keyup();
// Tooltips
jQuery(".tips, .help_tip").tipTip({
'attribute' : 'data-tip',

View File

@ -1,3 +1,3 @@
/**
* WooCommerce Admin JS
*/jQuery(function(){jQuery("body").on("keyup",".wc_input_price",function(){var e=jQuery(this),t=jQuery(this).val();t!==""&&!jQuery.isNumeric(t)?e.addClass("wc-error"):e.removeClass("wc-error")}).keyup();jQuery(".tips, .help_tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200});jQuery("select.availability").change(function(){jQuery(this).val()=="specific"?jQuery(this).closest("tr").next("tr").show():jQuery(this).closest("tr").next("tr").hide()}).change();jQuery(".hide_options_if_checked").each(function(){jQuery(this).find("input:eq(0)").change(function(){jQuery(this).is(":checked")?jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").hide():jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").show()}).change()});jQuery(".show_options_if_checked").each(function(){jQuery(this).find("input:eq(0)").change(function(){jQuery(this).is(":checked")?jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").show():jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").hide()}).change()});jQuery("input#woocommerce_demo_store").change(function(){jQuery(this).is(":checked")?jQuery("#woocommerce_demo_store_notice").closest("tr").show():jQuery("#woocommerce_demo_store_notice").closest("tr").hide()}).change()});
*/jQuery(function(){jQuery(".tips, .help_tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200});jQuery("select.availability").change(function(){jQuery(this).val()=="specific"?jQuery(this).closest("tr").next("tr").show():jQuery(this).closest("tr").next("tr").hide()}).change();jQuery(".hide_options_if_checked").each(function(){jQuery(this).find("input:eq(0)").change(function(){jQuery(this).is(":checked")?jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").hide():jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").show()}).change()});jQuery(".show_options_if_checked").each(function(){jQuery(this).find("input:eq(0)").change(function(){jQuery(this).is(":checked")?jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").show():jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").hide()}).change()});jQuery("input#woocommerce_demo_store").change(function(){jQuery(this).is(":checked")?jQuery("#woocommerce_demo_store_notice").closest("tr").show():jQuery("#woocommerce_demo_store_notice").closest("tr").hide()}).change()});

View File

@ -11,10 +11,18 @@ jQuery(document).ready(function($) {
$(this).closest('form.variations_form').find('.variations select').val('').change();
var $sku = $(this).closest('.product').find('.sku');
var $weight = $(this).closest('.product').find('.product_weight');
var $dimensions = $(this).closest('.product').find('.product_dimensions');
if ( $sku.attr( 'data-o_sku' ) )
$sku.text( $sku.attr( 'data-o_sku' ) );
if ( $weight.attr( 'data-o_weight' ) )
$weight.text( $weight.attr( 'data-o_weight' ) );
if ( $dimensions.attr( 'data-o_dimensions' ) )
$dimensions.text( $dimensions.attr( 'data-o_dimensions' ) );
return false;
} )
@ -279,16 +287,36 @@ jQuery(document).ready(function($) {
var $single_variation_wrap = $variation_form.find('.single_variation_wrap');
var $sku = $product.find('.product_meta').find('.sku');
var $weight = $product.find('.product_weight');
var $dimensions = $product.find('.product_dimensions');
if ( ! $sku.attr( 'data-o_sku' ) )
$sku.attr( 'data-o_sku', $sku.text() );
if ( ! $weight.attr( 'data-o_weight' ) )
$weight.attr( 'data-o_weight', $weight.text() );
if ( ! $dimensions.attr( 'data-o_dimensions' ) )
$dimensions.attr( 'data-o_dimensions', $dimensions.text() );
if ( variation.sku ) {
$sku.text( variation.sku );
} else {
$sku.text( $sku.attr( 'data-o_sku' ) );
}
if ( variation.weight ) {
$weight.text( variation.weight );
} else {
$weight.text( $weight.attr( 'data-o_weight' ) );
}
if ( variation.dimensions ) {
$dimensions.text( variation.dimensions );
} else {
$dimensions.text( $dimensions.attr( 'data-o_dimensions' ) );
}
$single_variation_wrap.find('.quantity').show();
if ( ! variation.is_in_stock && ! variation.backorders_allowed ) {
@ -296,14 +324,14 @@ jQuery(document).ready(function($) {
}
if ( variation.min_qty )
$single_variation_wrap.find('input[name=quantity]').attr( 'data-min', variation.min_qty ).val( variation.min_qty );
$single_variation_wrap.find('input[name=quantity]').attr( 'min', variation.min_qty ).val( variation.min_qty );
else
$single_variation_wrap.find('input[name=quantity]').removeAttr('data-min');
$single_variation_wrap.find('input[name=quantity]').removeAttr('min');
if ( variation.max_qty )
$single_variation_wrap.find('input[name=quantity]').attr('data-max', variation.max_qty);
$single_variation_wrap.find('input[name=quantity]').attr('max', variation.max_qty);
else
$single_variation_wrap.find('input[name=quantity]').removeAttr('data-max');
$single_variation_wrap.find('input[name=quantity]').removeAttr('max');
if ( variation.is_sold_individually == 'yes' ) {
$single_variation_wrap.find('input[name=quantity]').val('1');

File diff suppressed because one or more lines are too long

View File

@ -11,47 +11,49 @@ jQuery(document).ready(function($) {
// Target quantity inputs on product pages
$("input.qty:not(.product-quantity input.qty)").each(function(){
var min = parseInt($(this).attr('data-min'));
var min = parseFloat( $(this).attr('min') );
if (min && min > 1 && parseInt($(this).val()) < min) {
if ( min && min > 0 && parseFloat( $(this).val() ) < min ) {
$(this).val( min );
}
});
$(".plus").live('click', function() {
var currentVal = parseInt($(this).prev(".qty").val());
$(".plus, .minus").live('click', function() {
// Get values
var $qty = $(this).closest('.quantity').find(".qty");
var currentVal = parseFloat( $qty.val() );
var max = parseFloat( $qty.attr('max') );
var min = parseFloat( $qty.attr('min') );
var step = $qty.attr('step');
// Format values
if ( ! currentVal || currentVal == "" || currentVal == "NaN" ) currentVal = 0;
$qty = $(this).prev(".qty");
var max = parseInt($qty.attr('data-max'));
if ( max == "" || max == "NaN" ) max = '';
if ( min == "" || min == "NaN" ) min = 0;
if ( step == 'any' || step == "" || parseFloat( step ) == "NaN" ) step = 1;
// Change the value
if ( $(this).is('.plus') ) {
if ( max && ( max == currentVal || currentVal > max ) ) {
$qty.val( max );
} else {
$qty.val(currentVal + 1);
$qty.val( currentVal + parseFloat( step ) );
}
$qty.trigger('change');
});
$(".minus").live('click', function() {
var currentVal = parseInt($(this).next(".qty").val());
if (!currentVal || currentVal=="" || currentVal == "NaN") currentVal = 0;
$qty = $(this).next(".qty");
var min = parseInt($qty.attr('data-min'));
if (min=="" || min == "NaN") min = 0;
} else {
if ( min && ( min==currentVal || currentVal < min ) ) {
$qty.val( min );
} else if ( currentVal > 0 ) {
$qty.val(currentVal - 1);
$qty.val( currentVal - parseFloat( step ) );
}
}
// Trigger change event
$qty.trigger('change');
});

View File

@ -1 +1 @@
jQuery(document).ready(function(e){e("select.orderby").change(function(){e(this).closest("form").submit()});e("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('<input type="button" value="+" class="plus" />').prepend('<input type="button" value="-" class="minus" />');e("input.qty:not(.product-quantity input.qty)").each(function(){var t=parseInt(e(this).attr("data-min"));t&&t>1&&parseInt(e(this).val())<t&&e(this).val(t)});e(".plus").live("click",function(){var t=parseInt(e(this).prev(".qty").val());if(!t||t==""||t=="NaN")t=0;$qty=e(this).prev(".qty");var n=parseInt($qty.attr("data-max"));if(n==""||n=="NaN")n="";n&&(n==t||t>n)?$qty.val(n):$qty.val(t+1);$qty.trigger("change")});e(".minus").live("click",function(){var t=parseInt(e(this).next(".qty").val());if(!t||t==""||t=="NaN")t=0;$qty=e(this).next(".qty");var n=parseInt($qty.attr("data-min"));if(n==""||n=="NaN")n=0;n&&(n==t||t<n)?$qty.val(n):t>0&&$qty.val(t-1);$qty.trigger("change")});var t=woocommerce_params.countries.replace(/&quot;/g,'"'),n=e.parseJSON(t);e("select.country_to_state").change(function(){var t=e(this).val(),r=e(this).closest("div").find("#billing_state, #shipping_state, #calc_shipping_state"),i=r.parent(),s=r.attr("name"),o=r.attr("id"),u=r.val();if(n[t])n[t].length==0?i.fadeOut(200,function(){r.parent().find(".chzn-container").remove();r.replaceWith('<input type="hidden" class="hidden" name="'+s+'" id="'+o+'" value="" />');e("body").trigger("country_to_state_changed",[t,e(this).closest("div")])}):i.fadeOut(200,function(){var a="",f=n[t];for(var l in f)a=a+'<option value="'+l+'">'+f[l]+"</option>";if(r.is("input")){r.replaceWith('<select name="'+s+'" id="'+o+'" class="state_select"></select>');r=e(this).closest("div").find("#billing_state, #shipping_state, #calc_shipping_state")}r.html('<option value="">'+woocommerce_params.select_state_text+"</option>"+a);r.val(u);e("body").trigger("country_to_state_changed",[t,e(this).closest("div")]);i.fadeIn(500)});else if(r.is("select"))i.fadeOut(200,function(){i.find(".chzn-container").remove();r.replaceWith('<input type="text" class="input-text" name="'+s+'" id="'+o+'" />');e("body").trigger("country_to_state_changed",[t,e(this).closest("div")]);i.fadeIn(500)});else if(r.is(".hidden")){i.find(".chzn-container").remove();r.replaceWith('<input type="text" class="input-text" name="'+s+'" id="'+o+'" />');e("body").trigger("country_to_state_changed",[t,e(this).closest("div")]);i.delay(200).fadeIn(500)}e("body").delay(200).trigger("country_to_state_changing",[t,e(this).closest("div")])})});
jQuery(document).ready(function(e){e("select.orderby").change(function(){e(this).closest("form").submit()});e("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('<input type="button" value="+" class="plus" />').prepend('<input type="button" value="-" class="minus" />');e("input.qty:not(.product-quantity input.qty)").each(function(){var t=parseFloat(e(this).attr("min"));t&&t>0&&parseFloat(e(this).val())<t&&e(this).val(t)});e(".plus, .minus").live("click",function(){var t=e(this).closest(".quantity").find(".qty"),n=parseFloat(t.val()),r=parseFloat(t.attr("max")),i=parseFloat(t.attr("min")),s=t.attr("step");if(!n||n==""||n=="NaN")n=0;if(r==""||r=="NaN")r="";if(i==""||i=="NaN")i=0;if(s=="any"||s==""||parseFloat(s)=="NaN")s=1;e(this).is(".plus")?r&&(r==n||n>r)?t.val(r):t.val(n+parseFloat(s)):i&&(i==n||n<i)?t.val(i):n>0&&t.val(n-parseFloat(s));t.trigger("change")});var t=woocommerce_params.countries.replace(/&quot;/g,'"'),n=e.parseJSON(t);e("select.country_to_state").change(function(){var t=e(this).val(),r=e(this).closest("div").find("#billing_state, #shipping_state, #calc_shipping_state"),i=r.parent(),s=r.attr("name"),o=r.attr("id"),u=r.val();if(n[t])n[t].length==0?i.fadeOut(200,function(){r.parent().find(".chzn-container").remove();r.replaceWith('<input type="hidden" class="hidden" name="'+s+'" id="'+o+'" value="" />');e("body").trigger("country_to_state_changed",[t,e(this).closest("div")])}):i.fadeOut(200,function(){var a="",f=n[t];for(var l in f)a=a+'<option value="'+l+'">'+f[l]+"</option>";if(r.is("input")){r.replaceWith('<select name="'+s+'" id="'+o+'" class="state_select"></select>');r=e(this).closest("div").find("#billing_state, #shipping_state, #calc_shipping_state")}r.html('<option value="">'+woocommerce_params.select_state_text+"</option>"+a);r.val(u);e("body").trigger("country_to_state_changed",[t,e(this).closest("div")]);i.fadeIn(500)});else if(r.is("select"))i.fadeOut(200,function(){i.find(".chzn-container").remove();r.replaceWith('<input type="text" class="input-text" name="'+s+'" id="'+o+'" />');e("body").trigger("country_to_state_changed",[t,e(this).closest("div")]);i.fadeIn(500)});else if(r.is(".hidden")){i.find(".chzn-container").remove();r.replaceWith('<input type="text" class="input-text" name="'+s+'" id="'+o+'" />');e("body").trigger("country_to_state_changed",[t,e(this).closest("div")]);i.delay(200).fadeIn(500)}e("body").delay(200).trigger("country_to_state_changing",[t,e(this).closest("div")])})});

View File

@ -727,7 +727,7 @@ class WC_Cart {
function add_to_cart( $product_id, $quantity = 1, $variation_id = '', $variation = '', $cart_item_data = array() ) {
global $woocommerce;
if ( $quantity < 1 ) return false;
if ( $quantity <= 0 ) return false;
// Load cart item data - may be added by other plugins
$cart_item_data = (array) apply_filters( 'woocommerce_add_cart_item_data', $cart_item_data, $product_id, $variation_id );
@ -769,10 +769,10 @@ class WC_Cart {
// Downloadable/virtual qty check
if ( $product_data->is_sold_individually() ) {
$in_cart_quantity = ( $cart_item_key ) ? $this->cart_contents[$cart_item_key]['quantity'] + $quantity : $quantity;
$in_cart_quantity = $cart_item_key ? $this->cart_contents[$cart_item_key]['quantity'] : 0;
// If its greater than 1, its already in the cart
if ( $in_cart_quantity > 1 ) {
// If its greater than 0, its already in the cart
if ( $in_cart_quantity > 0 ) {
$woocommerce->add_error( sprintf('<a href="%s" class="button">%s</a> %s', get_permalink(woocommerce_get_page_id('cart')), __( 'View Cart &rarr;', 'woocommerce' ), __( 'You already have this item in your cart.', 'woocommerce' ) ) );
return false;
}

View File

@ -452,7 +452,7 @@ class WC_Checkout {
// Add line item meta
if ( $item_id ) {
woocommerce_add_order_item_meta( $item_id, '_qty', absint( $values['quantity'] ) );
woocommerce_add_order_item_meta( $item_id, '_qty', apply_filters( 'woocommerce_stock_amount', $values['quantity'] ) );
woocommerce_add_order_item_meta( $item_id, '_tax_class', $_product->get_tax_class() );
woocommerce_add_order_item_meta( $item_id, '_product_id', $values['product_id'] );
woocommerce_add_order_item_meta( $item_id, '_variation_id', $values['variation_id'] );

View File

@ -557,6 +557,16 @@ class WC_Order {
}
/**
* get_order_total function. Alias for get_total()
*
* @access public
* @return void
*/
function get_order_total() {
return $this->get_total();
}
/**
* Gets shipping method title.
*

View File

@ -238,7 +238,7 @@ class WC_Product_Variation extends WC_Product {
* @return int
*/
function get_variation_id() {
return (int) $this->variation_id;
return absint( $this->variation_id );
}
/**
@ -335,7 +335,7 @@ class WC_Product_Variation extends WC_Product {
}
return $this->stock;
return apply_filters( 'woocommerce_stock_amount', $this->stock );
}
} else {
return parent::reduce_stock( $by );
@ -365,7 +365,7 @@ class WC_Product_Variation extends WC_Product {
if ( $this->is_in_stock() )
update_post_meta( $this->id, '_stock_status', 'instock' );
return $this->stock;
return apply_filters( 'woocommerce_stock_amount', $this->stock );
endif;
else :
return parent::increase_stock( $by );
@ -411,7 +411,7 @@ class WC_Product_Variation extends WC_Product {
$this->variation_shipping_class_id = parent::get_shipping_class_id();
}
return (int) $this->variation_shipping_class_id;
return absint( $this->variation_shipping_class_id );
}
/**

View File

@ -132,7 +132,7 @@ class WC_Product {
*/
function __construct( $id ) {
$this->id = (int) $id;
$this->id = absint( $id );
$this->product_custom_fields = get_post_custom( $this->id );
@ -226,7 +226,7 @@ class WC_Product {
}
}
return (int) $this->total_stock;
return apply_filters( 'woocommerce_stock_amount', $this->total_stock );
}
/**
@ -302,7 +302,7 @@ class WC_Product {
$woocommerce->clear_product_transients( $this->id ); // Clear transient
return $this->stock;
return apply_filters( 'woocommerce_stock_amount', $this->stock );
endif;
}
@ -329,7 +329,7 @@ class WC_Product {
$woocommerce->clear_product_transients( $this->id ); // Clear transient
return $this->stock;
return apply_filters( 'woocommerce_stock_amount', $this->stock );
endif;
}
@ -621,10 +621,10 @@ class WC_Product {
* @return int
*/
function get_stock_quantity() {
if ( get_option( 'woocommerce_manage_stock' ) == 'no' )
if ( get_option( 'woocommerce_manage_stock' ) == 'no' || ! $this->managing_stock() )
return '';
return (int) $this->stock;
return apply_filters( 'woocommerce_stock_amount', $this->stock );
}
@ -1184,7 +1184,7 @@ class WC_Product {
else
$this->shipping_class_id = 0;
endif;
return (int) $this->shipping_class_id;
return absint( $this->shipping_class_id );
}
@ -1520,6 +1520,8 @@ class WC_Product {
'price_html' => $this->min_variation_price != $this->max_variation_price ? '<span class="price">' . $variation->get_price_html() . '</span>' : '',
'availability_html' => $availability_html,
'sku' => $variation->get_sku(),
'weight' => $variation->get_weight() . ' ' . esc_attr( get_option('woocommerce_weight_unit' ) ),
'dimensions' => $variation->get_dimensions(),
'min_qty' => 1,
'max_qty' => $this->backorders_allowed() ? '' : $variation->stock,
'backorders_allowed' => $this->backorders_allowed(),

View File

@ -166,6 +166,8 @@ class WC_Settings_API {
if ( method_exists( $this, 'generate_' . $v['type'] . '_html' ) ) {
$html .= $this->{'generate_' . $v['type'] . '_html'}( $k, $v );
} else {
$html .= $this->{'generate_text_html'}( $k, $v );
}
}
@ -190,6 +192,14 @@ class WC_Settings_API {
$data['class'] = isset( $data['class'] ) ? $data['class'] : '';
$data['css'] = isset( $data['css'] ) ? $data['css'] : '';
$data['placeholder'] = isset( $data['placeholder'] ) ? $data['placeholder'] : '';
$data['type'] = isset( $data['type'] ) ? $data['type'] : 'text';
// Custom attribute handling
$custom_attributes = array();
if ( ! empty( $data['custom_attributes'] ) && is_array( $data['custom_attributes'] ) )
foreach ( $data['custom_attributes'] as $attribute => $attribute_value )
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
$html .= '<tr valign="top">' . "\n";
$html .= '<th scope="row" class="titledesc">';
@ -198,7 +208,7 @@ class WC_Settings_API {
$html .= '<td class="forminp">' . "\n";
$html .= '<fieldset><legend class="screen-reader-text"><span>' . wp_kses_post( $data['title'] ) . '</span></legend>' . "\n";
$value = ( isset( $this->settings[ $key ] ) ) ? esc_attr( $this->settings[ $key ] ) : '';
$html .= '<input class="input-text regular-input ' . esc_attr( $data['class'] ) . '" type="text" name="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" id="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" style="' . esc_attr( $data['css'] ) . '" value="' . $value . '" placeholder="' . esc_attr( $data['placeholder'] ) . '" ' . disabled( $data['disabled'], true, false ) . ' />';
$html .= '<input class="input-text regular-input ' . esc_attr( $data['class'] ) . '" type="' . esc_attr( $data['type'] ) . '" name="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" id="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" style="' . esc_attr( $data['css'] ) . '" value="' . $value . '" placeholder="' . esc_attr( $data['placeholder'] ) . '" ' . disabled( $data['disabled'], true, false ) . ' ' . implode( ' ', $custom_attributes ) . ' />';
if ( isset( $data['description'] ) && $data['description'] != '' ) { $html .= ' <p class="description">' . wp_kses_post( $data['description'] ) . '</p>' . "\n"; }
$html .= '</fieldset>';
$html .= '</td>' . "\n";
@ -224,6 +234,13 @@ class WC_Settings_API {
$data['class'] = isset( $data['class'] ) ? $data['class'] : '';
$data['css'] = isset( $data['css'] ) ? $data['css'] : '';
// Custom attribute handling
$custom_attributes = array();
if ( ! empty( $data['custom_attributes'] ) && is_array( $data['custom_attributes'] ) )
foreach ( $data['custom_attributes'] as $attribute => $attribute_value )
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
$html .= '<tr valign="top">' . "\n";
$html .= '<th scope="row" class="titledesc">';
$html .= '<label for="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '">' . wp_kses_post( $data['title'] ) . '</label>';
@ -231,7 +248,7 @@ class WC_Settings_API {
$html .= '<td class="forminp">' . "\n";
$html .= '<fieldset><legend class="screen-reader-text"><span>' . wp_kses_post( $data['title'] ) . '</span></legend>' . "\n";
$value = ( isset( $this->settings[ $key ] ) ) ? esc_attr( $this->settings[ $key ] ) : '';
$html .= '<input class="input-text regular-input ' . esc_attr( $data['class'] ) . '" type="password" name="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" id="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" style="' . esc_attr( $data['css'] ) . '" value="' . $value . '" ' . disabled( $data['disabled'], true, false ) . ' />';
$html .= '<input class="input-text regular-input ' . esc_attr( $data['class'] ) . '" type="password" name="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" id="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" style="' . esc_attr( $data['css'] ) . '" value="' . $value . '" ' . disabled( $data['disabled'], true, false ) . ' ' . implode( ' ', $custom_attributes ) . ' />';
if ( isset( $data['description'] ) && $data['description'] != '' ) { $html .= ' <p class="description">' . esc_attr( $data['description'] ) . '</p>' . "\n"; }
$html .= '</fieldset>';
$html .= '</td>' . "\n";
@ -258,6 +275,13 @@ class WC_Settings_API {
$data['class'] = isset( $data['class'] ) ? $data['class'] : '';
$data['css'] = isset( $data['css'] ) ? $data['css'] : '';
// Custom attribute handling
$custom_attributes = array();
if ( ! empty( $data['custom_attributes'] ) && is_array( $data['custom_attributes'] ) )
foreach ( $data['custom_attributes'] as $attribute => $attribute_value )
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
$html .= '<tr valign="top">' . "\n";
$html .= '<th scope="row" class="titledesc">';
$html .= '<label for="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '">' . wp_kses_post( $data['title'] ) . '</label>';
@ -265,7 +289,7 @@ class WC_Settings_API {
$html .= '<td class="forminp">' . "\n";
$html .= '<fieldset><legend class="screen-reader-text"><span>' . wp_kses_post( $data['title'] ) . '</span></legend>' . "\n";
$value = ( isset( $this->settings[ $key ] ) ) ? esc_textarea( $this->settings[ $key ] ) : '';
$html .= '<textarea rows="3" cols="20" class="input-text wide-input ' . esc_attr( $data['class'] ) . '" name="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" id="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" style="' . esc_attr( $data['css'] ) . '" ' . disabled( $data['disabled'], true, false ) . '>' . $value . '</textarea>';
$html .= '<textarea rows="3" cols="20" class="input-text wide-input ' . esc_attr( $data['class'] ) . '" name="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" id="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" style="' . esc_attr( $data['css'] ) . '" ' . disabled( $data['disabled'], true, false ) . ' ' . implode( ' ', $custom_attributes ) . '>' . $value . '</textarea>';
if ( isset( $data['description'] ) && $data['description'] != '' ) { $html .= ' <p class="description">' . wp_kses_post( $data['description'] ) . '</p>' . "\n"; }
$html .= '</fieldset>';
$html .= '</td>' . "\n";
@ -292,12 +316,19 @@ class WC_Settings_API {
$data['class'] = isset( $data['class'] ) ? $data['class'] : '';
$data['css'] = isset( $data['css'] ) ? $data['css'] : '';
// Custom attribute handling
$custom_attributes = array();
if ( ! empty( $data['custom_attributes'] ) && is_array( $data['custom_attributes'] ) )
foreach ( $data['custom_attributes'] as $attribute => $attribute_value )
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
$html .= '<tr valign="top">' . "\n";
$html .= '<th scope="row" class="titledesc">' . $data['title'] . '</th>' . "\n";
$html .= '<td class="forminp">' . "\n";
$html .= '<fieldset><legend class="screen-reader-text"><span>' . wp_kses_post( $data['title'] ) . '</span></legend>' . "\n";
$html .= '<label for="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '">';
$html .= '<input style="' . esc_attr( $data['css'] ) . '" name="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" id="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" type="checkbox" value="1" ' . checked( $this->settings[$key], 'yes', false ) . ' class="' . esc_attr( $data['class'] ).'" ' . disabled( $data['disabled'], true, false ) . ' /> ' . wp_kses_post( $data['label'] ) . '</label><br />' . "\n";
$html .= '<input style="' . esc_attr( $data['css'] ) . '" name="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" id="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" type="checkbox" value="1" ' . checked( $this->settings[$key], 'yes', false ) . ' class="' . esc_attr( $data['class'] ).'" ' . disabled( $data['disabled'], true, false ) . ' ' . implode( ' ', $custom_attributes ) . ' /> ' . wp_kses_post( $data['label'] ) . '</label><br />' . "\n";
if ( isset( $data['description'] ) && $data['description'] != '' ) { $html .= ' <p class="description">' . wp_kses_post( $data['description'] ) . '</p>' . "\n"; }
$html .= '</fieldset>';
$html .= '</td>' . "\n";
@ -324,13 +355,20 @@ class WC_Settings_API {
$data['class'] = isset( $data['class'] ) ? $data['class'] : '';
$data['css'] = isset( $data['css'] ) ? $data['css'] : '';
// Custom attribute handling
$custom_attributes = array();
if ( ! empty( $data['custom_attributes'] ) && is_array( $data['custom_attributes'] ) )
foreach ( $data['custom_attributes'] as $attribute => $attribute_value )
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
$html .= '<tr valign="top">' . "\n";
$html .= '<th scope="row" class="titledesc">';
$html .= '<label for="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '">' . wp_kses_post( $data['title'] ) . '</label>';
$html .= '</th>' . "\n";
$html .= '<td class="forminp">' . "\n";
$html .= '<fieldset><legend class="screen-reader-text"><span>' . wp_kses_post( $data['title'] ) . '</span></legend>' . "\n";
$html .= '<select name="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" id="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" style="' . esc_attr( $data['css'] ) . '" class="select ' .esc_attr( $data['class'] ) . '" ' . disabled( $data['disabled'], true, false ) . '>';
$html .= '<select name="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" id="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" style="' . esc_attr( $data['css'] ) . '" class="select ' .esc_attr( $data['class'] ) . '" ' . disabled( $data['disabled'], true, false ) . ' ' . implode( ' ', $custom_attributes ) . '>';
foreach ($data['options'] as $option_key => $option_value) :
$html .= '<option value="' . esc_attr( $option_key ) . '" '.selected($option_key, esc_attr($this->settings[$key]), false).'>' . esc_attr( $option_value ) . '</option>';
@ -363,13 +401,20 @@ class WC_Settings_API {
$data['class'] = isset( $data['class'] ) ? $data['class'] : '';
$data['css'] = isset( $data['css'] ) ? $data['css'] : '';
// Custom attribute handling
$custom_attributes = array();
if ( ! empty( $data['custom_attributes'] ) && is_array( $data['custom_attributes'] ) )
foreach ( $data['custom_attributes'] as $attribute => $attribute_value )
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
$html .= '<tr valign="top">' . "\n";
$html .= '<th scope="row" class="titledesc">';
$html .= '<label for="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '">' . wp_kses_post( $data['title'] ) . '</label>';
$html .= '</th>' . "\n";
$html .= '<td class="forminp">' . "\n";
$html .= '<fieldset><legend class="screen-reader-text"><span>' . wp_kses_post( $data['title'] ) . '</span></legend>' . "\n";
$html .= '<select multiple="multiple" style="' . esc_attr( $data['css'] ) . '" class="multiselect ' . esc_attr( $data['class'] ) . '" name="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '[]" id="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" ' . disabled( $data['disabled'], true, false ) . '>';
$html .= '<select multiple="multiple" style="' . esc_attr( $data['css'] ) . '" class="multiselect ' . esc_attr( $data['class'] ) . '" name="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '[]" id="' . esc_attr( $this->plugin_id . $this->id . '_' . $key ) . '" ' . disabled( $data['disabled'], true, false ) . ' ' . implode( ' ', $custom_attributes ) . '>';
foreach ( $data['options'] as $option_key => $option_value) {
$html .= '<option value="' . esc_attr( $option_key ) . '" ';

View File

@ -58,7 +58,7 @@ class WC_Email_Customer_Completed_Order extends WC_Email {
$this->recipient = $this->object->billing_email;
$this->find[] = '{order_date}';
$this->replace[] = date_i18n( __( 'jS F Y', 'woocommerce' ), strtotime( $this->object->order_date ) );
$this->replace[] = date_i18n( woocommerce_date_format(), strtotime( $this->object->order_date ) );
$this->find[] = '{order_number}';
$this->replace[] = $this->object->get_order_number();

View File

@ -58,7 +58,7 @@ class WC_Email_Customer_Invoice extends WC_Email {
$this->recipient = $this->object->billing_email;
$this->find[] = '{order_date}';
$this->replace[] = date_i18n( __( 'jS F Y', 'woocommerce' ), strtotime( $this->object->order_date ) );
$this->replace[] = date_i18n( woocommerce_date_format(), strtotime( $this->object->order_date ) );
$this->find[] = '{order_number}';
$this->replace[] = $this->object->get_order_number();

View File

@ -67,7 +67,7 @@ class WC_Email_Customer_Note extends WC_Email {
$this->customer_note = $customer_note;
$this->find[] = '{order_date}';
$this->replace[] = date_i18n( __( 'jS F Y', 'woocommerce' ), strtotime( $this->object->order_date ) );
$this->replace[] = date_i18n( woocommerce_date_format(), strtotime( $this->object->order_date ) );
$this->find[] = '{order_number}';
$this->replace[] = $this->object->get_order_number();

View File

@ -52,7 +52,7 @@ class WC_Email_Customer_Processing_Order extends WC_Email {
$this->recipient = $this->object->billing_email;
$this->find[] = '{order_date}';
$this->replace[] = date_i18n( __( 'jS F Y', 'woocommerce' ), strtotime( $this->object->order_date ) );
$this->replace[] = date_i18n( woocommerce_date_format(), strtotime( $this->object->order_date ) );
$this->find[] = '{order_number}';
$this->replace[] = $this->object->get_order_number();

View File

@ -60,7 +60,7 @@ class WC_Email_New_Order extends WC_Email {
$this->object = new WC_Order( $order_id );
$this->find[] = '{order_date}';
$this->replace[] = date_i18n( __( 'jS F Y', 'woocommerce' ), strtotime( $this->object->order_date ) );
$this->replace[] = date_i18n( woocommerce_date_format(), strtotime( $this->object->order_date ) );
$this->find[] = '{order_number}';
$this->replace[] = $this->object->get_order_number();

View File

@ -139,7 +139,7 @@ class WC_Paypal extends WC_Payment_Gateway {
),
'email' => array(
'title' => __( 'PayPal Email', 'woocommerce' ),
'type' => 'text',
'type' => 'email',
'description' => __( 'Please enter your PayPal email address; this is needed in order to take payment.', 'woocommerce' ),
'default' => ''
),

View File

@ -78,7 +78,7 @@ if(!class_exists('ShareYourCartWordpressPlugin',false)){
*/
protected function getAdminEmail(){
return get_settings('admin_email');
return get_option('admin_email');
}
/**

View File

@ -22,26 +22,10 @@ p.submit .button-primary{
padding: 8px 10px;
}
.form-table a{
color: #21759B;
font-weight: normal;
}
.api-link {
color: #464646;
font-weight: normal;
text-decoration: none;
}
.api-status {
float: left;
}
.api-link:hover{
color: #d54e21;
font-weight: normal;
}
.syc-configuration {
width: 60%;
}

View File

@ -1,9 +1,8 @@
<?php if ( ! class_exists( 'ShareYourCartBase', false ) ) die( 'Access Denied' ); ?>
<script type="text/javascript">
if(_gaq) _gaq.push(['_trackPageview', '/admin/create-view']);
</script>
<?php echo SyC::t('sdk','Create a ShareYourCart account'); ?>
<form method="POST">
<form method="post">
<table>
<tr>
<td>
@ -23,14 +22,13 @@
</tr>
<tr>
<td colspan="2">
<input class="buttonCheckbox" name="syc-terms-agreement" id="syc-terms-agreement" <?php if( $_SERVER['REQUEST_METHOD'] !== 'POST' || isset($_POST['syc-terms-agreement'])){ echo 'checked="checked"'; } ?> type="checkbox" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/create-view/toogle-terms-agreement-click']);"><label for="syc-terms-agreement"><?php echo SyC::t('sdk','I agree with the {brand} terms & conditions',array('{brand}' => '<a href="http://www.shareyourcart.com/terms" target="_blank" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/create-view/logo-terms-click\']);">ShareYourCart</a>')); ?></label>
<input class="buttonCheckbox" name="syc-terms-agreement" id="syc-terms-agreement" <?php if( $_SERVER['REQUEST_METHOD'] !== 'POST' || isset($_POST['syc-terms-agreement'])){ echo 'checked="checked"'; } ?> type="checkbox"><label for="syc-terms-agreement"><?php echo SyC::t('sdk','I agree with the {brand} terms & conditions',array('{brand}' => '<a href="http://www.shareyourcart.com/terms" target="_blank">ShareYourCart</a>')); ?></label>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="syc-create-account" value="<?php echo SyC::t('sdk','Create account'); ?>" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/create-view/save-click']);"/>
<input type="submit" class="button" name="syc-create-account" value="<?php echo SyC::t('sdk','Create account'); ?>" />
</td>
</tr>
</table>
<?php echo $html;?>
</form>

View File

@ -1,7 +1,5 @@
<?php if ( ! class_exists( 'ShareYourCartBase', false ) ) die( 'Access Denied' ); ?>
<script type="text/javascript">
if(_gaq) _gaq.push(['_trackPageview', '/admin/recover-view']);
</script>
<?php echo SyC::t('sdk','Enter the domain and email you used when you created the ShareYourCart account'); ?>
<table>
<tr>
@ -9,7 +7,7 @@
<label for="domain"><?php echo SyC::t('sdk','Domain:'); ?></label>
</td>
<td>
<input type="text" name="domain" id="domain" class="regular-text" value="<?php echo (isset($_POST['domain']) ? $_POST['domain'] : $this->getDomain()); ?>"/>
<input type="text" name="domain" id="domain" class="regular-text" value="<?php echo isset( $_POST['domain'] ) ? $_POST['domain'] : $this->getDomain(); ?>"/>
</td>
</tr>
<tr>
@ -17,12 +15,12 @@
<label for="email"><?php echo SyC::t('sdk','Email:'); ?></label>
</td>
<td>
<input type="text" name="email" id="email" class="regular-text" value="<?php echo (isset($_POST['email']) ? $_POST['email'] : $this->getAdminEmail()); ?>"/>
<input type="text" name="email" id="email" class="regular-text" value="<?php echo isset( $_POST['email'] ) ? $_POST['email'] : $this->getAdminEmail(); ?>"/>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="syc-recover-account" value="<?php echo SyC::t('sdk','Recover my account'); ?>" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/recover-view/save-click']);" />
<input type="submit" class="button" name="syc-recover-account" value="<?php echo SyC::t('sdk','Recover my account'); ?>" />
</td>
</tr>
</table>

View File

@ -0,0 +1,13 @@
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied'); ?>
<script type="text/javascript">
window.onload = function() {
document.getElementById('syc-form').addEventListener('submit', changetext, false);
};
var changetext = function(){
var textarea = document.getElementById('syc_button_textarea').value;
document.getElementById('syc_button_textarea').value = encodeURIComponent(textarea);
}
</script>

View File

@ -1,5 +1,7 @@
<?php if ( ! class_exists( 'ShareYourCartBase', false ) ) die( 'Access Denied' );
$GLOBALS['hide_save_button'] = true;
$wcIntegration = $html; //the object is sent under the $html parameter
//since this is a post, and is related to recovering or creating a new account, perform some special operations
@ -19,30 +21,27 @@ if ($refresh || ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty( $_REQUEST['syc-
}
?>
<script type="text/javascript">
if(_gaq) _gaq.push(['_trackPageview', '/admin-view']);
</script>
<div class="wrap">
<?php if ( $show_header ) : ?>
<?php echo $this->getUpdateNotification(); ?>
<?php if(true || !$this->getClientId() && !$this->getAppKey()): //show the get started message ?>
<?php if ( ! $this->getClientId() && ! $this->getAppKey() ) : //show the get started message ?>
<div id="wc_get_started">
<span class="main"><?php _e('Setup your ShareYourCart account', 'woocommerce'); ?></span>
<span><?php echo $wcIntegration->method_description; ?></span>
<p><a href="<?php echo add_query_arg( 'syc-account', 'create', admin_url( 'admin.php?page=woocommerce&tab=integration&section=shareyourcart' ) ); ?>" class="button button-primary api-link"><?php _e('Create an account', 'woocommerce'); ?></a> <a href="<?php echo add_query_arg( 'syc-account', 'recover', admin_url( 'admin.php?page=woocommerce&tab=integration&section=shareyourcart' ) ); ?>" class="button api-link"><?php _e('Can\'t access your account?', 'woocommerce'); ?></a></p>
<p><a href="<?php echo add_query_arg( 'syc-account', 'create', admin_url( 'admin.php?page=woocommerce&tab=integration&section=shareyourcart' ) ); ?>" class="button button-primary"><?php _e('Create an account', 'woocommerce'); ?></a> <a href="<?php echo add_query_arg( 'syc-account', 'recover', admin_url( 'admin.php?page=woocommerce&tab=integration&section=shareyourcart' ) ); ?>" class="button"><?php _e('Can\'t access your account?', 'woocommerce'); ?></a></p>
</div>
<?php else: ?>
<h3>
<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart" class="shareyourcart-logo" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/logo-click']);">
<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart" class="shareyourcart-logo">
<img src="<?php echo $this->createUrl(dirname(__FILE__).'/../sdk/img/shareyourcart-logo.png'); ?>"/>
</a>
</h3>
<br class="clr" />
<?php echo wpautop( $wcIntegration->method_description );?>
<?php endif; ?>
@ -71,27 +70,20 @@ if ($refresh || ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty( $_REQUEST['syc-
<h3>Account Options</h3>
<div id="acount-options">
<fieldset>
<table class="form-table">
<tr valign="top">
<th class="titledesc" scope="row">
<?php echo SyC::t('sdk','API Status:'); ?>
<?php if($this->isActive()) : ?>
<span class="green"><?php echo SyC::t('sdk','Enabled'); ?></span>
<?php else :?>
<span class="red"><?php echo SyC::t('sdk','Disabled'); ?></span>
<?php endif;?>
<?php if ( $this->isActive() ) echo SyC::t('sdk','Enabled'); else echo SyC::t('sdk','Disabled'); ?>
</th>
<td class="forminp">
<?php if($this->isActive()) : ?>
<input class="button" type="submit" value="<?php echo SyC::t('sdk','Disable'); ?>" name="disable-API" class="api-button" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/disable-click']);" />
<input class="button" type="submit" value="<?php echo SyC::t('sdk','Disable'); ?>" name="disable-API" />
<?php else :?>
<input class="button" type="submit" value="<?php echo SyC::t('sdk','Enable'); ?>" name="enable-API" class="api-button" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/enable-click']);" />
<input class="button" type="submit" value="<?php echo SyC::t('sdk','Enable'); ?>" name="enable-API" />
<?php endif;?>
</td>
</tr>
</table>
<table class="form-table form-table-api" name="shareyourcart_settings">
<tr valign="top">
<th class="titledesc" scope="row"><?php echo SyC::t('sdk','Client ID'); ?></th>
<td class="forminp"><input type="text" name="client_id" id="client_id" class="regular-text" value="<?php echo $this->getClientId(); ?>"/></td>
@ -100,40 +92,23 @@ if ($refresh || ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty( $_REQUEST['syc-
<th class="titledesc" scope="row"><?php echo SyC::t('sdk','App Key'); ?></th>
<td class="forminp"><input type="text" name="app_key" id="app_key" class="regular-text" value="<?php echo $this->getAppKey(); ?>"/></td>
</tr>
<?php if($this->isActive()) : ?>
<tr valign="top">
<td class="titledesc"></td>
<td class="forminp">
<span class="description">
<a href="?<?php echo http_build_query(array_merge($_GET,array('syc-account'=>'recover')),'','&')?>" class="api-link" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/recover-click']);">
<?php echo SyC::t('sdk',"Can't access your account?"); ?></a> <strong><?php echo SyC::t('sdk','or'); ?></strong> <?php echo SyC::t('sdk','New to ShareYourCart&trade;?'); ?> <a href="?<?php echo http_build_query(array_merge($_GET,array('syc-account'=>'create')),'','&')?>" id="account-recovery" class="api-link" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/create-account-click']);"><?php echo SyC::t('sdk','Create an account'); ?>
</a>
</span>
<th class="titledesc" scope="row"><?php echo SyC::t('sdk','Configuration'); ?></th>
<td>
<a href="<?php echo $this->SHAREYOURCART_CONFIGURE; ?>?app_key=<?php echo $this->getAppKey(); ?>&amp;client_id=<?php echo $this->getClientId(); ?>&amp;email=<?php echo $this->getAdminEmail(); ?>" class="button" target="_blank"><?php _e('Configure', 'woocommerce'); ?></a>
<p class="description"><?php echo SyC::t('sdk','You can choose how much of a discount to give (in fixed amount, percentage, or free shipping) and to which social media channels it should it be applied. You can also define what the advertisement should say, so that it fully benefits your sales.'); ?></p>
</td>
</tr>
<?php endif;?>
</table>
<br class="clr">
<div class="submit">
<input type="submit" name="syc-account-form" class="button-primary" value="<?php echo SyC::t('sdk','Save changes'); ?>" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/save-click']);">
<input type="submit" class="button button-primary" name="syc-account-form" value="<?php _e('Save changes', 'woocommerce'); ?>" />
</div>
</fieldset>
</div>
<?php if($this->isActive()): //show the configure part only if it is active ?>
<h3>Configuration</h3>
<fieldset class="syc-configuration">
<p><?php echo SyC::t('sdk','You can choose how much of a discount to give (in fixed amount, percentage, or free shipping) and to which social media channels it should it be applied. You can also define what the advertisement should say, so that it fully benefits your sales.'); ?></p>
<div class="submit">
<a href="<?php echo $this->SHAREYOURCART_CONFIGURE; ?>?app_key=<?php echo $this->getAppKey(); ?>&amp;client_id=<?php echo $this->getClientId(); ?>&amp;email=<?php echo $this->getAdminEmail(); ?>" class="button-primary" target="_blank">
<?php _e('Configure', 'woocommerce'); ?>
</a>
</div>
</fieldset>
<?php endif; //show only if the cart is active ?>
</div>

View File

@ -1,120 +1,102 @@
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied'); ?>
<?php if(!$this->isActive()) return; //if the plugin is not active, do not show this page ?>
<script type="text/javascript">
if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view']);
</script>
<div class="wrap">
<h3>Button options</h3>
<?php if($show_header):?>
<?php echo $this->getUpdateNotification(); ?>
<h2>
<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart" class="shareyourcart-logo" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/logo-click']);">
<img src="<?php echo $this->createUrl(dirname(__FILE__).'/../img/shareyourcart-logo.png'); ?>"/>
</a>
<div class="syc-slogan"><?php echo SyC::t('sdk','Increase your social media exposure by 10%!'); ?></div>
<br clear="all" />
</h2>
<?php endif; ?>
<?php if (!empty($status_message)): ?>
<div class="updated settings-error"><p><strong>
<?php echo $status_message; ?>
</strong></p></div>
<?php endif; ?>
<div id="visual-options">
<fieldset>
<div>
<input type="radio" value="1" id="button_type_1" <?php if ($current_button_type == '1'||$current_button_type == '') echo 'checked' ?> name="button_type" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/default-click']);" />
<label for="button_type_1"><?php echo SyC::t('sdk','Use Standard Button'); ?></label>
</div>
<table class="form-table shareyourcart_button_standard" name="shareyourcart_button_standard">
<table class="form-table">
<tr>
<th class="titledesc" scope="row"><?php echo SyC::t('sdk','Button skin'); ?></th>
<th class="titledesc" scope="row"><?php _e( 'Button style', 'woocommerce' ); ?></th>
<td class="forminp">
<select name="button_skin" id="button_skin" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/button-skin-click']);">
<fieldset>
<legend class="screen-reader-text"><span><?php _e( 'Button style', 'woocommerce' ); ?></span></legend>
<p>
<label>
<input type="radio" value="1" id="button_type_1" <?php if ($current_button_type == '1'||$current_button_type == '') echo 'checked' ?> name="button_type" class="tog" />
<?php echo SyC::t('sdk','Use Standard Button'); ?>
</label>
</p>
<ul style="margin-left: 18px;" class="shareyourcart_button_standard">
<li>
<label for="button_skin">
<?php echo SyC::t('sdk','Button skin'); ?>:
<select name="button_skin" id="button_skin">
<option name="orange" <?php echo $current_skin == 'orange' ? 'selected="selected"' : ''; ?> value="orange"><?php echo SyC::t('sdk','Orange'); ?></option>
<option name="blue" <?php echo $current_skin == 'blue' ? 'selected="selected"' : ''; ?> value="blue"><?php echo SyC::t('sdk','Blue'); ?></option>
<option name="light" <?php echo $current_skin == 'light' ? 'selected="selected"' : ''; ?> value="light"><?php echo SyC::t('sdk','Light'); ?></option>
<option name="dark" <?php echo $current_skin == 'dark' ? 'selected="selected"' : ''; ?> value="dark"><?php echo SyC::t('sdk','Dark'); ?></option>
</select>
</td>
</tr>
<tr >
<th class="titledesc" scope="row"><?php echo SyC::t('sdk','Button position'); ?></th>
<td class="forminp">
<select name="button_position" id="button_position" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/button-position-click']);">
</label>
</li>
<li>
<label for="button_position">
<?php echo SyC::t('sdk','Button position'); ?>:
<select name="button_position" id="button_position">
<option name="normal" <?php echo $current_position == 'normal' ? 'selected="selected"' : ''; ?> value="normal"><?php echo SyC::t('sdk','Normal'); ?></option>
<option name="floating" <?php echo $current_position == 'floating' ? 'selected="selected"' : ''; ?> value="floating"><?php echo SyC::t('sdk','Floating'); ?></option>
</select>
</td>
</tr>
<!-- <tr align="center"> since we switched to <a> on the button, this does not seem to be needed anymore
<td>
<input class="buttonCheckbox" name="show_on_single_row" <?php echo $show_on_single_row ? 'checked="checked"' : ''; ?> type='checkbox' onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/toggle-show-on-single-row-click']);"><?php echo SyC::t('sdk','Check this if you want the button to be shown on it\'s own row'); ?></input>
</td>
</tr> -->
</table>
</fieldset>
<fieldset>
<input type="radio" value="2" id="button_type_2" name="button_type" <?php if ($current_button_type == '2') echo 'checked' ?> onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/image-button-click']);"/>
<label for="button_type_2"><?php echo SyC::t('sdk','Use Image Button'); ?></label>
<?php if (empty($button_img)){ ?><br /><?php } ?>
<table class="form-table shareyourcart_button_image" name="shareyourcart_button_image">
<tr>
<th scope="row" class="titledesc"><label><?php echo SyC::t('sdk','Image:'); ?></label></th>
</label>
</li>
</ul>
<td class="forminp">
<p>
<label>
<input type="radio" value="2" id="button_type_2" name="button_type" <?php if ($current_button_type == '2') echo 'checked' ?> class="tog" />
<?php echo SyC::t('sdk','Use Image Button'); ?>
</label>
</p>
<ul style="margin-left: 18px;" class="shareyourcart_button_image">
<li>
<label>
<?php echo SyC::t('sdk','Image'); ?>:
<?php if ( ! empty( $button_img ) ): ?>
<img src="<?php echo $button_img ?>" height="40" />
<img src="<?php echo $button_img ?>" height="40" /><br/>
<?php endif; ?>
<input type="hidden" name="MAX_FILE_SIZE" value="100000000000" />
<input type="file" accept="image/gif, image/jpeg, image/jpg, image/png" name="button-img" id="button-img" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/upload-normal-img-click']);" />
</td>
</tr>
<tr>
<th scope="row" class="titledesc"><label><?php echo SyC::t('sdk','Hover image:'); ?></label></th>
<td class="forminp">
<input type="file" accept="image/gif, image/jpeg, image/jpg, image/png" name="button-img" id="button-img" />
</label>
</li>
<li>
<label>
<?php echo SyC::t('sdk','Hover Image'); ?>:
<?php if ( ! empty( $button_img_hover ) ): ?>
<img src="<?php echo $button_img_hover ?>" height="40" />
<img src="<?php echo $button_img_hover ?>" height="40" /><br/>
<?php endif; ?>
<input type="hidden" name="MAX_FILE_SIZE" value="100000000000" />
<input type="file" accept="image/gif, image/jpeg, image/jpg, image/png" name="button-img-hover" id="button-img-hover" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/upload-hover-img-click']);" />
</td>
</tr>
</table>
</fieldset>
<fieldset>
<input type="radio" value="3" id="button_type_3" name="button_type" <?php if ($current_button_type == '3') echo 'checked' ?> onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/custom-button-click']);"/>
<label for="button_type_3"><?php echo SyC::t('sdk','Build your own HTML button'); ?></label>
<table class="form-table shareyourcart_button_html" name="shareyourcart_button_html">
<tr>
<th>
HTML:
</th>
<td>
<textarea id="syc_button_textarea" class="buttonTextarea" rows="7" cols="56" name="button_html"><?php echo ($button_html!=''?$button_html:'<button>'.SyC::t('sdk','Get a {value} discount',array('{value}' => '<div class="shareyourcart-discount"></div>')).'</button>'); ?></textarea>
</td>
</tr>
</table>
<input type="file" accept="image/gif, image/jpeg, image/jpg, image/png" name="button-img-hover" id="button-img-hover" />
</label>
</li>
</ul>
<?php echo $html; ?>
<p>
<label>
<input type="radio" value="3" id="button_type_3" name="button_type" <?php if ($current_button_type == '3') echo 'checked' ?> class="tog" />
<?php echo SyC::t('sdk','Custom HTML button'); ?>
</label>
</p>
<ul style="margin-left: 18px;" class="shareyourcart_button_html">
<li>
<label>
<?php echo SyC::t('sdk','HTML'); ?>:
<textarea style="vertical-align:top" id="syc_button_textarea" class="buttonTextarea" rows="3" cols="56" name="button_html"><?php echo ($button_html!=''?$button_html:'<button>'.SyC::t('sdk','Get a {value} discount',array('{value}' => '<div class="shareyourcart-discount"></div>')).'</button>'); ?></textarea>
</label>
</li>
</ul>
</fieldset>
</td>
</tr>
</table>
<?php echo $html; ?>
<fieldset>
<table class="form-table " name="shareyourcart_settings">
<tr>
<th scope="row" valign="top"><?php echo SyC::t('sdk','Show button by default on: '); ?></th>
<td>
<input class="buttonCheckbox" name="show_on_product" <?php echo $show_on_product ? 'checked="checked"' : ''; ?> type='checkbox' onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/toggle-show-on-product-click']);"><?php echo SyC::t('sdk','Product page'); ?></input>
<input class="buttonCheckbox" name="show_on_product" <?php echo $show_on_product ? 'checked="checked"' : ''; ?> type='checkbox'><?php echo SyC::t('sdk','Product page'); ?></input>
<br />
<input class="buttonCheckbox" name="show_on_checkout" <?php echo $show_on_checkout ? 'checked="checked"' : ''; ?> type='checkbox' onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/toggle-show-on-checkout-click']);"><?php echo SyC::t('sdk','Checkout page'); ?></input>
<input class="buttonCheckbox" name="show_on_checkout" <?php echo $show_on_checkout ? 'checked="checked"' : ''; ?> type='checkbox'><?php echo SyC::t('sdk','Checkout page'); ?></input>
</td>
</tr>
<tr>
@ -134,18 +116,8 @@
</table>
</fieldset>
<div class="submit">
<input type="submit" class="button-primary" name="syc-visual-form" id="syc-visual-form" value="<?php echo SyC::t('sdk','Save changes'); ?>" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/save-click']);">
<input type="submit" class="button button-primary" name="syc-visual-form" value="<?php _e('Save changes', 'woocommerce'); ?>" />
</div>
<br />
</div>
<?php if($show_footer):?>
<h2><?php echo SyC::t('sdk','Contact'); ?></h2>
<p><?php echo SyC::t('sdk',"If you've got 30 seconds, we'd {link-1} love to know what ideal outcome you'd like ShareYourCart to help bring to your business</a>, or if you have a private question, you can {link-2} contact us directly</a>", array('{link-1}' => '<a href="http://shareyourcart.uservoice.com" target="_blank" title="forum" class="api-link" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/forum-click\']);">', '{link-2}' => '<a href="http://www.shareyourcart.com/contact" target="_blank" class="api-link" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/contact-click\']);">')); ?></p>
<br />
<?php endif; ?>
</div>

View File

@ -0,0 +1,6 @@
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied'); ?>
<?php if($this->hasNewerVersion()): //if there is a newer version, show the upgrade message?>
<div class="updated syc-update-nag">
<p><strong><?php echo SyC::t('sdk','{link}ShareYourCart {version}</a> is available! {link}Please update now</a>.', array('{version}' => $this->getConfigValue('latest_version'), '{link}' => '<a href="'.$this->getConfigValue("download_url").'" target="_blank">')); ?></strong></p>
</div>
<?php endif; ?>

View File

@ -93,7 +93,11 @@ class WC_Flat_Rate extends WC_Shipping_Method {
),
'cost_per_order' => array(
'title' => __( 'Cost per order', 'woocommerce' ),
'type' => 'text',
'type' => 'number',
'custom_attributes' => array(
'step' => 'any',
'min' => '0'
),
'description' => __( 'Enter a cost per order, e.g. 5.00. Leave blank to disable.', 'woocommerce' ),
'default' => '',
),
@ -138,7 +142,11 @@ class WC_Flat_Rate extends WC_Shipping_Method {
),
'cost' => array(
'title' => __( 'Default Cost', 'woocommerce' ),
'type' => 'text',
'type' => 'number',
'custom_attributes' => array(
'step' => 'any',
'min' => '0'
),
'description' => __( 'Cost excluding tax. Enter an amount, e.g. 2.50.', 'woocommerce' ),
'default' => '',
),
@ -150,7 +158,11 @@ class WC_Flat_Rate extends WC_Shipping_Method {
),
'minimum_fee' => array(
'title' => __( 'Minimum Fee', 'woocommerce' ),
'type' => 'text',
'type' => 'number',
'custom_attributes' => array(
'step' => 'any',
'min' => '0'
),
'description' => __( 'Enter a minimum fee amount. Fee\'s less than this will be increased. Leave blank to disable.', 'woocommerce' ),
'default' => '',
),
@ -179,23 +191,36 @@ class WC_Flat_Rate extends WC_Shipping_Method {
$cost_per_order = ( isset( $this->cost_per_order ) && ! empty( $this->cost_per_order ) ) ? $this->cost_per_order : 0;
if ( $this->type == 'order' ) {
$shipping_total = $this->order_shipping( $package );
if ( ! is_null( $shipping_total ) || $cost_per_order > 0 )
$rate = array(
'id' => $this->id,
'label' => $this->title,
'cost' => $shipping_total + $cost_per_order,
);
} elseif ( $this->type == 'class' ) {
$shipping_total = $this->class_shipping( $package );
if ( ! is_null( $shipping_total ) || $cost_per_order > 0 )
$rate = array(
'id' => $this->id,
'label' => $this->title,
'cost' => $shipping_total + $cost_per_order,
);
} elseif ( $this->type == 'item' ) {
$costs = $this->item_shipping( $package );
if ( ! is_null( $costs ) || $cost_per_order > 0 ) {
if ( ! is_array( $costs ) )
$costs = array();
$costs['order'] = $cost_per_order;
$rate = array(
@ -204,7 +229,12 @@ class WC_Flat_Rate extends WC_Shipping_Method {
'cost' => $costs,
'calc_tax' => 'per_item',
);
}
}
if ( ! isset( $rate ) )
return;
// Register the rate
$this->add_rate( $rate );
@ -286,7 +316,7 @@ class WC_Flat_Rate extends WC_Shipping_Method {
}
} else {
// No matching classes so use defaults
if ( $this->cost > $cost ) {
if ( ! empty( $this->cost ) && $this->cost > $cost ) {
$cost = $this->cost;
$fee = $this->fee;
}
@ -295,10 +325,13 @@ class WC_Flat_Rate extends WC_Shipping_Method {
}
// Default rates
if ( is_null( $cost ) ) {
// Default rates if set
if ( is_null( $cost ) && $this->cost !== '' ) {
$cost = $this->cost;
$fee = $this->fee;
} elseif ( is_null( $cost ) ) {
// No match
return null;
}
// Shipping for whole order
@ -335,21 +368,28 @@ class WC_Flat_Rate extends WC_Shipping_Method {
$found_shipping_classes = array_unique( $found_shipping_classes );
$matched = false;
// For each found class, add up the costs and fees
foreach ( $found_shipping_classes as $shipping_class => $class_price ) {
if ( isset( $this->flat_rates[ $shipping_class ] ) ) {
$cost += $this->flat_rates[ $shipping_class ]['cost'];
$fee += $this->get_fee( $this->flat_rates[ $shipping_class ]['fee'], $class_price );
} else {
// Class not set so we use default rate
$matched = true;
} elseif ( $this->cost !== '' ) {
// Class not set so we use default rate if its set
$cost += $this->cost;
$fee += $this->get_fee( $this->fee, $class_price );
$matched = true;
}
}
}
// Total
if ( $matched )
return $cost + $fee;
else
return null;
}
@ -364,6 +404,8 @@ class WC_Flat_Rate extends WC_Shipping_Method {
// Per item shipping so we pass an array of costs (per item) instead of a single value
$costs = array();
$matched = false;
// Shipping per item
foreach ( $package['contents'] as $item_id => $values ) {
$_product = $values['data'];
@ -371,19 +413,26 @@ class WC_Flat_Rate extends WC_Shipping_Method {
if ( $values['quantity'] > 0 && $_product->needs_shipping() ) {
$shipping_class = $_product->get_shipping_class();
$fee = $cost = 0;
if ( isset( $this->flat_rates[ $shipping_class ] ) ) {
$cost = $this->flat_rates[ $shipping_class ]['cost'];
$fee = $this->get_fee( $this->flat_rates[ $shipping_class ]['fee'], $_product->get_price() );
} else {
$matched = true;
} elseif ( $this->cost !== '' ) {
$cost = $this->cost;
$fee = $this->get_fee( $this->fee, $_product->get_price() );
$matched = true;
}
$costs[ $item_id ] = ( ( $cost + $fee ) * $values['quantity'] );
}
}
if ( $matched )
return $costs;
else
return null;
}
@ -445,7 +494,7 @@ class WC_Flat_Rate extends WC_Shipping_Method {
echo '</select>
</td>
<td><input type="text" value="' . esc_attr( $rate['cost'] ) . '" name="' . esc_attr( $this->id .'_cost[' . $i . ']' ) . '" placeholder="'.__( '0.00', 'woocommerce' ).'" size="4" /></td>
<td><input type="number" step="any" min="0" value="' . esc_attr( $rate['cost'] ) . '" name="' . esc_attr( $this->id .'_cost[' . $i . ']' ) . '" placeholder="'.__( '0.00', 'woocommerce' ).'" size="4" /></td>
<td><input type="text" value="' . esc_attr( $rate['fee'] ) . '" name="' . esc_attr( $this->id .'_fee[' . $i . ']' ) . '" placeholder="'.__( '0.00', 'woocommerce' ).'" size="4" /></td>
</tr>';
}
@ -478,7 +527,7 @@ class WC_Flat_Rate extends WC_Shipping_Method {
?>\
</select>\
</td>\
<td><input type="text" name="<?php echo $this->id; ?>_cost[' + size + ']" placeholder="0.00" size="4" /></td>\
<td><input type="number" step="any" min="0" name="<?php echo $this->id; ?>_cost[' + size + ']" placeholder="0.00" size="4" /></td>\
<td><input type="text" name="<?php echo $this->id; ?>_fee[' + size + ']" placeholder="0.00" size="4" /></td>\
</tr>').appendTo('#<?php echo $this->id; ?>_flat_rates table tbody');

View File

@ -76,7 +76,11 @@ class WC_Free_Shipping extends WC_Shipping_Method {
),
'min_amount' => array(
'title' => __( 'Minimum Order Amount', 'woocommerce' ),
'type' => 'text',
'type' => 'number',
'custom_attributes' => array(
'step' => 'any',
'min' => '0'
),
'description' => __( 'Users will need to spend this amount to get free shipping. Leave blank to disable.', 'woocommerce' ),
'default' => ''
),

View File

@ -101,7 +101,11 @@ class WC_International_Delivery extends WC_Flat_Rate {
),
'cost' => array(
'title' => __( 'Default Cost', 'woocommerce' ),
'type' => 'text',
'type' => 'number',
'custom_attributes' => array(
'step' => 'any',
'min' => '0'
),
'description' => __( 'Cost excluding tax. Enter an amount, e.g. 2.50.', 'woocommerce' ),
'default' => ''
),

View File

@ -121,7 +121,11 @@ class WC_Local_Delivery extends WC_Shipping_Method {
),
'fee' => array(
'title' => __( 'Delivery Fee', 'woocommerce' ),
'type' => 'text',
'type' => 'number',
'custom_attributes' => array(
'step' => 'any',
'min' => '0'
),
'description' => __( 'What fee do you want to charge for local delivery, disregarded if you choose free. Leave blank to disable.', 'woocommerce' ),
'default' => ''
),

View File

@ -180,6 +180,8 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Feature - New shop page/category archive display settings, and the ability to change display per-category.
* Feature - Allow shipping tax classes to be defined independent of items. https://github.com/woothemes/woocommerce/issues/1625
* Feature - Redone order item storage making them easier (and faster) to access for reporting, and querying purchases. Huge performance gains for reports. Order items are no longer serialised - they are stored in there own table with meta. Existing data can be be updated on upgrade.
* Feature - Update weights/dimensions for variations if they differ.
* Feature - is_order_received_page() courtesy of Lee Willis.
* Templating - Revised pagination, sorting areas (sorting is now above products, numbered pagination below) and added a result count.
* Templating - email-order-items.php change get_downloadable_file_url() to get_downloadable_file_urls() to support multiple files.
@ -217,11 +219,13 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Tweak - Made armed forces 'states' under the US rather than in their own 'country'.
* Tweak - Extended woocommerce_update_options for flexibility.
* Tweak - Added disabled to settings API.
* Tweak - Flat rate shipping - if no rules match, and no default is set, don't return a rate.
* Tweak - custom_attributes option added to woocommerce_form_field args. Pass name/value pairs.
* Tweak - Added html5 type inputs to admin with inline validation.
* Fix - Added more error messages for coupons.
* Fix - Variation sku updating after selection.
* Fix - Active plugins display on status page.
* Fix - Manual product category counting to make sure hidden products are not counted.
* Localization - French update by Arnaud Cheminand and absoluteweb.
* Localization - Romanian update by silviu-bucsa.

View File

@ -88,11 +88,12 @@ global $woocommerce;
if ( $_product->is_sold_individually() ) {
$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
} else {
$data_min = apply_filters( 'woocommerce_cart_item_data_min', '', $_product );
$data_max = ( $_product->backorders_allowed() ) ? '' : $_product->get_stock_quantity();
$data_max = apply_filters( 'woocommerce_cart_item_data_max', $data_max, $_product );
$product_quantity = sprintf( '<div class="quantity"><input type="text" name="cart[%s][qty]" data-min="%s" data-max="%s" value="%s" size="4" title="Qty" class="input-text qty text" maxlength="12" /></div>', $cart_item_key, $data_min, $data_max, esc_attr( $values['quantity'] ) );
$step = apply_filters( 'woocommerce_quantity_input_step', '1', $_product );
$min = apply_filters( 'woocommerce_quantity_input_min', '', $_product );
$max = apply_filters( 'woocommerce_quantity_input_max', $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(), $_product );
$product_quantity = sprintf( '<div class="quantity"><input type="number" name="cart[%s][qty]" step="%s" min="%s" max="%s" value="%s" size="4" title="Qty" class="input-text qty text" maxlength="12" /></div>', $cart_item_key, $step, $min, $max, esc_attr( $values['quantity'] ) );
}
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key );

View File

@ -256,7 +256,7 @@ $available_methods = $woocommerce->shipping->get_available_shipping_methods();
<?php if (woocommerce_get_page_id('terms')>0) : ?>
<p class="form-row terms">
<label for="terms" class="checkbox"><?php _e( 'I accept the', 'woocommerce' ); ?> <a href="<?php echo esc_url( get_permalink(woocommerce_get_page_id('terms')) ); ?>" target="_blank"><?php _e( 'terms &amp; conditions', 'woocommerce' ); ?></a></label>
<label for="terms" class="checkbox"><?php _e( 'I have read and accept the', 'woocommerce' ); ?> <a href="<?php echo esc_url( get_permalink(woocommerce_get_page_id('terms')) ); ?>" target="_blank"><?php _e( 'terms &amp; conditions', 'woocommerce' ); ?></a></label>
<input type="checkbox" class="input-checkbox" name="terms" <?php if (isset($_POST['terms'])) echo 'checked="checked"'; ?> id="terms" />
</p>
<?php endif; ?>

View File

@ -34,7 +34,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
do_action( 'woocommerce_before_single_product_summary' );
?>
<div class="summary">
<div class="summary entry-summary">
<?php
/**

View File

@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
<?php do_action( 'woocommerce_email_before_order_table', $order, true ); ?>
<h2><?php printf( __( 'Order: %s', 'woocommerce'), $order->get_order_number() ); ?> (<?php printf( '<time datetime="%s">%s</time>', date_i18n( 'c', strtotime( $order->order_date ) ), date_i18n( __( 'jS F Y', 'woocommerce' ), strtotime( $order->order_date ) ) ); ?>)</h2>
<h2><?php printf( __( 'Order: %s', 'woocommerce'), $order->get_order_number() ); ?> (<?php printf( '<time datetime="%s">%s</time>', date_i18n( 'c', strtotime( $order->order_date ) ), date_i18n( woocommerce_date_format(), strtotime( $order->order_date ) ) ); ?>)</h2>
<table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
<thead>

View File

@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
<?php do_action('woocommerce_email_before_order_table', $order, false); ?>
<h2><?php echo __( 'Order:', 'woocommerce' ) . ' ' . $order->get_order_number(); ?> (<?php printf( '<time datetime="%s">%s</time>', date_i18n( 'c', strtotime( $order->order_date ) ), date_i18n( __( 'jS F Y', 'woocommerce' ), strtotime( $order->order_date ) ) ); ?>)</h2>
<h2><?php echo __( 'Order:', 'woocommerce' ) . ' ' . $order->get_order_number(); ?> (<?php printf( '<time datetime="%s">%s</time>', date_i18n( 'c', strtotime( $order->order_date ) ), date_i18n( woocommerce_date_format(), strtotime( $order->order_date ) ) ); ?>)</h2>
<table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
<thead>

View File

@ -17,7 +17,7 @@ echo "****************************************************\n\n";
do_action( 'woocommerce_email_before_order_table', $order, false );
echo sprintf( __( 'Order number: %s', 'woocommerce'), $order->get_order_number() ) . "\n";
echo sprintf( __( 'Order date: %s', 'woocommerce'), date_i18n( __( 'jS F Y', 'woocommerce' ), strtotime( $order->order_date ) ) ) . "\n";
echo sprintf( __( 'Order date: %s', 'woocommerce'), date_i18n( woocommerce_date_format(), strtotime( $order->order_date ) ) ) . "\n";
do_action( 'woocommerce_email_order_meta', $order, false, true );

View File

@ -18,7 +18,7 @@ echo "****************************************************\n\n";
do_action( 'woocommerce_email_before_order_table', $order, false );
echo sprintf( __( 'Order number: %s', 'woocommerce'), $order->get_order_number() ) . "\n";
echo sprintf( __( 'Order date: %s', 'woocommerce'), date_i18n( __( 'jS F Y', 'woocommerce' ), strtotime( $order->order_date ) ) ) . "\n";
echo sprintf( __( 'Order date: %s', 'woocommerce'), date_i18n( woocommerce_date_format(), strtotime( $order->order_date ) ) ) . "\n";
do_action( 'woocommerce_email_order_meta', $order, false, true );

View File

@ -25,7 +25,7 @@ echo "****************************************************\n\n";
do_action( 'woocommerce_email_before_order_table', $order, false );
echo sprintf( __( 'Order number: %s', 'woocommerce'), $order->get_order_number() ) . "\n";
echo sprintf( __( 'Order date: %s', 'woocommerce'), date_i18n( __( 'jS F Y', 'woocommerce' ), strtotime( $order->order_date ) ) ) . "\n";
echo sprintf( __( 'Order date: %s', 'woocommerce'), date_i18n( woocommerce_date_format(), strtotime( $order->order_date ) ) ) . "\n";
do_action( 'woocommerce_email_order_meta', $order, false, true );

View File

@ -17,7 +17,7 @@ echo "****************************************************\n\n";
do_action( 'woocommerce_email_before_order_table', $order, false );
echo sprintf( __( 'Order number: %s', 'woocommerce'), $order->get_order_number() ) . "\n";
echo sprintf( __( 'Order date: %s', 'woocommerce'), date_i18n( __( 'jS F Y', 'woocommerce' ), strtotime( $order->order_date ) ) ) . "\n";
echo sprintf( __( 'Order date: %s', 'woocommerce'), date_i18n( woocommerce_date_format(), strtotime( $order->order_date ) ) ) . "\n";
do_action( 'woocommerce_email_order_meta', $order, false, true );

View File

@ -9,7 +9,16 @@
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$id = ( get_option('template') === 'twentyeleven' ) ? 'primary' : 'container';
?>
<div id="<?php echo $id; ?>">
<div id="content" role="main">
$template = get_option('template');
switch( $template ) {
case 'twentyeleven' :
echo '<div id="primary"><div id="content" role="main">';
break;
case 'twentytwelve' :
echo '<div id="primary" class="site-content"><div id="content" role="main">';
break;
default :
echo '<div id="container"><div id="content" role="main">';
break;
}

View File

@ -4,10 +4,10 @@
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
* @version 1.7.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<div class="quantity"><input name="<?php echo esc_attr( $input_name ); ?>" data-min="<?php echo esc_attr( $min_value ); ?>" data-max="<?php echo esc_attr( $max_value ); ?>" value="<?php echo esc_attr( $input_value ); ?>" size="4" title="Qty" class="input-text qty text" maxlength="12" /></div>
<div class="quantity"><input type="number" step="<?php echo esc_attr( $step ); ?>" min="<?php echo esc_attr( $min_value ); ?>" max="<?php echo esc_attr( $max_value ); ?>" name="<?php echo esc_attr( $input_name ); ?>" value="<?php echo esc_attr( $input_value ); ?>" size="4" title="Qty" class="input-text qty text" maxlength="12" /></div>

View File

@ -33,7 +33,10 @@ if ( ! $product->is_purchasable() ) return;
<?php
if ( ! $product->is_sold_individually() )
woocommerce_quantity_input( array( 'min_value' => 1, 'max_value' => $product->backorders_allowed() ? '' : $product->get_stock_quantity() ) );
woocommerce_quantity_input( array(
'min_value' => apply_filters( 'woocommerce_quantity_input_min', 1, $product ),
'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product )
) );
?>
<button type="submit" class="single_add_to_cart_button button alt"><?php echo apply_filters('single_add_to_cart_text', __( 'Add to cart', 'woocommerce' ), $product->product_type); ?></button>

View File

@ -26,7 +26,7 @@ if ( empty( $attributes ) && ( ! $product->enable_dimensions_display() || ( ! $p
<tr class="<?php if ( $alt == 1 ) echo 'alt'; ?>">
<th><?php _e( 'Weight', 'woocommerce' ) ?></th>
<td><?php echo $product->get_weight() . ' ' . esc_attr( get_option('woocommerce_weight_unit') ); ?></td>
<td class="product_weight"><?php echo $product->get_weight() . ' ' . esc_attr( get_option('woocommerce_weight_unit') ); ?></td>
</tr>
<?php endif; ?>
@ -35,7 +35,7 @@ if ( empty( $attributes ) && ( ! $product->enable_dimensions_display() || ( ! $p
<tr class="<?php if ( $alt == 1 ) echo 'alt'; ?>">
<th><?php _e( 'Dimensions', 'woocommerce' ) ?></th>
<td><?php echo $product->get_dimensions(); ?></td>
<td class="product_dimensions"><?php echo $product->get_dimensions(); ?></td>
</tr>
<?php endif; ?>

View File

@ -38,7 +38,7 @@ global $post;
if ( woocommerce_customer_bought_product( $GLOBALS['comment']->comment_author_email, $GLOBALS['comment']->user_id, $post->ID ) )
echo '(' . __( 'verified owner', 'woocommerce' ) . ') ';
?>&ndash; <time itemprop="datePublished" time datetime="<?php echo get_comment_date('c'); ?>"><?php echo get_comment_date(__( 'M jS Y', 'woocommerce' )); ?></time>:
?>&ndash; <time itemprop="datePublished" time datetime="<?php echo get_comment_date('c'); ?>"><?php echo get_comment_date(__( get_option('date_format'), 'woocommerce' )); ?></time>:
</p>
<?php endif; ?>

View File

@ -17,6 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
*/
add_filter( 'woocommerce_coupon_code', 'sanitize_text_field' );
add_filter( 'woocommerce_coupon_code', 'strtolower' ); // Coupons case-insensitive by default
add_filter( 'woocommerce_stock_amount', 'absint' ); // Stock amounts are integers by default
/**
* woocommerce_get_dimension function.
@ -325,6 +326,18 @@ if ( ! function_exists( 'is_account_page' ) ) {
return ( is_page( woocommerce_get_page_id( 'myaccount' ) ) || is_page( woocommerce_get_page_id( 'edit_address' ) ) || is_page( woocommerce_get_page_id( 'view_order' ) ) || is_page( woocommerce_get_page_id( 'change_password' ) ) ) ? true : false;
}
}
if ( ! function_exists( 'is_order_received_page' ) ) {
/**
* is_order_received_page - Returns true when viewing the order received page.
*
* @access public
* @return bool
*/
function is_order_received_page() {
return ( is_page( woocommerce_get_page_id( 'thanks' ) ) ) ? true : false;
}
}
if ( ! function_exists( 'is_ajax' ) ) {
/**
@ -1689,48 +1702,6 @@ function woocommerce_remove_roles() {
}
}
/**
* Manual category counting to prevent category widget from showing hidden products in total
*
* @access public
* @return void
*/
function woocommerce_manual_category_count( $terms, $taxonomy ) {
// Keep the normal count in sync
_update_post_term_count( $terms, $taxonomy );
if ( isset( $_POST['post_ID'] ) && isset( $_POST['_visibility'] ) && 'product_cat' == $taxonomy->query_var ) {
foreach ( $terms as $term_id ) {
$do_count = array( 'visible', 'catalog' );
$do_not_count = array( 'search', 'hidden' );
$counted_ids = get_option( 'wc_prod_cat_counts' );
if ( ! is_array( $counted_ids ) )
$counted_ids = array();
$counted_ids[ $term_id ] = ( empty( $counted_ids[ $term_id ] ) || ! is_array( $counted_ids[ $term_id ] ) ) ? array() : $counted_ids[ $term_id ];
if ( in_array( $_POST['_visibility'], $do_count ) ) {
if ( ! empty( $counted_ids[ $term_id ] ) ) {
if ( ! in_array( $_POST['post_ID'], $counted_ids[ $term_id ] ) ) {
array_push( $counted_ids[ $term_id ], absint( $_POST['post_ID'] ) );
update_option( 'wc_prod_cat_counts', $counted_ids );
}
} else {
$counted_ids[ $term_id ] = array( absint( $_POST['post_ID'] ) );
update_option( 'wc_prod_cat_counts', $counted_ids );
}
} elseif ( in_array( $_POST['_visibility'], $do_not_count ) ) {
if ( in_array( $_POST['post_ID'], $counted_ids[ $term_id ] ) ) {
if ( ( $key = array_search( $_POST['post_ID'], $counted_ids[ $term_id ] ) ) !== false ) {
unset( $counted_ids[ $term_id ][ $key ] );
update_option( 'wc_prod_cat_counts', $counted_ids );
}
}
}
}
}
}
/**
* Add a item to an order (for example a line item).
@ -1852,3 +1823,13 @@ function woocommerce_delete_order_item_meta( $item_id, $meta_key, $meta_value =
function woocommerce_get_order_item_meta( $item_id, $key, $single = true ) {
return get_metadata( 'order_item', $item_id, $key, $single );
}
/**
* WooCommerce Date Format - Allows to change date format for everything WooCommerce
*
* @access public
* @return string
*/
function woocommerce_date_format() {
return apply_filters( 'woocommerce_date_format', get_option( 'date_format' ) );
}

View File

@ -189,15 +189,11 @@ function woocommerce_update_cart_action() {
if ( ! isset( $cart_totals[$cart_item_key]['qty'] ) )
continue;
// Check the quantity input
$original = $cart_totals[ $cart_item_key ]['qty'];
$casted = (int) $cart_totals[ $cart_item_key ]['qty'];
$casted = (string) $casted;
if ( $original == $casted ) {
$quantity = absint( $cart_totals[ $cart_item_key ]['qty'] );
} else {
$quantity = $woocommerce->cart->cart_contents[ $cart_item_key ]['quantity'];
}
// Sanitize
$quantity = preg_replace( "/[^0-9\.]/", "", $cart_totals[ $cart_item_key ]['qty'] );
if ( $quantity == "" )
continue;
// Update cart validation
$passed_validation = apply_filters( 'woocommerce_update_cart_validation', true, $cart_item_key, $values, $quantity );
@ -256,7 +252,7 @@ function woocommerce_add_to_cart_action( $url = false ) {
if ( $adding_to_cart->is_type( 'variable' ) ) {
$variation_id = empty( $_REQUEST['variation_id'] ) ? '' : absint( $_REQUEST['variation_id'] );
$quantity = empty( $_REQUEST['quantity'] ) ? 1 : absint( $_REQUEST['quantity'] );
$quantity = empty( $_REQUEST['quantity'] ) ? 1 : apply_filters( 'woocommerce_stock_amount', $_REQUEST['quantity'] );
$all_variations_set = true;
$variations = array();
@ -311,7 +307,7 @@ function woocommerce_add_to_cart_action( $url = false ) {
$added_to_cart = array();
foreach ( $_REQUEST['quantity'] as $item => $quantity ) {
if ( $quantity < 1 )
if ( $quantity <= 0 )
continue;
$quantity_set = true;
@ -349,7 +345,7 @@ function woocommerce_add_to_cart_action( $url = false ) {
// Simple Products
} else {
$quantity = empty( $_REQUEST['quantity'] ) ? 1 : absint( $_REQUEST['quantity'] );
$quantity = empty( $_REQUEST['quantity'] ) ? 1 : apply_filters( 'woocommerce_stock_amount', $_REQUEST['quantity'] );
// Add to cart validation
$passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity );
@ -1231,23 +1227,3 @@ function woocommerce_get_order_id_by_order_key( $order_key ) {
return $order_id;
}
/**
* Change the count properties for all terms based on our manual counters
*
* @access public
* @return array Contains all the terms with updated counts
*/
function wc_get_terms_count_filter( $terms, $taxonomies ) {
if ( ! is_admin() && in_array( 'product_cat', $taxonomies ) ) {
$counted_ids = get_option( 'wc_prod_cat_counts' );
foreach ( $terms as $term ) {
if ( isset( $counted_ids[ $term->term_id ] ) ) {
$term->count = count( $counted_ids[ $term->term_id ] );
}
}
}
return $terms;
}

View File

@ -80,13 +80,6 @@ if ( ! is_admin() || defined('DOING_AJAX') ) {
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
/**
* Categories
*
* @see wc_get_terms_count_filter()
*/
add_filter( 'get_terms', 'wc_get_terms_count_filter', 10, 2 );
/**
* Subcategories
*
@ -324,7 +317,7 @@ add_action( 'comment_post', 'woocommerce_add_comment_rating', 1 );
add_filter( 'preprocess_comment', 'woocommerce_check_comment_rating', 0 );
/**
* Text filters
* Filters
*/
add_filter( 'woocommerce_short_description', 'wptexturize' );
add_filter( 'woocommerce_short_description', 'convert_smilies' );

View File

@ -672,14 +672,17 @@ if ( ! function_exists( 'woocommerce_quantity_input' ) ) {
* @return void
*/
function woocommerce_quantity_input( $args = array() ) {
global $product;
$defaults = array(
'input_name' => 'quantity',
'input_value' => '1',
'max_value' => '',
'min_value' => '0'
'max_value' => apply_filters( 'woocommerce_quantity_input_max', '', $product ),
'min_value' => apply_filters( 'woocommerce_quantity_input_min', '', $product ),
'step' => apply_filters( 'woocommerce_quantity_input_step', '1', $product )
);
$args = apply_filters( 'woocommerce_quantity_input_args', wp_parse_args( $args, $defaults ) );
$args = apply_filters( 'woocommerce_quantity_input_args', wp_parse_args( $args, $defaults ), $product );
woocommerce_get_template( 'single-product/add-to-cart/quantity.php', $args );
}
@ -1239,16 +1242,24 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
'class' => array(),
'label_class' => array(),
'return' => false,
'options' => array()
'options' => array(),
'custom_attributes' => array()
);
$args = wp_parse_args( $args, $defaults );
if ( ( isset( $args['clear'] ) && $args['clear'] ) ) $after = '<div class="clear"></div>'; else $after = '';
if ( ( ! empty( $args['clear'] ) ) ) $after = '<div class="clear"></div>'; else $after = '';
$required = ( $args['required'] ) ? ' <abbr class="required" title="' . esc_attr__( 'required', 'woocommerce' ) . '">*</abbr>' : '';
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint( $args['maxlength'] ) . '"' : '';
// Custom attribute handling
$custom_attributes = array();
if ( ! empty( $args['custom_attributes'] ) && is_array( $args['custom_attributes'] ) )
foreach ( $args['custom_attributes'] as $attribute => $value )
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';
switch ( $args['type'] ) {
case "country" :
@ -1259,7 +1270,7 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
$field .= '<strong>' . current( array_values( $woocommerce->countries->get_allowed_countries() ) ) . '</strong>';
$field .= '<input type="hidden" name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" value="' . current( array_keys( $woocommerce->countries->get_allowed_countries() ) ) . '" />';
$field .= '<input type="hidden" name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" value="' . current( array_keys( $woocommerce->countries->get_allowed_countries() ) ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
$field .= '</p>' . $after;
@ -1267,7 +1278,7 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $key ) . '_field">
<label for="' . esc_attr( $key ) . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label']. $required . '</label>
<select name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" class="country_to_state country_select">
<select name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" class="country_to_state country_select" ' . implode( ' ', $custom_attributes ) . '>
<option value="">'.__( 'Select a country&hellip;', 'woocommerce' ) .'</option>';
foreach ( $woocommerce->countries->get_allowed_countries() as $ckey => $cvalue )
@ -1303,14 +1314,14 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $key ) . '_field" style="display: none">';
$field .= '<label for="' . esc_attr( $key ) . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label']. $required . '</label>';
$field .= '<input type="hidden" class="hidden" name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" value="" />';
$field .= '<input type="hidden" class="hidden" name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" value="" ' . implode( ' ', $custom_attributes ) . ' />';
$field .= '</p>' . $after;
} elseif ( is_array( $states ) ) {
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $key ) . '_field">';
$field .= '<label for="' . esc_attr( $key ) . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label']. $required . '</label>';
$field .= '<select name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" class="state_select">
$field .= '<select name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" class="state_select" ' . implode( ' ', $custom_attributes ) . '>
<option value="">'.__( 'Select a state&hellip;', 'woocommerce' ) .'</option>';
foreach ( $states as $ckey => $cvalue )
@ -1323,7 +1334,7 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $key ) . '_field">';
$field .= '<label for="' . esc_attr( $key ) . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label']. $required . '</label>';
$field .= '<input type="text" class="input-text" value="' . $value . '" placeholder="' . $args['placeholder'] . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" />';
$field .= '<input type="text" class="input-text" value="' . $value . '" placeholder="' . $args['placeholder'] . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
$field .= '</p>' . $after;
}
@ -1333,7 +1344,7 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $key ) . '_field">
<label for="' . esc_attr( $key ) . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label']. $required . '</label>
<textarea name="' . esc_attr( $key ) . '" class="input-text" id="' . esc_attr( $key ) . '" placeholder="' . $args['placeholder'] . '" cols="5" rows="2">'. esc_textarea( $value ) .'</textarea>
<textarea name="' . esc_attr( $key ) . '" class="input-text" id="' . esc_attr( $key ) . '" placeholder="' . $args['placeholder'] . '" cols="5" rows="2" ' . implode( ' ', $custom_attributes ) . '>'. esc_textarea( $value ) .'</textarea>
</p>' . $after;
break;
@ -1341,7 +1352,7 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $key ) . '_field">
<input type="' . $args['type'] . '" class="input-checkbox" name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" value="1" '.checked( $value, 1, false ) .' />
<label for="' . esc_attr( $key ) . '" class="checkbox ' . implode( ' ', $args['label_class'] ) .'">' . $args['label'] . $required . '</label>
<label for="' . esc_attr( $key ) . '" class="checkbox ' . implode( ' ', $args['label_class'] ) .'" ' . implode( ' ', $custom_attributes ) . '>' . $args['label'] . $required . '</label>
</p>' . $after;
break;
@ -1349,7 +1360,7 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $key ) . '_field">
<label for="' . esc_attr( $key ) . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label']. $required . '</label>
<input type="password" class="input-text" name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" placeholder="' . $args['placeholder'] . '" value="' . esc_attr( $value ) . '" />
<input type="password" class="input-text" name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" placeholder="' . $args['placeholder'] . '" value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />
</p>' . $after;
break;
@ -1357,7 +1368,7 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $key ) . '_field">
<label for="' . esc_attr( $key ) . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label'] . $required . '</label>
<input type="text" class="input-text" name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" placeholder="' . $args['placeholder'] . '" '.$args['maxlength'].' value="' . esc_attr( $value ) . '" />
<input type="text" class="input-text" name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" placeholder="' . $args['placeholder'] . '" '.$args['maxlength'].' value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />
</p>' . $after;
break;
@ -1371,7 +1382,7 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $key ) . '_field">
<label for="' . esc_attr( $key ) . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label']. $required . '</label>
<select name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" class="select">
<select name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" class="select" ' . implode( ' ', $custom_attributes ) . '>
' . $options . '
</select>
</p>' . $after;

View File

@ -666,7 +666,7 @@ class Woocommerce {
array('product'),
array(
'hierarchical' => true,
'update_count_callback' => 'woocommerce_manual_category_count',
'update_count_callback' => '_update_post_term_count',
'label' => __( 'Product Categories', 'woocommerce'),
'labels' => array(
'name' => __( 'Product Categories', 'woocommerce'),