Merge branch 'master' of github.com:woothemes/woocommerce into IE_download_fix
Conflicts: woocommerce-functions.php
This commit is contained in:
commit
5341387222
|
@ -54,6 +54,7 @@ function woocommerce_duplicate_product() {
|
|||
*/
|
||||
function woocommerce_get_product_to_duplicate($id) {
|
||||
global $wpdb;
|
||||
$id = intval( $id );
|
||||
$post = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE ID=$id");
|
||||
if (isset($post->post_type) && $post->post_type == "revision"){
|
||||
$id = $post->post_parent;
|
||||
|
|
|
@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|||
global $wpdb, $woocommerce;
|
||||
|
||||
// Upgrade old style files paths to support multiple file paths
|
||||
$existing_file_paths = $wpdb->get_results( "SELECT * FROM {$wpdb->postmeta} WHERE meta_key = '_file_path'" );
|
||||
$existing_file_paths = $wpdb->get_results( "SELECT * FROM {$wpdb->postmeta} WHERE meta_key = '_file_path' AND meta_value != '';" );
|
||||
|
||||
if ( $existing_file_paths ) {
|
||||
|
||||
|
@ -22,8 +22,7 @@ if ( $existing_file_paths ) {
|
|||
$old_file_path = trim( $existing_file_path->meta_value );
|
||||
|
||||
if ( ! empty( $old_file_path ) ) {
|
||||
$file_paths = maybe_serialize( array( md5( $old_file_path ) => $old_file_path ) );
|
||||
|
||||
$file_paths = serialize( array( md5( $old_file_path ) => $old_file_path ) );
|
||||
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_key = '_file_paths', meta_value = %s WHERE meta_id = %d", $file_paths, $existing_file_path->meta_id ) );
|
||||
|
||||
|
@ -310,10 +309,10 @@ foreach ( array( 'catalog', 'single', 'thumbnail' ) as $value ) {
|
|||
) );
|
||||
|
||||
if ( ! empty( $old_settings ) && update_option( 'shop_' . $value . '_image_size', $old_settings ) ){
|
||||
|
||||
|
||||
delete_option( 'woocommerce_' . $value . '_image_width' );
|
||||
delete_option( 'woocommerce_' . $value . '_image_height' );
|
||||
delete_option( 'woocommerce_' . $value . '_image_crop' );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -782,6 +782,8 @@ function woocommerce_admin_product_bulk_edit( $column_name, $post_type ) {
|
|||
|
||||
<h4><?php _e( 'Product Data', 'woocommerce' ); ?></h4>
|
||||
|
||||
<?php do_action( 'woocommerce_product_bulk_edit_start' ); ?>
|
||||
|
||||
<div class="inline-edit-group">
|
||||
<label class="alignleft">
|
||||
<span class="title"><?php _e( 'Price', 'woocommerce' ); ?></span>
|
||||
|
@ -975,7 +977,11 @@ function woocommerce_admin_product_bulk_edit( $column_name, $post_type ) {
|
|||
<input type="text" name="_stock" class="text stock" placeholder="<?php _e( 'Stock Qty', 'woocommerce' ); ?>" value="">
|
||||
</label>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif;
|
||||
|
||||
do_action( 'woocommerce_product_bulk_edit_end' ); ?>
|
||||
|
||||
<input type="hidden" name="woocommerce_bulk_edit_nonce" value="<?php echo wp_create_nonce( 'woocommerce_bulk_edit_nonce' ); ?>" />
|
||||
</div>
|
||||
</fieldset>
|
||||
|
@ -1148,6 +1154,8 @@ function woocommerce_admin_product_bulk_edit_save( $post_id, $post ) {
|
|||
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_product_bulk_edit_save', $product );
|
||||
|
||||
// Clear transient
|
||||
$woocommerce->clear_product_transients( $post_id );
|
||||
}
|
||||
|
|
|
@ -427,7 +427,7 @@ function woocommerce_order_actions_meta_box( $post ) {
|
|||
?>
|
||||
<ul class="order_actions submitbox">
|
||||
|
||||
<?php do_action( 'woocommerce_order_actions', $post->ID ); ?>
|
||||
<?php do_action( 'woocommerce_order_actions_start', $post->ID ); ?>
|
||||
|
||||
<li class="wide" id="actions">
|
||||
<select name="wc_order_action">
|
||||
|
@ -470,6 +470,9 @@ function woocommerce_order_actions_meta_box( $post ) {
|
|||
|
||||
<input type="submit" class="button save_order button-primary tips" name="save" value="<?php _e( 'Save Order', 'woocommerce' ); ?>" data-tip="<?php _e( 'Save/update the order', 'woocommerce' ); ?>" />
|
||||
</li>
|
||||
|
||||
<?php do_action( 'woocommerce_order_actions_end', $post->ID ); ?>
|
||||
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ function woocommerce_order_downloads_meta_box() {
|
|||
<div class="order_download_permissions wc-metaboxes-wrapper">
|
||||
|
||||
<div class="wc-metaboxes">
|
||||
|
||||
<?php
|
||||
$download_permissions = $wpdb->get_results( $wpdb->prepare( "
|
||||
SELECT * FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions
|
||||
|
@ -33,11 +32,12 @@ function woocommerce_order_downloads_meta_box() {
|
|||
", $post->ID ) );
|
||||
|
||||
$product = null;
|
||||
$loop = 0;
|
||||
if ( $download_permissions && sizeof( $download_permissions ) > 0 ) foreach ( $download_permissions as $download ) {
|
||||
|
||||
if ( ! $product || $product->id != $download->product_id ) {
|
||||
$product = get_product( absint( $download->product_id ) );
|
||||
$file_count = $loop = 0;
|
||||
$file_count = 0;
|
||||
}
|
||||
|
||||
// don't show permissions to files that have since been removed
|
||||
|
|
|
@ -37,7 +37,7 @@ function woocommerce_product_images_box() {
|
|||
if ( $attachments )
|
||||
foreach ( $attachments as $attachment_id ) {
|
||||
echo '<li class="image" data-attachment_id="' . $attachment_id . '">
|
||||
' . wp_get_attachment_image( $attachment_id, 'full' ) . '
|
||||
' . wp_get_attachment_image( $attachment_id, 'thumbnail' ) . '
|
||||
<ul class="actions">
|
||||
<li><a href="#" class="delete" title="' . __( 'Delete image', 'woocommerce' ) . '">' . __( 'Delete', 'woocommerce' ) . '</a></li>
|
||||
</ul>
|
||||
|
@ -161,4 +161,4 @@ function woocommerce_product_images_box() {
|
|||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,12 +81,13 @@ function woocommerce_attributes() {
|
|||
$error = sprintf( __( 'Slug “%s” is not allowed because it is a reserved term. Change it, please.', 'woocommerce' ), sanitize_title( $attribute_name ) );
|
||||
} else {
|
||||
$taxonomy_exists = taxonomy_exists( $woocommerce->attribute_taxonomy_name( $attribute_name ) );
|
||||
|
||||
if ( 'add' === $action && $taxonomy_exists ) {
|
||||
$error = sprintf( __( 'Slug “%s” is already in use. Change it, please.', 'woocommerce' ), sanitize_title( $attribute_name ) );
|
||||
}
|
||||
if ( 'edit' === $action ) {
|
||||
$old_attribute_name = woocommerce_sanitize_taxonomy_name( $wpdb->get_var( "SELECT attribute_name FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_id = $attribute_id" ) );
|
||||
if ( $old_attribute_name != $attribute_name && $taxonomy_exists ) {
|
||||
$old_attribute_name = $wpdb->get_var( "SELECT attribute_name FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_id = $attribute_id" );
|
||||
if ( $old_attribute_name != $attribute_name && woocommerce_sanitize_taxonomy_name( $old_attribute_name ) != $attribute_name && $taxonomy_exists ) {
|
||||
$error = sprintf( __( 'Slug “%s” is already in use. Change it, please.', 'woocommerce' ), sanitize_title( $attribute_name ) );
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +131,7 @@ function woocommerce_attributes() {
|
|||
$wpdb->update(
|
||||
$wpdb->term_taxonomy,
|
||||
array( 'taxonomy' => $woocommerce->attribute_taxonomy_name( $attribute_name ) ),
|
||||
array( 'taxonomy' => $woocommerce->attribute_taxonomy_name( $old_attribute_name ) )
|
||||
array( 'taxonomy' => 'pa_' . $old_attribute_name )
|
||||
);
|
||||
|
||||
// Update taxonomy ordering term meta
|
||||
|
|
|
@ -318,7 +318,7 @@ function woocommerce_add_shortcode_button() {
|
|||
*/
|
||||
function woocommerce_add_tinymce_lang( $arr ) {
|
||||
global $woocommerce;
|
||||
$arr[] = $woocommerce->plugin_path() . '/assets/js/admin/editor_plugin_lang.php';
|
||||
$arr['WooCommerceShortcodes'] = $woocommerce->plugin_path() . '/assets/js/admin/editor_plugin_lang.php';
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
|
|
@ -838,7 +838,7 @@ function woocommerce_permalink_settings_save() {
|
|||
return;
|
||||
|
||||
// We need to save the options ourselves; settings api does not trigger save for the permalinks page
|
||||
if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) ) {
|
||||
if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) && isset( $_POST['product_permalink'] ) ) {
|
||||
// Cat and tag bases
|
||||
$woocommerce_product_category_slug = woocommerce_clean( $_POST['woocommerce_product_category_slug'] );
|
||||
$woocommerce_product_tag_slug = woocommerce_clean( $_POST['woocommerce_product_tag_slug'] );
|
||||
|
|
|
@ -270,7 +270,7 @@ CREATE TABLE {$wpdb->prefix}woocommerce_attribute_taxonomies (
|
|||
KEY attribute_name (attribute_name)
|
||||
) $collate;
|
||||
CREATE TABLE {$wpdb->prefix}woocommerce_termmeta (
|
||||
meta_id bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
meta_id bigint(20) NOT NULL auto_increment,
|
||||
woocommerce_term_id bigint(20) NOT NULL,
|
||||
meta_key varchar(255) NULL,
|
||||
meta_value longtext NULL,
|
||||
|
|
|
@ -22,94 +22,99 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|||
*/
|
||||
function woocommerce_reports() {
|
||||
|
||||
$charts = apply_filters( 'woocommerce_reports_charts', array(
|
||||
'sales' => array(
|
||||
'title' => __( 'Sales', 'woocommerce' ),
|
||||
'charts' => array(
|
||||
$charts = array(
|
||||
'sales' => array(
|
||||
'title' => __( 'Sales', 'woocommerce' ),
|
||||
'charts' => array(
|
||||
array(
|
||||
'title' => __( 'Overview', 'woocommerce' ),
|
||||
'title' => __( 'Overview', 'woocommerce' ),
|
||||
'description' => '',
|
||||
'hide_title' => true,
|
||||
'function' => 'woocommerce_sales_overview'
|
||||
'hide_title' => true,
|
||||
'function' => 'woocommerce_sales_overview'
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Sales by day', 'woocommerce' ),
|
||||
'title' => __( 'Sales by day', 'woocommerce' ),
|
||||
'description' => '',
|
||||
'function' => 'woocommerce_daily_sales'
|
||||
'function' => 'woocommerce_daily_sales'
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Sales by month', 'woocommerce' ),
|
||||
'title' => __( 'Sales by month', 'woocommerce' ),
|
||||
'description' => '',
|
||||
'function' => 'woocommerce_monthly_sales'
|
||||
'function' => 'woocommerce_monthly_sales'
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Taxes by month', 'woocommerce' ),
|
||||
'title' => __( 'Product Sales', 'woocommerce' ),
|
||||
'description' => '',
|
||||
'function' => 'woocommerce_monthly_taxes'
|
||||
'function' => 'woocommerce_product_sales'
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Product Sales', 'woocommerce' ),
|
||||
'title' => __( 'Top sellers', 'woocommerce' ),
|
||||
'description' => '',
|
||||
'function' => 'woocommerce_product_sales'
|
||||
'function' => 'woocommerce_top_sellers'
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Top sellers', 'woocommerce' ),
|
||||
'title' => __( 'Top earners', 'woocommerce' ),
|
||||
'description' => '',
|
||||
'function' => 'woocommerce_top_sellers'
|
||||
'function' => 'woocommerce_top_earners'
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Top earners', 'woocommerce' ),
|
||||
'title' => __( 'Sales by category', 'woocommerce' ),
|
||||
'description' => '',
|
||||
'function' => 'woocommerce_top_earners'
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Sales by category', 'woocommerce' ),
|
||||
'description' => '',
|
||||
'function' => 'woocommerce_category_sales'
|
||||
'function' => 'woocommerce_category_sales'
|
||||
) )
|
||||
),
|
||||
'coupons' => array(
|
||||
'title' => __( 'Coupons', 'woocommerce' ),
|
||||
'charts' => array(
|
||||
'coupons' => array(
|
||||
'title' => __( 'Coupons', 'woocommerce' ),
|
||||
'charts' => array(
|
||||
array(
|
||||
'title' => __( 'Overview', 'woocommerce' ),
|
||||
'title' => __( 'Overview', 'woocommerce' ),
|
||||
'description' => '',
|
||||
'hide_title' => true,
|
||||
'function' => 'woocommerce_coupons_overview'
|
||||
'hide_title' => true,
|
||||
'function' => 'woocommerce_coupons_overview'
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Discounts by coupon', 'woocommerce' ),
|
||||
'title' => __( 'Discounts by coupon', 'woocommerce' ),
|
||||
'description' => '',
|
||||
'function' => 'woocommerce_coupon_discounts'
|
||||
'function' => 'woocommerce_coupon_discounts'
|
||||
)
|
||||
)
|
||||
),
|
||||
'customers' => array(
|
||||
'title' => __( 'Customers', 'woocommerce' ),
|
||||
'charts' => array(
|
||||
'customers' => array(
|
||||
'title' => __( 'Customers', 'woocommerce' ),
|
||||
'charts' => array(
|
||||
array(
|
||||
'title' => __( 'Overview', 'woocommerce' ),
|
||||
'title' => __( 'Overview', 'woocommerce' ),
|
||||
'description' => '',
|
||||
'hide_title' => true,
|
||||
'function' => 'woocommerce_customer_overview'
|
||||
'hide_title' => true,
|
||||
'function' => 'woocommerce_customer_overview'
|
||||
),
|
||||
)
|
||||
),
|
||||
'stock' => array(
|
||||
'title' => __( 'Stock', 'woocommerce' ),
|
||||
'charts' => array(
|
||||
'stock' => array(
|
||||
'title' => __( 'Stock', 'woocommerce' ),
|
||||
'charts' => array(
|
||||
array(
|
||||
'title' => __( 'Overview', 'woocommerce' ),
|
||||
'title' => __( 'Overview', 'woocommerce' ),
|
||||
'description' => '',
|
||||
'hide_title' => true,
|
||||
'function' => 'woocommerce_stock_overview'
|
||||
'hide_title' => true,
|
||||
'function' => 'woocommerce_stock_overview'
|
||||
),
|
||||
)
|
||||
)
|
||||
) );
|
||||
);
|
||||
|
||||
$first_tab = array_keys($charts);
|
||||
$first_chart = array_keys($charts[$first_tab[0]]['charts']);
|
||||
if ( get_option( 'woocommerce_calc_taxes' ) == 'yes' ) {
|
||||
$charts['sales']['charts'][] = array(
|
||||
'title' => __( 'Taxes by month', 'woocommerce' ),
|
||||
'description' => '',
|
||||
'function' => 'woocommerce_monthly_taxes'
|
||||
);
|
||||
}
|
||||
|
||||
$charts = apply_filters( 'woocommerce_reports_charts', $charts );
|
||||
|
||||
$first_tab = array_keys($charts);
|
||||
$first_chart = array_keys($charts[$first_tab[0]]['charts']);
|
||||
|
||||
$current_tab = isset( $_GET['tab'] ) ? sanitize_title( urldecode( $_GET['tab'] ) ) : $first_tab[0];
|
||||
$current_chart = isset( $_GET['chart'] ) ? absint( urldecode( $_GET['chart'] ) ) : $first_chart[0];
|
||||
|
@ -1001,6 +1006,8 @@ function woocommerce_top_sellers() {
|
|||
$orders_link = admin_url( 'edit.php?s&post_status=all&post_type=shop_order&action=-1&s=&shop_order_status=' . implode( ",", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) );
|
||||
}
|
||||
|
||||
$orders_link = apply_filters( 'woocommerce_reports_order_link', $orders_link, $product_id, $product_title );
|
||||
|
||||
echo '<tr><th>' . $product_name . '</th><td width="1%"><span>' . esc_html( $sales ) . '</span></td><td class="bars"><a href="' . esc_url( $orders_link ) . '" style="width:' . esc_attr( $width ) . '%"> </a></td></tr>';
|
||||
}
|
||||
?>
|
||||
|
@ -1098,6 +1105,8 @@ function woocommerce_top_earners() {
|
|||
$orders_link = admin_url( 'edit.php?s&post_status=all&post_type=shop_order&action=-1&s=&shop_order_status=' . implode( ",", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) );
|
||||
}
|
||||
|
||||
$orders_link = apply_filters( 'woocommerce_reports_order_link', $orders_link, $product_id, $product_title );
|
||||
|
||||
echo '<tr><th>' . $product_name . '</th><td width="1%"><span>' . woocommerce_price( $sales ) . '</span></td><td class="bars"><a href="' . esc_url( $orders_link ) . '" style="width:' . esc_attr( $width ) . '%"> </a></td></tr>';
|
||||
}
|
||||
?>
|
||||
|
@ -1207,6 +1216,7 @@ function woocommerce_product_sales() {
|
|||
$width2 = ($product_totals[$date]>0) ? (round($product_totals[$date]) / round($max_totals)) * 100 : 0;
|
||||
|
||||
$orders_link = admin_url( 'edit.php?s&post_status=all&post_type=shop_order&action=-1&s=' . urlencode( implode( ' ', $chosen_product_titles ) ) . '&m=' . date( 'Ym', strtotime( $date . '01' ) ) . '&shop_order_status=' . implode( ",", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) );
|
||||
$orders_link = apply_filters( 'woocommerce_reports_order_link', $orders_link, $chosen_product_ids, $chosen_product_titles );
|
||||
|
||||
echo '<tr><th><a href="' . esc_url( $orders_link ) . '">' . date_i18n( 'F', strtotime( $date . '01' ) ) . '</a></th>
|
||||
<td width="1%"><span>' . esc_html( $sales ) . '</span><span class="alt">' . woocommerce_price( $product_totals[ $date ] ) . '</span></td>
|
||||
|
|
|
@ -229,11 +229,37 @@ function woocommerce_status_report() {
|
|||
|
||||
foreach ( $active_plugins as $plugin ) {
|
||||
|
||||
$plugin_data = @get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
|
||||
$plugin_data = @get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
|
||||
$dirname = dirname( $plugin );
|
||||
$version_string = '';
|
||||
|
||||
if ( ! empty( $plugin_data['Name'] ) ) {
|
||||
|
||||
$wc_plugins[] = $plugin_data['Name'] . ' ' . __( 'by', 'woocommerce' ) . ' ' . $plugin_data['Author'] . ' ' . __( 'version', 'woocommerce' ) . ' ' . $plugin_data['Version'];
|
||||
if ( strstr( $dirname, 'woocommerce' ) ) {
|
||||
|
||||
if ( false === ( $version_data = get_transient( $plugin . '_version_data' ) ) ) {
|
||||
$changelog = wp_remote_get( 'http://www.woothemes.com/changelogs/extensions/' . $dirname . '/changelog.txt' );
|
||||
$cl_lines = explode( "\n", wp_remote_retrieve_body( $changelog ) );
|
||||
if ( ! empty( $cl_lines ) ) {
|
||||
foreach ( $cl_lines as $line_num => $cl_line ) {
|
||||
if ( preg_match( '/^[0-9]/', $cl_line ) ) {
|
||||
|
||||
$date = str_replace( '.' , '-' , trim( substr( $cl_line , 0 , strpos( $cl_line , '-' ) ) ) );
|
||||
$version = preg_replace( '~[^0-9,.]~' , '' ,stristr( $cl_line , "version" ) );
|
||||
$update = trim( str_replace( "*" , "" , $cl_lines[ $line_num + 1 ] ) );
|
||||
$version_data = array( 'date' => $date , 'version' => $version , 'update' => $update , 'changelog' => $changelog );
|
||||
set_transient( $plugin . '_version_data', $version_data , 60*60*12 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $version_data['version'] ) && version_compare( $version_data['version'], $plugin_data['Version'], '!=' ) )
|
||||
$version_string = ' – <strong style="color:red;">' . $version_data['version'] . ' ' . __( 'is available', 'woocommerce' ) . '</strong>';
|
||||
}
|
||||
|
||||
$wc_plugins[] = $plugin_data['Name'] . ' ' . __( 'by', 'woocommerce' ) . ' ' . $plugin_data['Author'] . ' ' . __( 'version', 'woocommerce' ) . ' ' . $plugin_data['Version'] . $version_string;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -434,7 +460,7 @@ function woocommerce_status_report() {
|
|||
|
||||
jQuery('a.debug-report').click(function(){
|
||||
|
||||
var report = "data:text/plain;charset=utf-8,";
|
||||
var report = "";
|
||||
|
||||
jQuery('.wc_status_table thead, .wc_status_table tbody').each(function(){
|
||||
|
||||
|
@ -457,10 +483,11 @@ function woocommerce_status_report() {
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
jQuery(this).attr( 'href', encodeURI( report ) );
|
||||
var blob = new Blob( [report] );
|
||||
|
||||
jQuery(this).attr( 'href', window.URL.createObjectURL( blob ) );
|
||||
|
||||
return true;
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1174,9 +1174,6 @@ table.wp-list-table {
|
|||
.column-product_cat, .column-product_tag {
|
||||
width: 11% !important;
|
||||
}
|
||||
.column-sku, .column-product_cat, .column-product_tag, .column-is_in_stock, .column-price, .column-product_date {
|
||||
width: 9%;
|
||||
}
|
||||
.column-featured, .column-product_type {
|
||||
width: 46px;
|
||||
text-align: left !important;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -34,6 +34,7 @@ div.pp_woocommerce {
|
|||
.border_radius(3px);
|
||||
.box_shadow(0,1px,3px,0,rgba(0,0,0,0.25));
|
||||
padding:60px 0 40px 0;
|
||||
.clearfix;
|
||||
}
|
||||
.pp_loaderIcon {
|
||||
background: url(../images/ajax-loader.gif) center no-repeat;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1288,6 +1288,13 @@ p.demo_store {
|
|||
padding: 3px;
|
||||
margin: 0 0 6px;
|
||||
|
||||
[placeholder]:focus::-webkit-input-placeholder {
|
||||
-webkit-transition: opacity 0.5s 0.5s ease;
|
||||
-moz-transition: opacity 0.5s 0.5s ease;
|
||||
transition: opacity 0.5s 0.5s ease;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
label {
|
||||
display:block;
|
||||
}
|
||||
|
@ -1330,14 +1337,14 @@ p.demo_store {
|
|||
-webkit-box-shadow:none;
|
||||
box-shadow:none;
|
||||
}
|
||||
&.woocommerce-validated {
|
||||
&.validate-required.woocommerce-validated {
|
||||
input.input-text {
|
||||
background-image: url(../images/icons/valid.png);
|
||||
background-position: 95% center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
}
|
||||
&.woocommerce-invalid {
|
||||
&.validate-required.woocommerce-invalid {
|
||||
input.input-text {
|
||||
background-image: url(../images/icons/invalid.png);
|
||||
background-position: 95% center;
|
||||
|
@ -1419,7 +1426,6 @@ p.demo_store {
|
|||
clear:left;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#shiptobilling {
|
||||
float: right;
|
||||
line-height: 1.62em;
|
||||
|
@ -1430,6 +1436,9 @@ p.demo_store {
|
|||
font-size: 0.6875em;
|
||||
}
|
||||
}
|
||||
.shipping_address {
|
||||
clear:both;
|
||||
}
|
||||
}
|
||||
|
||||
/* Payment box - appears on checkout and page page */
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
b.addSeparator();
|
||||
|
||||
c=b.addMenu({title:"Pages"});
|
||||
c=b.addMenu({title:ed.getLang('woocommerce.pages')});
|
||||
a.addImmediate(c, ed.getLang('woocommerce.cart'),"[woocommerce_cart]" );
|
||||
a.addImmediate(c, ed.getLang('woocommerce.checkout'),"[woocommerce_checkout]" );
|
||||
a.addImmediate(c, ed.getLang('woocommerce.my_account'),"[woocommerce_my_account]" );
|
||||
|
|
|
@ -1 +1 @@
|
|||
(function(){tinymce.create("tinymce.plugins.WooCommerceShortcodes",{init:function(e,t){},createControl:function(e,t){var n=tinymce.activeEditor;if(e=="woocommerce_shortcodes_button"){e=t.createMenuButton("woocommerce_shortcodes_button",{title:n.getLang("woocommerce.insert"),icons:!1});var r=this;e.onRenderMenu.add(function(e,t){r.addImmediate(t,n.getLang("woocommerce.order_tracking"),"[woocommerce_order_tracking]");r.addImmediate(t,n.getLang("woocommerce.price_button"),'[add_to_cart id="" sku=""]');r.addImmediate(t,n.getLang("woocommerce.product_by_sku"),'[product id="" sku=""]');r.addImmediate(t,n.getLang("woocommerce.products_by_sku"),'[products ids="" skus=""]');r.addImmediate(t,n.getLang("woocommerce.product_categories"),'[product_categories number=""]');r.addImmediate(t,n.getLang("woocommerce.products_by_cat_slug"),'[product_category category="" per_page="12" columns="4" orderby="date" order="desc"]');t.addSeparator();r.addImmediate(t,n.getLang("woocommerce.recent_products"),'[recent_products per_page="12" columns="4" orderby="date" order="desc"]');r.addImmediate(t,n.getLang("woocommerce.featured_products"),'[featured_products per_page="12" columns="4" orderby="date" order="desc"]');t.addSeparator();r.addImmediate(t,n.getLang("woocommerce.shop_messages"),"[woocommerce_messages]");t.addSeparator();e=t.addMenu({title:"Pages"});r.addImmediate(e,n.getLang("woocommerce.cart"),"[woocommerce_cart]");r.addImmediate(e,n.getLang("woocommerce.checkout"),"[woocommerce_checkout]");r.addImmediate(e,n.getLang("woocommerce.my_account"),"[woocommerce_my_account]");r.addImmediate(e,n.getLang("woocommerce.edit_address"),"[woocommerce_edit_address]");r.addImmediate(e,n.getLang("woocommerce.change_password"),"[woocommerce_change_password]");r.addImmediate(e,n.getLang("woocommerce.view_order"),"[woocommerce_view_order]");r.addImmediate(e,n.getLang("woocommerce.pay"),"[woocommerce_pay]");r.addImmediate(e,n.getLang("woocommerce.thankyou"),"[woocommerce_thankyou]")});return e}return null},addImmediate:function(e,t,n){e.add({title:t,onclick:function(){tinyMCE.activeEditor.execCommand("mceInsertContent",!1,n)}})}});tinymce.PluginManager.add("WooCommerceShortcodes",tinymce.plugins.WooCommerceShortcodes)})();
|
||||
(function(){tinymce.create("tinymce.plugins.WooCommerceShortcodes",{init:function(e,t){},createControl:function(e,t){var n=tinymce.activeEditor;if(e=="woocommerce_shortcodes_button"){e=t.createMenuButton("woocommerce_shortcodes_button",{title:n.getLang("woocommerce.insert"),icons:!1});var r=this;e.onRenderMenu.add(function(e,t){r.addImmediate(t,n.getLang("woocommerce.order_tracking"),"[woocommerce_order_tracking]");r.addImmediate(t,n.getLang("woocommerce.price_button"),'[add_to_cart id="" sku=""]');r.addImmediate(t,n.getLang("woocommerce.product_by_sku"),'[product id="" sku=""]');r.addImmediate(t,n.getLang("woocommerce.products_by_sku"),'[products ids="" skus=""]');r.addImmediate(t,n.getLang("woocommerce.product_categories"),'[product_categories number=""]');r.addImmediate(t,n.getLang("woocommerce.products_by_cat_slug"),'[product_category category="" per_page="12" columns="4" orderby="date" order="desc"]');t.addSeparator();r.addImmediate(t,n.getLang("woocommerce.recent_products"),'[recent_products per_page="12" columns="4" orderby="date" order="desc"]');r.addImmediate(t,n.getLang("woocommerce.featured_products"),'[featured_products per_page="12" columns="4" orderby="date" order="desc"]');t.addSeparator();r.addImmediate(t,n.getLang("woocommerce.shop_messages"),"[woocommerce_messages]");t.addSeparator();e=t.addMenu({title:n.getLang("woocommerce.pages")});r.addImmediate(e,n.getLang("woocommerce.cart"),"[woocommerce_cart]");r.addImmediate(e,n.getLang("woocommerce.checkout"),"[woocommerce_checkout]");r.addImmediate(e,n.getLang("woocommerce.my_account"),"[woocommerce_my_account]");r.addImmediate(e,n.getLang("woocommerce.edit_address"),"[woocommerce_edit_address]");r.addImmediate(e,n.getLang("woocommerce.change_password"),"[woocommerce_change_password]");r.addImmediate(e,n.getLang("woocommerce.view_order"),"[woocommerce_view_order]");r.addImmediate(e,n.getLang("woocommerce.pay"),"[woocommerce_pay]");r.addImmediate(e,n.getLang("woocommerce.thankyou"),"[woocommerce_thankyou]")});return e}return null},addImmediate:function(e,t,n){e.add({title:t,onclick:function(){tinyMCE.activeEditor.execCommand("mceInsertContent",!1,n)}})}});tinymce.PluginManager.add("WooCommerceShortcodes",tinymce.plugins.WooCommerceShortcodes)})();
|
|
@ -130,6 +130,8 @@
|
|||
all_variations = window[ "product_variations" ][ product_id ];
|
||||
if ( ! all_variations )
|
||||
all_variations = window[ "product_variations" ];
|
||||
if ( ! all_variations )
|
||||
all_variations = window[ "product_variations_" + product_id ];
|
||||
|
||||
var matching_variations = $.fn.wc_variation_form.find_matching_variations( all_variations, current_settings );
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -171,7 +171,7 @@ jQuery(document).ready(function($) {
|
|||
})
|
||||
|
||||
// Address-fields which refresh totals when all required fields are filled
|
||||
.on( 'change', '.address-field input.input-text', function() {
|
||||
.on( 'change', '.address-field input.input-text, .update_totals_on_change input.input-text', function() {
|
||||
if ( dirtyInput ) {
|
||||
input_changed();
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ jQuery(document).ready(function($) {
|
|||
input_changed();
|
||||
})
|
||||
|
||||
.on( 'keydown', '.address-field input.input-text', function( e ){
|
||||
.on( 'keydown', '.address-field input.input-text, .update_totals_on_change input.input-text', function( e ){
|
||||
var code = e.keyCode || e.which;
|
||||
if ( code == '9' )
|
||||
return;
|
||||
|
@ -345,7 +345,7 @@ jQuery(document).ready(function($) {
|
|||
|
||||
var thisform = wrapper;
|
||||
|
||||
if ( locale[country] ) {
|
||||
if ( typeof locale[country] != 'undefined' ) {
|
||||
var thislocale = locale[country];
|
||||
} else {
|
||||
var thislocale = locale['default'];
|
||||
|
@ -434,7 +434,8 @@ jQuery(document).ready(function($) {
|
|||
});
|
||||
|
||||
// Update on page load
|
||||
if ( woocommerce_params.is_checkout == 1 )
|
||||
if ( woocommerce_params.is_checkout == 1 ) {
|
||||
$('body').trigger('init_checkout');
|
||||
}
|
||||
|
||||
});
|
File diff suppressed because one or more lines are too long
|
@ -30,7 +30,7 @@
|
|||
deeplinking: true, /* Allow prettyPhoto to update the url to enable deeplinking. */
|
||||
overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
|
||||
overlay_gallery_max: 30, /* Maximum number of pictures in the overlay gallery */
|
||||
keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
|
||||
keyboard_shortcuts: false, /* Set to false if you open forms inside prettyPhoto */
|
||||
changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
|
||||
callback: function(){}, /* Called when prettyPhoto is closed */
|
||||
ie6_fallback: true,
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -231,7 +231,7 @@ class WC_Product {
|
|||
* @return void
|
||||
*/
|
||||
function set_stock_status( $status ) {
|
||||
$status = 'outofstock' ? 'outofstock' : 'instock';
|
||||
$status = ( 'outofstock' === $status ) ? 'outofstock' : 'instock';
|
||||
|
||||
if ( $this->stock_status != $status ) {
|
||||
update_post_meta( $this->id, '_stock_status', $status );
|
||||
|
@ -943,24 +943,22 @@ class WC_Product {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the product rating in html format - ratings are stored in transient cache.
|
||||
* Returns the product rating in html format.
|
||||
*
|
||||
* @access public
|
||||
* @param string $location (default: '')
|
||||
* @return void
|
||||
* @param string $rating (default: '')
|
||||
* @return string
|
||||
*/
|
||||
function get_rating_html( $location = '' ) {
|
||||
function get_rating_html( $rating = null ) {
|
||||
|
||||
$average_rating = $this->get_average_rating();
|
||||
if ( ! is_numeric( $rating ) )
|
||||
$rating = $this->get_average_rating();
|
||||
|
||||
if ( $average_rating > 0 ) {
|
||||
if ( $rating > 0 ) {
|
||||
|
||||
if ( $location )
|
||||
$location = '_' . $location;
|
||||
$rating_html = '<div class="star-rating" title="' . sprintf( __( 'Rated %s out of 5', 'woocommerce' ), $rating ) . '">';
|
||||
|
||||
$rating_html = '<div class="star-rating" title="' . sprintf( __( 'Rated %s out of 5', 'woocommerce' ), $average_rating ) . '">';
|
||||
|
||||
$rating_html .= '<span style="width:' . ( ( $average_rating / 5 ) * 100 ) . '%"><strong class="rating">' . $average_rating . '</strong> ' . __( 'out of 5', 'woocommerce' ) . '</span>';
|
||||
$rating_html .= '<span style="width:' . ( ( $rating / 5 ) * 100 ) . '%"><strong class="rating">' . $rating . '</strong> ' . __( 'out of 5', 'woocommerce' ) . '</span>';
|
||||
|
||||
$rating_html .= '</div>';
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ abstract class WC_Settings_API {
|
|||
* @param mixed $empty_value
|
||||
* @return void
|
||||
*/
|
||||
public function get_option( $key, $empty_value = '' ) {
|
||||
public function get_option( $key, $empty_value = null ) {
|
||||
|
||||
if ( empty( $this->settings ) )
|
||||
$this->init_settings();
|
||||
|
@ -147,7 +147,7 @@ abstract class WC_Settings_API {
|
|||
$this->settings[ $key ] = isset( $this->form_fields[ $key ]['default'] ) ? $this->form_fields[ $key ]['default'] : '';
|
||||
}
|
||||
|
||||
if ( empty( $this->settings[ $key ] ) )
|
||||
if ( ! is_null( $empty_value ) && empty( $this->settings[ $key ] ) )
|
||||
$this->settings[ $key ] = $empty_value;
|
||||
|
||||
return $this->settings[ $key ];
|
||||
|
|
|
@ -702,14 +702,14 @@ class WC_Cart {
|
|||
* @return array merged taxes
|
||||
*/
|
||||
public function get_taxes() {
|
||||
$merged_taxes = array();
|
||||
$taxes = array();
|
||||
|
||||
// Merge
|
||||
foreach ( array_keys( $this->taxes + $this->shipping_taxes ) as $key ) {
|
||||
$merged_taxes[ $key ] = ( isset( $this->shipping_taxes[ $key ] ) ? $this->shipping_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
|
||||
$taxes[ $key ] = ( isset( $this->shipping_taxes[ $key ] ) ? $this->shipping_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
|
||||
}
|
||||
|
||||
return $merged_taxes;
|
||||
return apply_filters( 'woocommerce_cart_get_taxes', $taxes, $this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -718,16 +718,43 @@ class WC_Cart {
|
|||
* @return array merged taxes
|
||||
*/
|
||||
public function get_formatted_taxes() {
|
||||
|
||||
$taxes = $this->get_taxes();
|
||||
|
||||
foreach ( $taxes as $key => $tax )
|
||||
if ( $tax > 0 )
|
||||
if ( is_numeric( $tax ) )
|
||||
$taxes[ $key ] = woocommerce_price( $tax );
|
||||
|
||||
return apply_filters( 'woocommerce_cart_formatted_taxes', $taxes, $this );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get taxes, merged by code, formatted ready for output.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function get_tax_totals() {
|
||||
$taxes = $this->get_taxes();
|
||||
$tax_totals = array();
|
||||
|
||||
foreach ( $taxes as $key => $tax ) {
|
||||
|
||||
$code = $this->tax->get_rate_code( $key );
|
||||
|
||||
if ( ! isset( $tax_totals[ $code ] ) ) {
|
||||
$tax_totals[ $code ] = new stdClass();
|
||||
$tax_totals[ $code ]->amount = 0;
|
||||
}
|
||||
|
||||
$tax_totals[ $code ]->is_compound = $this->tax->is_compound( $key );
|
||||
$tax_totals[ $code ]->label = $this->tax->get_rate_label( $key );
|
||||
$tax_totals[ $code ]->amount += $tax;
|
||||
$tax_totals[ $code ]->formatted_amount = woocommerce_price( $tax_totals[ $code ]->amount );
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_cart_tax_totals', $tax_totals, $this );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Add to cart handling */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
@ -1386,14 +1413,13 @@ class WC_Cart {
|
|||
|
||||
// Line subtotal + tax
|
||||
$line_subtotal_tax = get_option('woocommerce_tax_round_at_subtotal') == 'no' ? $this->tax->round( $tax_amount ) : $tax_amount;
|
||||
$line_subtotal = $row_base_price - $this->tax->get_tax_total( $base_taxes );
|
||||
$line_subtotal = $row_base_price - array_sum( $base_taxes );
|
||||
|
||||
// Adjusted price
|
||||
$adjusted_price = ( $row_base_price - array_sum( $base_taxes ) + array_sum( $taxes ) ) / $values['quantity'];
|
||||
|
||||
// Apply discounts
|
||||
$discounted_price = $this->get_discounted_price( $values, $adjusted_price, true );
|
||||
|
||||
$discounted_taxes = $this->tax->calc_tax( $discounted_price * $values['quantity'], $tax_rates, true );
|
||||
$discounted_tax_amount = array_sum( $discounted_taxes ); // Sum taxes
|
||||
|
||||
|
@ -1447,7 +1473,6 @@ class WC_Cart {
|
|||
$this->cart_contents[ $cart_item_key ]['line_tax'] = $line_tax;
|
||||
$this->cart_contents[ $cart_item_key ]['line_subtotal'] = $line_subtotal;
|
||||
$this->cart_contents[ $cart_item_key ]['line_subtotal_tax'] = $line_subtotal_tax;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,8 +76,8 @@ class WC_Checkout {
|
|||
|
||||
$this->checkout_fields['account']['account_password-2'] = array(
|
||||
'type' => 'password',
|
||||
'label' => __( 'Account password', 'woocommerce' ),
|
||||
'placeholder' => _x( 'Password', 'placeholder', 'woocommerce' ),
|
||||
'label' => __( 'Confirm password', 'woocommerce' ),
|
||||
'placeholder' => _x( 'Confirm password', 'placeholder', 'woocommerce' ),
|
||||
'class' => array( 'form-row-last' ),
|
||||
'label_class' => array( 'hidden' )
|
||||
);
|
||||
|
|
|
@ -885,6 +885,11 @@ class WC_Countries {
|
|||
'required' => false
|
||||
)
|
||||
),
|
||||
'PT' => array(
|
||||
'state' => array(
|
||||
'required' => false
|
||||
)
|
||||
),
|
||||
'RO' => array(
|
||||
'state' => array(
|
||||
'required' => false
|
||||
|
|
|
@ -376,7 +376,8 @@ class WC_Coupon {
|
|||
if ( $valid ) {
|
||||
return true;
|
||||
} else {
|
||||
$error_code = self::E_WC_COUPON_INVALID_FILTERED;
|
||||
if ( is_null( $error_code ) )
|
||||
$error_code = self::E_WC_COUPON_INVALID_FILTERED;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
|
@ -486,6 +486,34 @@ class WC_Order {
|
|||
return $this->get_items( 'tax' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get taxes, merged by code, formatted ready for output.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function get_tax_totals() {
|
||||
$taxes = $this->get_items( 'tax' );
|
||||
$tax_totals = array();
|
||||
|
||||
foreach ( $taxes as $key => $tax ) {
|
||||
|
||||
$code = $tax[ 'name' ];
|
||||
|
||||
if ( ! isset( $tax_totals[ $code ] ) ) {
|
||||
$tax_totals[ $code ] = new stdClass();
|
||||
$tax_totals[ $code ]->amount = 0;
|
||||
}
|
||||
|
||||
$tax_totals[ $code ]->is_compound = $tax[ 'compound' ];
|
||||
$tax_totals[ $code ]->label = isset( $tax[ 'label' ] ) ? $tax[ 'label' ] : $tax[ 'name' ];
|
||||
$tax_totals[ $code ]->amount += $tax[ 'tax_amount' ] + $tax[ 'shipping_tax_amount' ];
|
||||
$tax_totals[ $code ]->formatted_amount = woocommerce_price( $tax_totals[ $code ]->amount );
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_order_tax_totals', $tax_totals, $this );
|
||||
}
|
||||
|
||||
/**
|
||||
* has_meta function for order items.
|
||||
*
|
||||
|
@ -957,45 +985,10 @@ class WC_Order {
|
|||
|
||||
// Tax for tax exclusive prices
|
||||
if ( $tax_display == 'excl' ) {
|
||||
if ( sizeof( $this->get_taxes() ) > 0 ) {
|
||||
|
||||
$has_compound_tax = false;
|
||||
|
||||
foreach ( $this->get_taxes() as $tax ) {
|
||||
if ( $tax[ 'compound' ] ) {
|
||||
$has_compound_tax = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
$total_rows[ sanitize_title( $tax[ 'name' ] ) ] = array(
|
||||
'label' => isset( $tax[ 'label' ] ) ? $tax[ 'label' ] : $tax[ 'name' ] . ':',
|
||||
'value' => woocommerce_price( ( $tax[ 'tax_amount' ] + $tax[ 'shipping_tax_amount' ] ) )
|
||||
);
|
||||
}
|
||||
|
||||
if ( $has_compound_tax ) {
|
||||
if ( $subtotal = $this->get_subtotal_to_display( true ) ) {
|
||||
$total_rows['subtotal'] = array(
|
||||
'label' => __( 'Subtotal:', 'woocommerce' ),
|
||||
'value' => $subtotal
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $this->get_taxes() as $tax ) {
|
||||
if ( ! $tax[ 'compound' ] )
|
||||
continue;
|
||||
|
||||
$total_rows[ sanitize_title( $tax[ 'name' ] ) ] = array(
|
||||
'label' => isset( $tax[ 'label' ] ) ? $tax[ 'label' ] : $tax[ 'name' ] . ':',
|
||||
'value' => woocommerce_price( ( $tax[ 'tax_amount' ] + $tax[ 'shipping_tax_amount' ] ) )
|
||||
);
|
||||
}
|
||||
|
||||
} elseif ( $this->get_total_tax() > 0 ) {
|
||||
$total_rows['tax'] = array(
|
||||
'label' => $woocommerce->countries->tax_or_vat(),
|
||||
'value' => woocommerce_price( $this->get_total_tax() )
|
||||
foreach ( $this->get_tax_totals() as $code => $tax ) {
|
||||
$total_rows[ sanitize_title( $code ) ] = array(
|
||||
'label' => $tax->label . ':',
|
||||
'value' => $tax->formatted_amount
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1016,17 +1009,8 @@ class WC_Order {
|
|||
|
||||
$tax_string_array = array();
|
||||
|
||||
if ( sizeof( $this->get_taxes() ) > 0 ) {
|
||||
|
||||
foreach ( $this->get_taxes() as $tax ) {
|
||||
|
||||
$tax_string_array[] = sprintf( '%s %s', woocommerce_price( ( $tax[ 'tax_amount' ] + $tax[ 'shipping_tax_amount' ] ) ), isset( $tax[ 'label' ] ) ? $tax[ 'label' ] : $tax[ 'name' ] );
|
||||
}
|
||||
|
||||
} elseif ( $this->get_total_tax() > 0 ) {
|
||||
|
||||
$tax_string_array[] = sprintf( '%s %s', woocommerce_price( $this->get_total_tax() ), $woocommerce->countries->tax_or_vat() );
|
||||
|
||||
foreach ( $this->get_tax_totals() as $code => $tax ) {
|
||||
$tax_string_array[] = sprintf( '%s %s', $tax->formatted_amount, $tax->label );
|
||||
}
|
||||
|
||||
if ( ! empty( $tax_string_array ) )
|
||||
|
@ -1252,6 +1236,9 @@ class WC_Order {
|
|||
if ( $new_status->slug == 'cancelled' )
|
||||
$this->decrease_coupon_usage_counts();
|
||||
|
||||
// Update last modified
|
||||
wp_update_post( array( 'ID' => $this->id ) );
|
||||
|
||||
$this->status = $new_status->slug;
|
||||
}
|
||||
|
||||
|
|
|
@ -367,34 +367,43 @@ class WC_Query {
|
|||
$order = ! empty( $orderby_value[1] ) ? $orderby_value[1] : $order;
|
||||
}
|
||||
|
||||
$orderby = strtolower( $orderby );
|
||||
$order = strtoupper( $order );
|
||||
|
||||
$args = array();
|
||||
|
||||
switch ( $orderby ) {
|
||||
case 'date' :
|
||||
$args['orderby'] = 'date';
|
||||
$args['order'] = $order == 'asc' ? 'asc' : 'desc';
|
||||
$args['order'] = $order == 'ASC' ? 'ASC' : 'DESC';
|
||||
$args['meta_key'] = '';
|
||||
break;
|
||||
case 'price' :
|
||||
$args['orderby'] = 'meta_value_num';
|
||||
$args['order'] = $order == 'desc' ? 'desc' : 'asc';
|
||||
$args['order'] = $order == 'DESC' ? 'DESC' : 'ASC';
|
||||
$args['meta_key'] = '_price';
|
||||
break;
|
||||
case 'popularity' :
|
||||
$args['orderby'] = 'meta_value_num';
|
||||
$args['order'] = $order == 'asc' ? 'asc' : 'desc';
|
||||
$args['order'] = $order == 'ASC' ? 'ASC' : 'DESC';
|
||||
$args['meta_key'] = 'total_sales';
|
||||
break;
|
||||
case 'rating' :
|
||||
$args['orderby'] = 'menu_order title';
|
||||
$args['order'] = $order == 'desc' ? 'desc' : 'asc';
|
||||
$args['order'] = $order == 'DESC' ? 'DESC' : 'ASC';
|
||||
$args['meta_key'] = '';
|
||||
|
||||
add_filter( 'posts_clauses', array( $this, 'order_by_rating_post_clauses' ) );
|
||||
break;
|
||||
case 'title' :
|
||||
$args['orderby'] = 'title';
|
||||
$args['order'] = $order == 'DESC' ? 'DESC' : 'ASC';
|
||||
$args['meta_key'] = '';
|
||||
break;
|
||||
// default - menu_order
|
||||
default :
|
||||
$args['orderby'] = 'menu_order title';
|
||||
$args['order'] = $order == 'desc' ? 'desc' : 'asc';
|
||||
$args['order'] = $order == 'DESC' ? 'DESC' : 'ASC';
|
||||
$args['meta_key'] = '';
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -702,7 +702,7 @@ class WC_Shortcodes {
|
|||
'ignore_sticky_posts' => 1,
|
||||
'posts_per_page' => $per_page,
|
||||
'meta_key' => 'total_sales',
|
||||
'orderby' => 'meta_value',
|
||||
'orderby' => 'meta_value_num',
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'key' => '_visibility',
|
||||
|
|
|
@ -89,37 +89,68 @@ class WC_Tax {
|
|||
|
||||
// Run the query
|
||||
$found_rates = $wpdb->get_results( $wpdb->prepare( "
|
||||
SELECT tax_rates.* FROM
|
||||
{$wpdb->prefix}woocommerce_tax_rates as tax_rates
|
||||
LEFT OUTER JOIN
|
||||
{$wpdb->prefix}woocommerce_tax_rate_locations as locations ON tax_rates.tax_rate_id = locations.tax_rate_id
|
||||
WHERE
|
||||
tax_rate_country IN ( %s, '' )
|
||||
AND tax_rate_state IN ( %s, '' )
|
||||
AND tax_rate_class = %s
|
||||
AND (
|
||||
SELECT * FROM (
|
||||
SELECT tax_rates.* FROM
|
||||
{$wpdb->prefix}woocommerce_tax_rates as tax_rates
|
||||
LEFT OUTER JOIN
|
||||
{$wpdb->prefix}woocommerce_tax_rate_locations as locations ON tax_rates.tax_rate_id = locations.tax_rate_id
|
||||
LEFT OUTER JOIN
|
||||
{$wpdb->prefix}woocommerce_tax_rate_locations as locations2 ON tax_rates.tax_rate_id = locations2.tax_rate_id
|
||||
WHERE
|
||||
tax_rate_country IN ( %s, '' )
|
||||
AND tax_rate_state IN ( %s, '' )
|
||||
AND tax_rate_class = %s
|
||||
AND
|
||||
(
|
||||
locations.location_type = 'postcode' AND locations.location_code IN ('" . implode( "','", $valid_postcodes ) . "')
|
||||
(
|
||||
locations.location_type IS NULL
|
||||
)
|
||||
OR
|
||||
(
|
||||
locations.location_type = 'postcode'
|
||||
AND locations.location_code IN ('" . implode( "','", $valid_postcodes ) . "')
|
||||
AND locations2.location_type = 'city'
|
||||
AND locations2.location_code = %s
|
||||
)
|
||||
OR
|
||||
(
|
||||
locations.location_type = 'postcode'
|
||||
AND locations.location_code IN ('" . implode( "','", $valid_postcodes ) . "')
|
||||
AND 0 = (
|
||||
SELECT COUNT(*) FROM {$wpdb->prefix}woocommerce_tax_rate_locations as sublocations
|
||||
WHERE sublocations.location_type = 'city'
|
||||
AND sublocations.tax_rate_id = tax_rates.tax_rate_id
|
||||
)
|
||||
)
|
||||
OR
|
||||
(
|
||||
locations.location_type = 'city'
|
||||
AND locations.location_code = %s
|
||||
AND 0 = (
|
||||
SELECT COUNT(*) FROM {$wpdb->prefix}woocommerce_tax_rate_locations as sublocations
|
||||
WHERE sublocations.location_type = 'postcode'
|
||||
AND sublocations.tax_rate_id = tax_rates.tax_rate_id
|
||||
)
|
||||
)
|
||||
)
|
||||
OR
|
||||
(
|
||||
locations.location_type = 'city' AND locations.location_code = %s
|
||||
)
|
||||
OR locations.location_type IS null
|
||||
)
|
||||
GROUP BY
|
||||
tax_rate_id
|
||||
ORDER BY
|
||||
tax_rate_priority, tax_rate_order
|
||||
) as ordered_taxes
|
||||
GROUP BY
|
||||
tax_rate_priority
|
||||
ORDER BY
|
||||
tax_rate_priority, tax_rate_order
|
||||
",
|
||||
strtoupper( $country ),
|
||||
strtoupper( $state ),
|
||||
sanitize_title( $tax_class ),
|
||||
strtoupper( $city ),
|
||||
strtoupper( $city )
|
||||
) );
|
||||
|
||||
// Put results into array
|
||||
$matched_tax_rates = array();
|
||||
|
||||
foreach ( $found_rates as $found_rate )
|
||||
$matched_tax_rates[ $found_rate->tax_rate_id ] = array(
|
||||
'rate' => $found_rate->tax_rate,
|
||||
|
@ -128,12 +159,6 @@ class WC_Tax {
|
|||
'compound' => $found_rate->tax_rate_compound ? 'yes' : 'no'
|
||||
);
|
||||
|
||||
/*
|
||||
echo '<pre>' . __( 'Matched tax rates:', 'woocommerce' );
|
||||
var_dump( $matched_tax_rates );
|
||||
echo '</pre>';
|
||||
*/
|
||||
|
||||
return apply_filters( 'woocommerce_matched_tax_rates', $matched_tax_rates, $country, $state, $postcode, $city, $tax_class );
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ class WC_Gateway_Mijireh extends WC_Payment_Gateway {
|
|||
'description' => array(
|
||||
'title' => __( 'Description', 'woocommerce' ),
|
||||
'type' => 'textarea',
|
||||
'default' => __( 'Pay securely with you credit card.', 'woocommerce' ),
|
||||
'default' => __( 'Pay securely with your credit card.', 'woocommerce' ),
|
||||
'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce' ),
|
||||
),
|
||||
);
|
||||
|
@ -393,4 +393,4 @@ class WC_Gateway_Mijireh extends WC_Payment_Gateway {
|
|||
echo '<a class="nobold" href="' . Mijireh::preview_checkout_link() . '" id="view_slurp" target="_new">Preview Checkout Page</a></p>';
|
||||
echo "</div>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -357,7 +357,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
|
|||
|
||||
$paypal_args[ 'item_name_' . $item_loop ] = $item_name;
|
||||
$paypal_args[ 'quantity_' . $item_loop ] = $item['qty'];
|
||||
$paypal_args[ 'amount_' . $item_loop ] = $order->get_item_total( $item, false );
|
||||
$paypal_args[ 'amount_' . $item_loop ] = $order->get_item_subtotal( $item, false );
|
||||
|
||||
if ( $product->get_sku() )
|
||||
$paypal_args[ 'item_number_' . $item_loop ] = $product->get_sku();
|
||||
|
@ -365,6 +365,10 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
|
|||
}
|
||||
}
|
||||
|
||||
// Discount
|
||||
if ( $order->get_cart_discount() > 0 )
|
||||
$paypal_args['discount_amount_cart'] = round( $order->get_cart_discount(), 2 );
|
||||
|
||||
// Fees
|
||||
if ( sizeof( $order->get_fees() ) > 0 ) {
|
||||
foreach ( $order->get_fees() as $item ) {
|
||||
|
@ -604,6 +608,10 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
|
|||
$posted['payment_status'] = strtolower( $posted['payment_status'] );
|
||||
$posted['txn_type'] = strtolower( $posted['txn_type'] );
|
||||
|
||||
// Sandbox fix
|
||||
if ( $posted['test_ipn'] == 1 && $posted['payment_status'] == 'pending' )
|
||||
$posted['payment_status'] = 'completed';
|
||||
|
||||
if ( 'yes' == $this->debug )
|
||||
$this->log->add( 'paypal', 'Payment status: ' . $posted['payment_status'] );
|
||||
|
||||
|
@ -651,15 +659,15 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
|
|||
|
||||
// Store PP Details
|
||||
if ( ! empty( $posted['payer_email'] ) )
|
||||
update_post_meta( $order_id, 'Payer PayPal address', $posted['payer_email'] );
|
||||
update_post_meta( $order->id, 'Payer PayPal address', $posted['payer_email'] );
|
||||
if ( ! empty( $posted['txn_id'] ) )
|
||||
update_post_meta( $order_id, 'Transaction ID', $posted['txn_id'] );
|
||||
update_post_meta( $order->id, 'Transaction ID', $posted['txn_id'] );
|
||||
if ( ! empty( $posted['first_name'] ) )
|
||||
update_post_meta( $order_id, 'Payer first name', $posted['first_name'] );
|
||||
update_post_meta( $order->id, 'Payer first name', $posted['first_name'] );
|
||||
if ( ! empty( $posted['last_name'] ) )
|
||||
update_post_meta( $order_id, 'Payer last name', $posted['last_name'] );
|
||||
update_post_meta( $order->id, 'Payer last name', $posted['last_name'] );
|
||||
if ( ! empty( $posted['payment_type'] ) )
|
||||
update_post_meta( $order_id, 'Payment type', $posted['payment_type'] );
|
||||
update_post_meta( $order->id, 'Payment type', $posted['payment_type'] );
|
||||
|
||||
// Payment completed
|
||||
$order->add_order_note( __( 'IPN payment completed', 'woocommerce' ) );
|
||||
|
@ -769,4 +777,4 @@ class WC_Paypal extends WC_Gateway_Paypal {
|
|||
_deprecated_function( 'WC_Paypal', '1.4', 'WC_Gateway_Paypal' );
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,55 +1,82 @@
|
|||
<?php
|
||||
|
||||
require_once("class.shareyourcart-wp-woocommerce.php");
|
||||
require_once( "class.shareyourcart-wp-woocommerce.php" );
|
||||
|
||||
/**
|
||||
* ShareYourCartWooCommerceEx class.
|
||||
*
|
||||
* @extends ShareYourCartWooCommerce
|
||||
*/
|
||||
class ShareYourCartWooCommerceEx extends ShareYourCartWooCommerce {
|
||||
|
||||
public $settings;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param null
|
||||
* __construct function.
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $settings
|
||||
* @return void
|
||||
*/
|
||||
function __construct( $settings ) {
|
||||
|
||||
$this->settings = $settings;
|
||||
$this->SDK_ANALYTICS = false; //disable analytics for the woocommerce integration
|
||||
|
||||
// disable analytics for the woocommerce integration
|
||||
$this->SDK_ANALYTICS = false;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Since this class has loaded, the WooCommerce plugin is active.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function isCartActive() {
|
||||
return true; //since this class has loaded, the WooCommerce plugin is active
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* getSecretKey function.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSecretKey() {
|
||||
return '2cfd496d-7812-44ba-91ce-e43c59f6c680';
|
||||
}
|
||||
|
||||
public function showAdminMenu() {
|
||||
//since we have already integrated this in our own settings page,
|
||||
//leave this function empty
|
||||
}
|
||||
/**
|
||||
* Since we have already integrated this in our own settings page, leave this function empty.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function showAdminMenu() {}
|
||||
|
||||
/**
|
||||
*
|
||||
* Set the field value
|
||||
*
|
||||
* @access protected
|
||||
* @param mixed $field
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
protected function setConfigValue($field, $value) {
|
||||
protected function setConfigValue( $field, $value ) {
|
||||
|
||||
$this->settings[$field] = $value;
|
||||
$this->settings[ $field ] = $value;
|
||||
|
||||
//make sure to update the enabled field as well, based on the account_status
|
||||
switch($field){
|
||||
switch( $field ){
|
||||
case 'account_status':
|
||||
$this->settings['enabled'] = ( $value == 'active' ? 'yes' : 'no' );
|
||||
break;
|
||||
break;
|
||||
case "plugin_current_version":
|
||||
//this setting needs to be set globally as well, in order to be recognized by other ShareYourCart integrations,
|
||||
//and to not interfere with one-another
|
||||
parent::setConfigValue($field, $value);
|
||||
break;
|
||||
parent::setConfigValue( $field, $value );
|
||||
break;
|
||||
}
|
||||
|
||||
//save the config in the DB
|
||||
|
@ -57,20 +84,23 @@ class ShareYourCartWooCommerceEx extends ShareYourCartWooCommerce {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Get the field value
|
||||
*
|
||||
* @access protected
|
||||
* @param mixed $field
|
||||
* @return string
|
||||
*/
|
||||
protected function getConfigValue( $field ) {
|
||||
|
||||
$value = ( isset( $this->settings[$field] ) ) ? $this->settings[$field] : '';
|
||||
$value = ( isset( $this->settings[ $field ] ) ) ? $this->settings[ $field ] : '';
|
||||
|
||||
//search for the global value of this field
|
||||
//as it might have been changed by an external ShareYourCart integration
|
||||
if($field == "plugin_current_version"){
|
||||
$val = parent::getConfigValue($field);
|
||||
// search for the global value of this field
|
||||
// as it might have been changed by an external ShareYourCart integration
|
||||
if ( $field == "plugin_current_version" ) {
|
||||
$val = parent::getConfigValue( $field );
|
||||
|
||||
if(!empty($val)) $value = $val;
|
||||
if ( ! empty( $val ) )
|
||||
$value = $val;
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
|
|
@ -2,251 +2,318 @@
|
|||
|
||||
require_once("class.shareyourcart-wp.php");
|
||||
|
||||
if(!class_exists('ShareYourCartWooCommerce',false)){
|
||||
if ( ! class_exists( 'ShareYourCartWooCommerce', false ) ) {
|
||||
|
||||
class ShareYourCartWooCommerce extends ShareYourCartWordpressPlugin{
|
||||
|
||||
public $_plugin_name = "shareyourcart_woo_commerce";
|
||||
public $_post_user_id = 1;
|
||||
|
||||
public function processInit(){
|
||||
if(isset($_REQUEST['action'])){
|
||||
switch($_REQUEST['action']){
|
||||
case $this->_plugin_name:
|
||||
$this->buttonCallback();
|
||||
break;
|
||||
|
||||
case $this->_plugin_name.'_coupon':
|
||||
$this->couponCallback();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function isCartActive() {
|
||||
return in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Extend the base class implementation
|
||||
/**
|
||||
* ShareYourCartWooCommerce class.
|
||||
*
|
||||
* @extends ShareYourCartWordpressPlugin
|
||||
*/
|
||||
public function pluginsLoadedHook() {
|
||||
parent::pluginsLoadedHook();
|
||||
class ShareYourCartWooCommerce extends ShareYourCartWordpressPlugin{
|
||||
|
||||
if(!$this->isCartActive()) return;
|
||||
public $_plugin_name = "shareyourcart_woo_commerce";
|
||||
public $_post_user_id = 1;
|
||||
|
||||
add_action('init', array(&$this, 'processInit'));
|
||||
/**
|
||||
* processInit function.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function processInit() {
|
||||
if ( isset( $_REQUEST['action'] ) ) {
|
||||
switch( $_REQUEST['action'] ) {
|
||||
case $this->_plugin_name:
|
||||
$this->buttonCallback20();
|
||||
break;
|
||||
case $this->_plugin_name.'_coupon':
|
||||
$this->couponCallback();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_action('woocommerce_before_single_product', array(&$this,'showProductButton'));
|
||||
add_action('woocommerce_cart_contents', array(&$this,'showCartButton'));
|
||||
/**
|
||||
* isCartActive function.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function isCartActive() {
|
||||
return in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend the base class implementation
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function pluginsLoadedHook() {
|
||||
parent::pluginsLoadedHook();
|
||||
|
||||
if ( ! $this->isCartActive() )
|
||||
return;
|
||||
|
||||
add_action( 'init', array( $this, 'processInit' ) );
|
||||
add_action( 'woocommerce_before_single_product', array( $this, 'showProductButton' ) );
|
||||
add_action( 'woocommerce_cart_contents', array( $this, 'showCartButton' ) );
|
||||
add_action( 'woocommerce_checkout_before_customer_details', array( $this, 'showCheckoutButton' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the jQuery sibling selector for the product button
|
||||
*
|
||||
* @access protected
|
||||
* @return string
|
||||
*/
|
||||
protected function getProductButtonPosition() {
|
||||
$selector = parent::getProductButtonPosition();
|
||||
return ( ! empty( $selector ) ? $selector : ".summary .price .amount" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the jQuery sibling selector for the cart button
|
||||
*
|
||||
* @access protected
|
||||
* @return string
|
||||
*/
|
||||
protected function getCartButtonPosition(){
|
||||
$selector = parent::getCartButtonPosition();
|
||||
return ( ! empty( $selector ) ? $selector : ".cart-subtotal .amount" );
|
||||
}
|
||||
|
||||
/**
|
||||
* getSecretKey function.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSecretKey() {
|
||||
return 'd3ce6c18-7e45-495d-aa4c-8f63edee03a5';
|
||||
}
|
||||
|
||||
/**
|
||||
* isSingleProduct function.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function isSingleProduct() {
|
||||
return is_singular( 'product' );
|
||||
}
|
||||
|
||||
/**
|
||||
* saveCoupon function.
|
||||
*
|
||||
* @access protected
|
||||
* @param mixed $token
|
||||
* @param mixed $coupon_code
|
||||
* @param mixed $coupon_value
|
||||
* @param mixed $coupon_type
|
||||
* @param array $product_unique_ids (default: array())
|
||||
* @return void
|
||||
*/
|
||||
protected function saveCoupon( $token, $coupon_code, $coupon_value, $coupon_type, $product_unique_ids = array() ) {
|
||||
|
||||
// Create coupon
|
||||
$post_id = $this->_saveCouponPost( $coupon_code );
|
||||
|
||||
// Set coupon meta
|
||||
switch ( $coupon_type ) {
|
||||
case 'amount':
|
||||
$discount_type = 'fixed_product';
|
||||
$free_shipping = 'no';
|
||||
break;
|
||||
case 'percent':
|
||||
$discount_type = 'percent_product';
|
||||
$free_shipping = 'no';
|
||||
break;
|
||||
case 'free_shipping':
|
||||
$discount_type = 'fixed_product';
|
||||
$coupon_value = 0;
|
||||
$free_shipping = 'yes';
|
||||
break;
|
||||
default :
|
||||
$discount_type = 'fixed_cart';
|
||||
$free_shipping = 'no';
|
||||
}
|
||||
|
||||
update_post_meta( $post_id, 'customer_email', array() );
|
||||
update_post_meta( $post_id, 'minimum_amount', '' );
|
||||
update_post_meta( $post_id, 'exclude_product_categories', array() );
|
||||
update_post_meta( $post_id, 'product_categories', array() );
|
||||
update_post_meta( $post_id, 'free_shipping', $free_shipping );
|
||||
update_post_meta( $post_id, 'apply_before_tax', 'yes' );
|
||||
update_post_meta( $post_id, 'expiry_date', '' );
|
||||
update_post_meta( $post_id, 'usage_limit', 1 );
|
||||
update_post_meta( $post_id, 'exclude_product_ids', '' );
|
||||
update_post_meta( $post_id, 'product_ids', implode(',', $product_unique_ids));
|
||||
update_post_meta( $post_id, 'individual_use', 'yes' );
|
||||
update_post_meta( $post_id, 'coupon_amount', $coupon_value );
|
||||
update_post_meta( $post_id, 'discount_type', $discount_type );
|
||||
|
||||
// parent
|
||||
parent::saveCoupon( $token, $coupon_code, $coupon_value, $coupon_type );
|
||||
}
|
||||
|
||||
/**
|
||||
* applyCoupon function.
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $coupon_code
|
||||
* @return void
|
||||
*/
|
||||
public function applyCoupon( $coupon_code ) {}
|
||||
|
||||
/**
|
||||
* _saveCouponPost function.
|
||||
*
|
||||
* @access private
|
||||
* @param mixed $coupon_code
|
||||
* @return void
|
||||
*/
|
||||
private function _saveCouponPost( $coupon_code ){
|
||||
$new_post = array(
|
||||
'post_title' => $coupon_code,
|
||||
'post_name' => ereg_replace( "[^A-Za-z0-9]", "", $coupon_code ),
|
||||
'post_content' => '',
|
||||
'post_status' => 'publish',
|
||||
'comment_status'=> 'closed',
|
||||
'ping_status' => 'closed',
|
||||
'post_author' => $this->_post_user_id,
|
||||
'post_type' => 'shop_coupon'
|
||||
);
|
||||
|
||||
$post_id = wp_insert_post( $new_post );
|
||||
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* getButtonCallbackURL function.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getButtonCallbackURL() {
|
||||
global $wp_query;
|
||||
|
||||
$callback_url = add_query_arg( 'action', $this->_plugin_name, trailingslashit( home_url() ) );
|
||||
|
||||
if ( $this->isSingleProduct() ) {
|
||||
$callback_url .= '&p='. $wp_query->post->ID;
|
||||
}
|
||||
|
||||
return $callback_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is to be used by WooCommerce from version 2.0
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function buttonCallback20(){
|
||||
if ( ! $this->isCartActive() )
|
||||
return;
|
||||
|
||||
global $woocommerce;
|
||||
|
||||
$this->_loadWooCommerce();
|
||||
|
||||
$params = array(
|
||||
'callback_url' => get_bloginfo('wpurl').'/?action='.$this->_plugin_name.'_coupon'.(isset($_REQUEST['p']) ? '&product='.$_REQUEST['p'] : '' ),
|
||||
'success_url' => get_bloginfo('wpurl').'/?page_id='.get_option('woocommerce_cart_page_id'),
|
||||
'cancel_url' => get_bloginfo('wpurl').'/?page_id='.get_option('woocommerce_cart_page_id'),
|
||||
);
|
||||
|
||||
//there is no product set, thus send the products from the shopping cart
|
||||
if ( ! isset( $_REQUEST['p'] ) ) {
|
||||
if ( ! isset( $woocommerce->session->cart ) /*&& !is_array( $woocommerce->session->cart )*/ )
|
||||
exit("Cart is empty");
|
||||
|
||||
foreach( $woocommerce->session->cart as $cart_details ) {
|
||||
$params['cart'][] = $this->_getProductDetails20( $cart_details['product_id'] );
|
||||
}
|
||||
} else {
|
||||
$params['cart'][] = $this->_getProductDetails20( $_REQUEST['p'] );
|
||||
}
|
||||
|
||||
try {
|
||||
$this->startSession( $params );
|
||||
} catch( Exception $e ) {
|
||||
//display the error to the user
|
||||
echo $e->getMessage();
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is to be used by WooCommerce from version 2.0
|
||||
*
|
||||
* @access private
|
||||
* @param mixed $product_id
|
||||
* @return void
|
||||
*/
|
||||
private function _getProductDetails20( $product_id ) {
|
||||
global $woocommerce;
|
||||
|
||||
$product = get_product( $product_id );
|
||||
|
||||
//WooCommerce actually echoes the image
|
||||
ob_start();
|
||||
echo $product->get_image(); // older WooCommerce versions might allready echo, but newer versions don't, so force it anyway
|
||||
$image = ob_get_clean();
|
||||
|
||||
//check is image actually a HTML img entity
|
||||
if ( ( $doc = @DomDocument::loadHTML( $image ) ) !== FALSE ) {
|
||||
$imageTags = $doc->getElementsByTagName('img');
|
||||
|
||||
if ( $imageTags->length > 0 )
|
||||
$src = $imageTags->item(0)->getAttribute('src');
|
||||
|
||||
//replace image only if src has been set
|
||||
if ( ! empty( $src ) )
|
||||
$image = $src;
|
||||
}
|
||||
|
||||
return array(
|
||||
"item_name" => $product->get_title(), //$product->post->post_title,
|
||||
"item_url" => get_permalink( $product_id ),
|
||||
"item_price" => $product->get_price(),
|
||||
"item_picture_url" => $image,
|
||||
"item_unique_id" => $product_id,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* loadSessionData function.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function loadSessionData() {}
|
||||
|
||||
/**
|
||||
* _loadWooCommerce function.
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
private function _loadWooCommerce(){
|
||||
// Sometimes the WooCommerce Class is not loaded...
|
||||
if ( ! class_exists( 'Woocommerce', false ) ) {
|
||||
require_once( ABSPATH . 'wp-content/plugins/woocommerce/woocommerce.php' );
|
||||
}
|
||||
|
||||
// Important Classes Not included
|
||||
if ( ! function_exists( 'has_post_thumbnail' ) ) {
|
||||
require_once( ABSPATH . 'wp-includes/post-thumbnail-template.php' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Return the jQuery sibling selector for the product button
|
||||
*
|
||||
*/
|
||||
protected function getProductButtonPosition(){
|
||||
$selector = parent::getProductButtonPosition();
|
||||
return (!empty($selector) ? $selector : ".summary .price .amount");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Return the jQuery sibling selector for the cart button
|
||||
*
|
||||
*/
|
||||
protected function getCartButtonPosition(){
|
||||
$selector = parent::getCartButtonPosition();
|
||||
return (!empty($selector) ? $selector : ".cart-subtotal .amount");
|
||||
}
|
||||
|
||||
public function getSecretKey() {
|
||||
return 'd3ce6c18-7e45-495d-aa4c-8f63edee03a5';
|
||||
}
|
||||
|
||||
public function isSingleProduct() {
|
||||
return is_singular('product');
|
||||
}
|
||||
|
||||
protected function saveCoupon($token, $coupon_code, $coupon_value, $coupon_type, $product_unique_ids = array()) {
|
||||
|
||||
// Create coupon
|
||||
$post_id = $this->_saveCouponPost($coupon_code);
|
||||
|
||||
// Set coupon meta
|
||||
switch ($coupon_type) {
|
||||
case 'amount':
|
||||
$discount_type = 'fixed_product';
|
||||
$free_shipping = 'no';
|
||||
break;
|
||||
case 'percent':
|
||||
$discount_type = 'percent_product';
|
||||
$free_shipping = 'no';
|
||||
break;
|
||||
case 'free_shipping':
|
||||
$discount_type = 'fixed_product';
|
||||
$coupon_value = 0;
|
||||
$free_shipping = 'yes';
|
||||
break;
|
||||
default :
|
||||
$discount_type = 'fixed_cart';
|
||||
$free_shipping = 'no';
|
||||
}
|
||||
|
||||
update_post_meta( $post_id, 'customer_email', array() );
|
||||
update_post_meta( $post_id, 'minimum_amount', '' );
|
||||
update_post_meta( $post_id, 'exclude_product_categories', array() );
|
||||
update_post_meta( $post_id, 'product_categories', array() );
|
||||
update_post_meta( $post_id, 'free_shipping', $free_shipping );
|
||||
update_post_meta( $post_id, 'apply_before_tax', 'yes' );
|
||||
update_post_meta( $post_id, 'expiry_date', '' );
|
||||
update_post_meta( $post_id, 'usage_limit', 1 );
|
||||
update_post_meta( $post_id, 'exclude_product_ids', '' );
|
||||
update_post_meta( $post_id, 'product_ids', implode(',', $product_unique_ids));
|
||||
update_post_meta( $post_id, 'individual_use', 'yes' );
|
||||
update_post_meta( $post_id, 'coupon_amount', $coupon_value );
|
||||
update_post_meta( $post_id, 'discount_type', $discount_type );
|
||||
|
||||
// parent
|
||||
parent::saveCoupon( $token, $coupon_code, $coupon_value, $coupon_type );
|
||||
}
|
||||
|
||||
public function applyCoupon($coupon_code) {
|
||||
//$this->_loadWooCommerce();
|
||||
|
||||
//global $woocommerce;
|
||||
//$woocommerce->cart->add_discount($coupon_code);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
private function _saveCouponPost($coupon_code){
|
||||
$new_post = array(
|
||||
'post_title' => $coupon_code,
|
||||
'post_name' => ereg_replace("[^A-Za-z0-9]", "", $coupon_code),
|
||||
'post_content' => '',
|
||||
'post_status' => 'publish',
|
||||
'comment_status'=> 'closed',
|
||||
'ping_status' => 'closed',
|
||||
'post_author' => $this->_post_user_id,
|
||||
'post_type' => 'shop_coupon'
|
||||
);
|
||||
|
||||
$post_id = wp_insert_post($new_post);
|
||||
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
public function getButtonCallbackURL() {
|
||||
global $wp_query;
|
||||
|
||||
$callback_url = add_query_arg( 'action', $this->_plugin_name, trailingslashit( home_url() ) );
|
||||
|
||||
if ($this->isSingleProduct()) {
|
||||
$callback_url .= '&p='. $wp_query->post->ID;
|
||||
}
|
||||
|
||||
return $callback_url;
|
||||
}
|
||||
|
||||
public function buttonCallback(){
|
||||
if(!$this->isCartActive()) return;
|
||||
|
||||
$this->_loadWooCommerce();
|
||||
global $woocommerce;
|
||||
|
||||
//specify the parameters
|
||||
$params = array(
|
||||
'callback_url' => get_bloginfo('wpurl').'/?action='.$this->_plugin_name.'_coupon'.(isset($_REQUEST['p']) ? '&p='.$_REQUEST['p'] : '' ),
|
||||
'success_url' => get_option('shopping_cart_url'),
|
||||
'cancel_url' => get_option('shopping_cart_url'),
|
||||
);
|
||||
|
||||
//there is no product set, thus send the products from the shopping cart
|
||||
if(!isset($_REQUEST['p']))
|
||||
{
|
||||
if(sizeof( $woocommerce->cart->get_cart() ) == 0)
|
||||
exit("Cart is empty");
|
||||
|
||||
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
|
||||
$params['cart'][] = $this->_getProductDetails($values['data']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$params['cart'][] = $this->_getProductDetails($_REQUEST['p']);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$this->startSession($params);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
//display the error to the user
|
||||
echo $e->getMessage();
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
private function _getProductDetails($product_id){
|
||||
if(is_object($product_id)) { //if we've already received the product, use this one
|
||||
$product = $product_id;
|
||||
}
|
||||
else { //it's only a number, so get the product
|
||||
$product = get_product($product_id);
|
||||
}
|
||||
|
||||
//WooCommerce actually echoes the image
|
||||
ob_start();
|
||||
echo $product->get_image(); //older WooCommerce versions might already echo, but newer versions don't, so force it anyway
|
||||
$image = ob_get_clean();
|
||||
|
||||
//check is image actually a HTML img entity
|
||||
if(($doc = @DomDocument::loadHTML($image)) !== FALSE)
|
||||
{
|
||||
$imageTags = $doc->getElementsByTagName('img');
|
||||
if($imageTags->length >0 )
|
||||
$src = $imageTags->item(0)->getAttribute('src');
|
||||
|
||||
//replace image only if src has been set
|
||||
if (!empty($src))
|
||||
$image = $src;
|
||||
}
|
||||
|
||||
return array(
|
||||
"item_name" => $product->get_title(),
|
||||
"item_description" => $product->post->post_excerpt,
|
||||
"item_url" => get_permalink($product->id),
|
||||
"item_price" => $product->price,
|
||||
"item_picture_url" => $image,
|
||||
"item_unique_id" => $product->id,
|
||||
);
|
||||
}
|
||||
|
||||
public function loadSessionData() {
|
||||
return;
|
||||
}
|
||||
|
||||
private function _loadWooCommerce(){
|
||||
// Sometimes the WooCommerce Class is not loaded...
|
||||
|
||||
if(!class_exists('Woocommerce', false)){
|
||||
require_once(ABSPATH . 'wp-content/plugins/woocommerce/woocommerce.php');
|
||||
}
|
||||
|
||||
// Important Classes Not included
|
||||
if(!function_exists('has_post_thumbnail')){
|
||||
require_once(ABSPATH . 'wp-includes/post-thumbnail-template.php');
|
||||
}
|
||||
}
|
||||
//TODO: see why this is not used
|
||||
add_action( ShareYourCartWordpressPlugin::getPluginFile(), array( 'ShareYourCartWooCommerce','uninstallHook' ) );
|
||||
}
|
||||
|
||||
|
||||
//TODO: see why this is not used
|
||||
add_action(ShareYourCartWordpressPlugin::getPluginFile(), array('ShareYourCartWooCommerce','uninstallHook'));
|
||||
|
||||
} //END IF
|
|
@ -16,7 +16,7 @@ if(!class_exists('ShareYourCartWordpressPlugin',false)){
|
|||
abstract class ShareYourCartWordpressPlugin extends ShareYourCartBase {
|
||||
|
||||
protected static $_INSTANCES = array();
|
||||
protected static $_VERSION = 6;
|
||||
protected static $_VERSION = 7;
|
||||
protected $_PLUGIN_PATH;
|
||||
|
||||
/**
|
||||
|
@ -379,4 +379,4 @@ if(!class_exists('ShareYourCartWordpressPlugin',false)){
|
|||
}
|
||||
|
||||
} //END IF
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -542,7 +542,7 @@ class WC_Shipping_Flat_Rate extends WC_Shipping_Method {
|
|||
jQuery('#<?php echo $this->id; ?>_flat_rates').on( 'click', 'a.remove', function(){
|
||||
var answer = confirm("<?php _e( 'Delete the selected rates?', 'woocommerce' ); ?>")
|
||||
if (answer) {
|
||||
jQuery('#<?php echo $this->id; ?>_flat_rates table tbody tr td.check-column input:checked').each(function(i, el){
|
||||
jQuery('#<?php echo $this->id; ?>_flat_rates table tbody tr th.check-column input:checked').each(function(i, el){
|
||||
jQuery(el).closest('tr').remove();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ class WC_Widget_Random_Products extends WP_Widget {
|
|||
function update( $new_instance, $old_instance ) {
|
||||
$instance = array(
|
||||
'title' => strip_tags($new_instance['title']),
|
||||
'number' => min(15, max(1, (int) $new_instance['number'])),
|
||||
'number' => absint( $new_instance['number'] ),
|
||||
'show_variations' => ! empty($new_instance['show_variations'])
|
||||
);
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class WC_Widget_Recent_Reviews extends WP_Widget {
|
|||
|
||||
$rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) );
|
||||
|
||||
$rating_html = $_product->get_rating_html();
|
||||
$rating_html = $_product->get_rating_html( $rating );
|
||||
|
||||
echo '<li><a href="' . esc_url( get_comment_link( $comment->comment_ID ) ) . '">';
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class WC_Widget_Top_Rated_Products extends WP_Widget {
|
|||
<li><a href="<?php echo esc_url( get_permalink( $top_rated_posts->post->ID ) ); ?>" title="<?php echo esc_attr($top_rated_posts->post->post_title ? $top_rated_posts->post->post_title : $top_rated_posts->post->ID); ?>">
|
||||
<?php echo $product->get_image(); ?>
|
||||
<?php if ( $top_rated_posts->post->post_title ) echo get_the_title( $top_rated_posts->post->ID ); else echo $top_rated_posts->post->ID; ?>
|
||||
</a> <?php echo $product->get_rating_html('sidebar'); ?><?php echo $product->get_price_html(); ?></li>
|
||||
</a> <?php echo $product->get_rating_html(); ?><?php echo $product->get_price_html(); ?></li>
|
||||
|
||||
<?php endwhile; ?>
|
||||
</ul>
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* NZ states
|
||||
*
|
||||
* @author WooThemes
|
||||
* @category i18n
|
||||
* @package WooCommerce/i18n
|
||||
* @version 2.0.0
|
||||
*/
|
||||
global $states;
|
||||
|
||||
$states['NZ'] = array(
|
||||
'NL' => __( 'Northland', 'woocommerce' ),
|
||||
'AK' => __( 'Auckland', 'woocommerce' ),
|
||||
'WA' => __( 'Waikato', 'woocommerce' ),
|
||||
'BP' => __( 'Bay of Plenty', 'woocommerce' ),
|
||||
'TK' => __( 'Taranaki', 'woocommerce' ),
|
||||
'HB' => __( 'Hawke’s Bay', 'woocommerce' ),
|
||||
'MW' => __( 'Manawatu-Wanganui', 'woocommerce' ),
|
||||
'WE' => __( 'Wellington', 'woocommerce' ),
|
||||
'NS' => __( 'Nelson', 'woocommerce' ),
|
||||
'MB' => __( 'Marlborough', 'woocommerce' ),
|
||||
'TM' => __( 'Tasman', 'woocommerce' ),
|
||||
'WC' => __( 'West Coast', 'woocommerce' ),
|
||||
'CT' => __( 'Canterbury', 'woocommerce' ),
|
||||
'OT' => __( 'Otago', 'woocommerce' ),
|
||||
'SL' => __( 'Southland', 'woocommerce')
|
||||
);
|
||||
|
||||
|
40
readme.txt
40
readme.txt
|
@ -4,7 +4,7 @@ Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, affiliate
|
|||
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@woothemes.com&item_name=Donation+for+WooCommerce
|
||||
Requires at least: 3.5
|
||||
Tested up to: 3.5
|
||||
Stable tag: 2.0.4
|
||||
Stable tag: 2.0.5
|
||||
License: GPLv3
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
|
@ -165,6 +165,44 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
|
||||
== Changelog ==
|
||||
|
||||
= X =
|
||||
* Tweak/Fix - Merge taxes by CODE so totals are displayed clearer. Also added additonal function for getting merged tax totals, and to keep compatibility with themes.
|
||||
* Tweak/Fix - Recent reviews show actual review stars, and allowed get_rating_html() to be passed a rating. Also removed unused $location var.
|
||||
* Fix - Saving of meta values from paypal after payment.
|
||||
* Fix - woocommerce_nav_menu_items - only hide pages, not other objects.
|
||||
* Fix - woocommerce_add_tinymce_lang array key.
|
||||
* Fix - Find_rates now works with both postcode and city together.
|
||||
* Fix - PrettyPhoto content clearfixed.
|
||||
* Fix - Fix the download method when force SSL is on.
|
||||
* Fix - Put back sandbox pending fix. Aparently still needed for some accounts.
|
||||
* Fix - Do not sanitize old attribute name to not mess up comparing
|
||||
* Fix - Settings API empty value only used if set. In turn fixes blank values in flat rate shipping.
|
||||
* Fix - Ensure API Request URL scheme is not relative to the current page.
|
||||
* Fix - Fix saving of download permissions in order admin.
|
||||
* Fix - Action woocommerce_product_bulk_edit_end is now properly executed instead of outputted as HTML.
|
||||
* Tweak - Added a check to parent theme for comments_template before loading plugin template.
|
||||
* Tweak - Remove hard coded max from random products widget.
|
||||
* Tweak - Add filter hook to the place order button for easy 3rd party manipulation.
|
||||
* Tweak - UX - Placeholder fades out on focus
|
||||
* Tweak - UX - Only display validation result on required fields
|
||||
* Tweak - Product column widths in admin
|
||||
* Tweak - .shipping_address clears to avoid flash of ugliness in some themes when revealing shipping address
|
||||
* Localisation - NZ States
|
||||
|
||||
= 2.0.5 - 26/03/2013 =
|
||||
* Tweak - Made no shipping available messages filterable via woocommerce_cart_no_shipping_available_html and woocommerce_no_shipping_available_html.
|
||||
* Tweak - disabled keyboard shortcuts in prettyPhoto.
|
||||
* Tweak - woocommerce_date_format() function.
|
||||
* Tweak - After adding to cart, add 'added_to_cart' to querystring - lets messages show with cache enabled.
|
||||
* Tweak - Similar to above, on failure don't redirect. The POST should exclude from cache.
|
||||
* Tweak - Version data on system status page.
|
||||
* Fix - Fix orderby title - separated from menu_order.
|
||||
* Fix - WC_Product::set_stock_status() to correctly set status.
|
||||
* Fix - last_modified_date updated on status change for orders.
|
||||
* Fix - Sanitize id in woocommerce_get_product_to_duplicate function
|
||||
* Fix - Cancel order function now looks at post_modified instead of post_date.
|
||||
* Other minor fixes and localisation updates.
|
||||
|
||||
= 2.0.4 - 18/03/2013 =
|
||||
* Tweak - Like my account, added order_count attribute to view order shortcode.
|
||||
* Tweak - Moved WC_Order_Item_Meta into own file.
|
||||
|
|
|
@ -64,9 +64,19 @@ if ( $available_methods ) {
|
|||
} else {
|
||||
|
||||
if ( ! $woocommerce->customer->get_shipping_country() || ! $woocommerce->customer->get_shipping_state() || ! $woocommerce->customer->get_shipping_postcode() ) {
|
||||
|
||||
echo '<p>' . __( 'Please fill in your details to see available shipping methods.', 'woocommerce' ) . '</p>';
|
||||
|
||||
} else {
|
||||
echo '<p>' . __( 'Sorry, it seems that there are no available shipping methods for your state. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce' ) . '</p>';
|
||||
|
||||
$customer_location = $woocommerce->countries->countries[ $woocommerce->customer->get_shipping_country() ];
|
||||
|
||||
echo apply_filters( 'woocommerce_no_shipping_available_html',
|
||||
'<p>' .
|
||||
sprintf( __( 'Sorry, it seems that there are no available shipping methods for your location (%s).', 'woocommerce' ) . ' ' . __( 'If you require assistance or wish to make alternate arrangements please contact us.', 'woocommerce' ), $customer_location ) .
|
||||
'</p>'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -68,47 +68,10 @@ $available_methods = $woocommerce->shipping->get_available_shipping_methods();
|
|||
<?php
|
||||
// Show the tax row if showing prices exclusive of tax only
|
||||
if ( $woocommerce->cart->tax_display_cart == 'excl' ) {
|
||||
$taxes = $woocommerce->cart->get_formatted_taxes();
|
||||
|
||||
if ( sizeof( $taxes ) > 0 ) {
|
||||
|
||||
$has_compound_tax = false;
|
||||
|
||||
foreach ( $taxes as $key => $tax ) {
|
||||
if ( $woocommerce->cart->tax->is_compound( $key ) ) {
|
||||
$has_compound_tax = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
echo '<tr class="tax-rate tax-rate-' . $key . '">
|
||||
<th>' . $woocommerce->cart->tax->get_rate_label( $key ) . '</th>
|
||||
<td>' . $tax . '</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
if ( $has_compound_tax ) {
|
||||
|
||||
echo '<tr class="order-subtotal">
|
||||
<th><strong>' . __( 'Subtotal', 'woocommerce' ) . '</strong></th>
|
||||
<td><strong>' . $woocommerce->cart->get_cart_subtotal( true ) . '</strong></td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
foreach ( $taxes as $key => $tax ) {
|
||||
if ( ! $woocommerce->cart->tax->is_compound( $key ) )
|
||||
continue;
|
||||
|
||||
echo '<tr class="tax-rate tax-rate-' . $key . '">
|
||||
<th>' . $woocommerce->cart->tax->get_rate_label( $key ) . '</th>
|
||||
<td>' . $tax . '</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
} elseif ( $woocommerce->cart->get_cart_tax() > 0 ) {
|
||||
|
||||
echo '<tr class="tax">
|
||||
<th>' . __( 'Tax', 'woocommerce' ) . '</th>
|
||||
<td>' . $woocommerce->cart->get_cart_tax() . '</td>
|
||||
foreach ( $woocommerce->cart->get_tax_totals() as $code => $tax ) {
|
||||
echo '<tr class="tax-rate tax-rate-' . $code . '">
|
||||
<th>' . $tax->label . '</th>
|
||||
<td>' . $tax->formatted_amount . '</td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
|
@ -133,13 +96,10 @@ $available_methods = $woocommerce->shipping->get_available_shipping_methods();
|
|||
// If prices are tax inclusive, show taxes here
|
||||
if ( $woocommerce->cart->tax_display_cart == 'incl' ) {
|
||||
$tax_string_array = array();
|
||||
$taxes = $woocommerce->cart->get_formatted_taxes();
|
||||
|
||||
if ( sizeof( $taxes ) > 0 )
|
||||
foreach ( $taxes as $key => $tax )
|
||||
$tax_string_array[] = sprintf( '%s %s', $tax, $woocommerce->cart->tax->get_rate_label( $key ) );
|
||||
elseif ( $woocommerce->cart->get_cart_tax() )
|
||||
$tax_string_array[] = sprintf( '%s tax', $tax );
|
||||
foreach ( $woocommerce->cart->get_tax_totals() as $code => $tax ) {
|
||||
$tax_string_array[] = sprintf( '%s %s', $tax->formatted_amount, $tax->label );
|
||||
}
|
||||
|
||||
if ( ! empty( $tax_string_array ) ) {
|
||||
echo '<small class="includes_tax">' . sprintf( __( '(Includes %s)', 'woocommerce' ), implode( ', ', $tax_string_array ) ) . '</small>';
|
||||
|
@ -178,13 +138,17 @@ $available_methods = $woocommerce->shipping->get_available_shipping_methods();
|
|||
|
||||
<?php else : ?>
|
||||
|
||||
<div class="woocommerce-error">
|
||||
<?php
|
||||
|
||||
<p><?php printf( __( 'Sorry, it seems that there are no available shipping methods for your location (%s).', 'woocommerce' ), $woocommerce->countries->countries[ $woocommerce->customer->get_shipping_country() ] ); ?></p>
|
||||
$customer_location = $woocommerce->countries->countries[ $woocommerce->customer->get_shipping_country() ];
|
||||
|
||||
<p><?php _e( 'If you require assistance or wish to make alternate arrangements please contact us.', 'woocommerce' ); ?></p>
|
||||
echo apply_filters( 'woocommerce_cart_no_shipping_available_html',
|
||||
'<div class="woocommerce-error"><p>' .
|
||||
sprintf( __( 'Sorry, it seems that there are no available shipping methods for your location (%s).', 'woocommerce' ) . ' ' . __( 'If you require assistance or wish to make alternate arrangements please contact us.', 'woocommerce' ), $customer_location ) .
|
||||
'</p></div>'
|
||||
);
|
||||
|
||||
</div>
|
||||
?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
@ -67,58 +67,16 @@ $available_methods = $woocommerce->shipping->get_available_shipping_methods();
|
|||
<?php
|
||||
// Show the tax row if showing prices exlcusive of tax only
|
||||
if ( $woocommerce->cart->tax_display_cart == 'excl' ) {
|
||||
|
||||
$taxes = $woocommerce->cart->get_formatted_taxes();
|
||||
|
||||
if ( sizeof( $taxes ) > 0 ) {
|
||||
|
||||
$has_compound_tax = false;
|
||||
|
||||
foreach ( $taxes as $key => $tax ) {
|
||||
if ( $woocommerce->cart->tax->is_compound( $key ) ) {
|
||||
$has_compound_tax = true;
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<tr class="tax-rate tax-rate-<?php echo $key; ?>">
|
||||
<th><?php echo $woocommerce->cart->tax->get_rate_label( $key ); ?></th>
|
||||
<td><?php echo $tax; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( $has_compound_tax ) {
|
||||
?>
|
||||
<tr class="order-subtotal">
|
||||
<th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
|
||||
<td><?php echo $woocommerce->cart->get_cart_subtotal( true ); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
foreach ( $taxes as $key => $tax ) {
|
||||
if ( ! $woocommerce->cart->tax->is_compound( $key ) )
|
||||
continue;
|
||||
?>
|
||||
<tr class="tax-rate tax-rate-<?php echo $key; ?>">
|
||||
<th><?php echo $woocommerce->cart->tax->get_rate_label( $key ); ?></th>
|
||||
<td><?php echo $tax; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
} elseif ( $woocommerce->cart->get_cart_tax() ) {
|
||||
?>
|
||||
<tr class="tax">
|
||||
<th><?php _e( 'Tax', 'woocommerce' ); ?></th>
|
||||
<td><?php echo $woocommerce->cart->get_cart_tax(); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ( $woocommerce->cart->get_tax_totals() as $code => $tax ) {
|
||||
echo '<tr class="tax-rate tax-rate-' . $code . '">
|
||||
<th>' . $tax->label . '</th>
|
||||
<td>' . $tax->formatted_amount . '</td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if ($woocommerce->cart->get_discounts_after_tax()) : ?>
|
||||
<?php if ( $woocommerce->cart->get_discounts_after_tax() ) : ?>
|
||||
|
||||
<tr class="discount">
|
||||
<th><?php _e( 'Order Discount', 'woocommerce' ); ?></th>
|
||||
|
@ -137,14 +95,9 @@ $available_methods = $woocommerce->shipping->get_available_shipping_methods();
|
|||
// If prices are tax inclusive, show taxes here
|
||||
if ( $woocommerce->cart->tax_display_cart == 'incl' ) {
|
||||
$tax_string_array = array();
|
||||
$taxes = $woocommerce->cart->get_formatted_taxes();
|
||||
|
||||
if ( sizeof( $taxes ) > 0 ) {
|
||||
foreach ( $taxes as $key => $tax ) {
|
||||
$tax_string_array[] = sprintf( '%s %s', $tax, $woocommerce->cart->tax->get_rate_label( $key ) );
|
||||
}
|
||||
} elseif ( $woocommerce->cart->get_cart_tax() ) {
|
||||
$tax_string_array[] = sprintf( '%s tax', $tax );
|
||||
foreach ( $woocommerce->cart->get_tax_totals() as $code => $tax ) {
|
||||
$tax_string_array[] = sprintf( '%s %s', $tax->formatted_amount, $tax->label );
|
||||
}
|
||||
|
||||
if ( ! empty( $tax_string_array ) ) {
|
||||
|
@ -235,7 +188,11 @@ $available_methods = $woocommerce->shipping->get_available_shipping_methods();
|
|||
|
||||
<?php do_action( 'woocommerce_review_order_before_submit' ); ?>
|
||||
|
||||
<input type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="<?php echo apply_filters('woocommerce_order_button_text', __( 'Place order', 'woocommerce' )); ?>" />
|
||||
<?php
|
||||
$order_button_text = apply_filters('woocommerce_order_button_text', __( 'Place order', 'woocommerce' ));
|
||||
|
||||
echo apply_filters('woocommerce_order_button_html', '<input type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . $order_button_text . '" />' );
|
||||
?>
|
||||
|
||||
<?php if (woocommerce_get_page_id('terms')>0) : ?>
|
||||
<p class="form-row terms">
|
||||
|
|
|
@ -20,7 +20,7 @@ foreach ($items as $item) :
|
|||
|
||||
?>
|
||||
<tr>
|
||||
<td style="text-align:left; vertical-align:middle; border: 1px solid #eee;"><?php
|
||||
<td style="text-align:left; vertical-align:middle; border: 1px solid #eee; word-wrap:break-word;"><?php
|
||||
|
||||
// Show title/image etc
|
||||
echo apply_filters( 'woocommerce_order_product_image', $image, $_product, $show_image);
|
||||
|
@ -46,7 +46,7 @@ foreach ($items as $item) :
|
|||
} elseif ( $i == 0 )
|
||||
echo __( 'Download:', 'woocommerce' );
|
||||
|
||||
echo ' <a href="' . $download_file_url . '" target="_blank">' . basename( $file_url ) . '</a></small>';
|
||||
echo ' <a href="' . $download_file_url . '" target="_blank">' . current( explode( '?', basename( $file_url ) ) ) . '</a></small>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ global $woocommerce; ?>
|
|||
<div class="clear"></div>
|
||||
|
||||
<!-- Spam Trap -->
|
||||
<div style="left:-999em; position:absolute;"><label for="trap">Anti-spam</label><input type="text" name="email_2" id="trap" /></div>
|
||||
<div style="left:-999em; position:absolute;"><label for="trap">Anti-spam</label><input type="text" name="email_2" id="trap" tabindex="-1" /></div>
|
||||
|
||||
<?php do_action( 'register_form' ); ?>
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|||
</div>
|
||||
<?php endif;
|
||||
|
||||
echo '<p class="add_review"><a href="#review_form" class="inline show_review_form button" rel="prettyPhoto" title="' . __( 'Add Your Review', 'woocommerce' ) . '">' . __( 'Add Review', 'woocommerce' ) . '</a></p>';
|
||||
echo '<p class="add_review"><a href="#review_form" class="inline show_review_form button" title="' . __( 'Add Your Review', 'woocommerce' ) . '">' . __( 'Add Review', 'woocommerce' ) . '</a></p>';
|
||||
|
||||
$title_reply = __( 'Add a review', 'woocommerce' );
|
||||
|
||||
|
|
|
@ -685,6 +685,7 @@ function get_woocommerce_currencies() {
|
|||
'INR' => __( 'Indian Rupee', 'woocommerce' ),
|
||||
'ILS' => __( 'Israeli Shekel', 'woocommerce' ),
|
||||
'JPY' => __( 'Japanese Yen', 'woocommerce' ),
|
||||
'KRW' => __( 'South Korean Won', 'woocommerce' ),
|
||||
'MYR' => __( 'Malaysian Ringgits', 'woocommerce' ),
|
||||
'MXN' => __( 'Mexican Peso', 'woocommerce' ),
|
||||
'NOK' => __( 'Norwegian Krone', 'woocommerce' ),
|
||||
|
@ -738,6 +739,7 @@ function get_woocommerce_currency_symbol( $currency = '' ) {
|
|||
case 'JPY' :
|
||||
$currency_symbol = '¥';
|
||||
break;
|
||||
case 'KRW' : $currency_symbol = '₩'; break;
|
||||
case 'TRY' : $currency_symbol = 'TL'; break;
|
||||
case 'NOK' : $currency_symbol = 'kr'; break;
|
||||
case 'ZAR' : $currency_symbol = 'R'; break;
|
||||
|
@ -2114,6 +2116,16 @@ function woocommerce_date_format() {
|
|||
return apply_filters( 'woocommerce_date_format', get_option( 'date_format' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* WooCommerce Time Format - Allows to change time format for everything WooCommerce
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
function woocommerce_time_format() {
|
||||
return apply_filters( 'woocommerce_time_format', get_option( 'time_format' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for recounting product terms, ignoring hidden products.
|
||||
*
|
||||
|
@ -2419,7 +2431,7 @@ function woocommerce_cancel_unpaid_orders() {
|
|||
|
||||
$held_duration = get_option( 'woocommerce_hold_stock_minutes' );
|
||||
|
||||
if ( $held_duration == '' || get_option( 'woocommerce_manage_stock' ) != 'yes' )
|
||||
if ( $held_duration < 1 || get_option( 'woocommerce_manage_stock' ) != 'yes' )
|
||||
return;
|
||||
|
||||
$date = date( "Y-m-d H:i:s", strtotime( '-' . absint( $held_duration ) . ' MINUTES', current_time( 'timestamp' ) ) );
|
||||
|
@ -2435,7 +2447,7 @@ function woocommerce_cancel_unpaid_orders() {
|
|||
AND posts.post_status = 'publish'
|
||||
AND tax.taxonomy = 'shop_order_status'
|
||||
AND term.slug IN ('pending')
|
||||
AND posts.post_date < %s
|
||||
AND posts.post_modified < %s
|
||||
", $date ) );
|
||||
|
||||
if ( $unpaid_orders ) {
|
||||
|
|
|
@ -68,11 +68,11 @@ function woocommerce_template_redirect() {
|
|||
}
|
||||
|
||||
// Redirect to the product page if we have a single product
|
||||
elseif ( is_search() && is_post_type_archive( 'product' ) ) {
|
||||
if ( $wp_query->post_count == 1 ) {
|
||||
$product = get_product( $wp_query->post );
|
||||
if ( $product->is_visible() )
|
||||
wp_safe_redirect( get_permalink( $product->id ), 302 );
|
||||
elseif ( is_search() && is_post_type_archive( 'product' ) && apply_filters( 'woocommerce_redirect_single_search_result', true ) && $wp_query->post_count == 1 ) {
|
||||
$product = get_product( $wp_query->post );
|
||||
|
||||
if ( $product->is_visible() ) {
|
||||
wp_safe_redirect( get_permalink( $product->id ), 302 );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ function woocommerce_nav_menu_items( $items, $args ) {
|
|||
$hide_pages = apply_filters( 'woocommerce_logged_out_hidden_page_ids', $hide_pages );
|
||||
|
||||
foreach ( $items as $key => $item ) {
|
||||
if ( ! empty( $item->object_id ) && in_array( $item->object_id, $hide_pages ) ) {
|
||||
if ( ! empty( $item->object_id ) && ! empty( $item->object ) && in_array( $item->object_id, $hide_pages ) && $item->object == 'page' ) {
|
||||
unset( $items[ $key ] );
|
||||
}
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ function woocommerce_update_cart_action() {
|
|||
continue;
|
||||
|
||||
// Sanitize
|
||||
$quantity = apply_filters( 'woocommerce_stock_amount_cart_item', preg_replace( "/[^0-9\.]/", "", $cart_totals[ $cart_item_key ]['qty'] ), $cart_item_key );
|
||||
$quantity = apply_filters( 'woocommerce_stock_amount_cart_item', apply_filters( 'woocommerce_stock_amount', preg_replace( "/[^0-9\.]/", "", $cart_totals[ $cart_item_key ]['qty'] ) ), $cart_item_key );
|
||||
|
||||
if ( "" === $quantity )
|
||||
continue;
|
||||
|
@ -298,6 +298,7 @@ function woocommerce_add_to_cart_action( $url = false ) {
|
|||
|
||||
$product_id = apply_filters( 'woocommerce_add_to_cart_product_id', absint( $_REQUEST['add-to-cart'] ) );
|
||||
$was_added_to_cart = false;
|
||||
$added_to_cart = array();
|
||||
$adding_to_cart = get_product( $product_id );
|
||||
$add_to_cart_handler = apply_filters( 'woocommerce_add_to_cart_handler', $adding_to_cart->product_type, $adding_to_cart );
|
||||
|
||||
|
@ -312,8 +313,7 @@ function woocommerce_add_to_cart_action( $url = false ) {
|
|||
// Only allow integer variation ID - if its not set, redirect to the product page
|
||||
if ( empty( $variation_id ) ) {
|
||||
$woocommerce->add_error( __( 'Please choose product options…', 'woocommerce' ) );
|
||||
wp_redirect( get_permalink( $product_id ) );
|
||||
exit;
|
||||
return;
|
||||
}
|
||||
|
||||
$attributes = $adding_to_cart->get_attributes();
|
||||
|
@ -366,12 +366,12 @@ function woocommerce_add_to_cart_action( $url = false ) {
|
|||
if ( $woocommerce->cart->add_to_cart( $product_id, $quantity, $variation_id, $variations ) ) {
|
||||
woocommerce_add_to_cart_message( $product_id );
|
||||
$was_added_to_cart = true;
|
||||
$added_to_cart[] = $product_id;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$woocommerce->add_error( __( 'Please choose product options…', 'woocommerce' ) );
|
||||
wp_redirect( get_permalink( $product_id ) );
|
||||
exit;
|
||||
return;
|
||||
}
|
||||
|
||||
// Grouped Products
|
||||
|
@ -380,7 +380,6 @@ function woocommerce_add_to_cart_action( $url = false ) {
|
|||
if ( ! empty( $_REQUEST['quantity'] ) && is_array( $_REQUEST['quantity'] ) ) {
|
||||
|
||||
$quantity_set = false;
|
||||
$added_to_cart = array();
|
||||
|
||||
foreach ( $_REQUEST['quantity'] as $item => $quantity ) {
|
||||
if ( $quantity <= 0 )
|
||||
|
@ -405,16 +404,14 @@ function woocommerce_add_to_cart_action( $url = false ) {
|
|||
|
||||
if ( ! $was_added_to_cart && ! $quantity_set ) {
|
||||
$woocommerce->add_error( __( 'Please choose the quantity of items you wish to add to your cart…', 'woocommerce' ) );
|
||||
wp_redirect( get_permalink( $product_id ) );
|
||||
exit;
|
||||
return;
|
||||
}
|
||||
|
||||
} elseif ( $product_id ) {
|
||||
|
||||
/* Link on product archives */
|
||||
$woocommerce->add_error( __( 'Please choose a product to add to your cart…', 'woocommerce' ) );
|
||||
wp_redirect( get_permalink( $product_id ) );
|
||||
exit;
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
@ -431,6 +428,7 @@ function woocommerce_add_to_cart_action( $url = false ) {
|
|||
if ( $woocommerce->cart->add_to_cart( $product_id, $quantity ) ) {
|
||||
woocommerce_add_to_cart_message( $product_id );
|
||||
$was_added_to_cart = true;
|
||||
$added_to_cart[] = $product_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,7 +453,7 @@ function woocommerce_add_to_cart_action( $url = false ) {
|
|||
|
||||
// Redirect to page without querystring args
|
||||
elseif ( wp_get_referer() ) {
|
||||
wp_safe_redirect( remove_query_arg( array( 'add-to-cart', 'quantity', 'product_id' ), wp_get_referer() ) );
|
||||
wp_safe_redirect( add_query_arg( 'added-to-cart', implode( ',', $added_to_cart ), remove_query_arg( array( 'add-to-cart', 'quantity', 'product_id' ), wp_get_referer() ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Plugin Name: WooCommerce
|
||||
* Plugin URI: http://www.woothemes.com/woocommerce/
|
||||
* Description: An e-commerce toolkit that helps you sell anything. Beautifully.
|
||||
* Version: 2.0.4
|
||||
* Version: 2.0.5
|
||||
* Author: WooThemes
|
||||
* Author URI: http://woothemes.com
|
||||
* Requires at least: 3.5
|
||||
|
@ -37,7 +37,7 @@ class Woocommerce {
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $version = '2.0.4';
|
||||
public $version = '2.0.5';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
@ -124,6 +124,9 @@ class Woocommerce {
|
|||
public function __construct() {
|
||||
|
||||
// Auto-load classes on demand
|
||||
if ( function_exists( "__autoload" ) ) {
|
||||
spl_autoload_register( "__autoload" );
|
||||
}
|
||||
spl_autoload_register( array( $this, 'autoload' ) );
|
||||
|
||||
// Define version constant
|
||||
|
@ -487,7 +490,7 @@ class Woocommerce {
|
|||
add_action( 'wp_footer', array( $this, 'output_inline_js' ), 25 );
|
||||
|
||||
// HTTPS urls with SSL on
|
||||
$filters = array( 'post_thumbnail_html', 'widget_text', 'wp_get_attachment_url', 'wp_get_attachment_image_attributes', 'wp_get_attachment_url', 'option_siteurl', 'option_homeurl', 'option_home', 'option_url', 'option_wpurl', 'option_stylesheet_url', 'option_template_url', 'script_loader_src', 'style_loader_src', 'template_directory_uri', 'stylesheet_directory_uri', 'site_url' );
|
||||
$filters = array( 'post_thumbnail_html', 'widget_text', 'wp_get_attachment_url', 'wp_get_attachment_image_attributes', 'wp_get_attachment_url', 'option_stylesheet_url', 'option_template_url', 'script_loader_src', 'style_loader_src', 'template_directory_uri', 'stylesheet_directory_uri', 'site_url' );
|
||||
|
||||
foreach ( $filters as $filter )
|
||||
add_filter( $filter, array( $this, 'force_ssl' ) );
|
||||
|
@ -623,6 +626,8 @@ class Woocommerce {
|
|||
|
||||
if ( file_exists( STYLESHEETPATH . '/' . $this->template_url . 'single-product-reviews.php' ))
|
||||
return STYLESHEETPATH . '/' . $this->template_url . 'single-product-reviews.php';
|
||||
elseif ( file_exists( TEMPLATEPATH . '/' . $this->template_url . 'single-product-reviews.php' ))
|
||||
return TEMPLATEPATH . '/' . $this->template_url . 'single-product-reviews.php';
|
||||
else
|
||||
return $this->plugin_path() . '/templates/single-product-reviews.php';
|
||||
}
|
||||
|
@ -775,7 +780,7 @@ class Woocommerce {
|
|||
**/
|
||||
do_action( 'woocommerce_register_taxonomy' );
|
||||
|
||||
$admin_only_query_var = ( is_admin() ) ? true : false;
|
||||
$admin_only_query_var = is_admin();
|
||||
|
||||
register_taxonomy( 'product_type',
|
||||
apply_filters( 'woocommerce_taxonomy_objects_product_type', array('product') ),
|
||||
|
@ -1364,13 +1369,15 @@ class Woocommerce {
|
|||
* @return string
|
||||
*/
|
||||
public function api_request_url( $request, $ssl = null ) {
|
||||
if ( is_null( $ssl ) )
|
||||
$ssl = is_ssl();
|
||||
if ( is_null( $ssl ) ) {
|
||||
$scheme = parse_url( get_option( 'home' ), PHP_URL_SCHEME );
|
||||
} elseif ( $ssl ) {
|
||||
$scheme = 'https';
|
||||
} else {
|
||||
$scheme = 'http';
|
||||
}
|
||||
|
||||
$url = trailingslashit( home_url( '/wc-api/' . $request ) );
|
||||
$url = $ssl ? str_replace( 'http:', 'https:', $url ) : str_replace( 'https:', 'http:', $url );
|
||||
|
||||
return esc_url_raw( $url );
|
||||
return esc_url_raw( trailingslashit( home_url( '/wc-api/' . $request, $scheme ) ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1993,4 +2000,4 @@ class Woocommerce {
|
|||
*/
|
||||
$GLOBALS['woocommerce'] = new Woocommerce();
|
||||
|
||||
} // class_exists check
|
||||
} // class_exists check
|
||||
|
|
Loading…
Reference in New Issue