WC_Ajax class for ajax events

This commit is contained in:
Mike Jolley 2013-11-14 12:13:34 +00:00
parent d7ee32b18a
commit 645ca3e834
7 changed files with 1559 additions and 1699 deletions

View File

@ -51,7 +51,7 @@ jQuery(document).ready(function($) {
ui.item.find('.check-column input').hide().after('<img alt="processing" src="images/wpspin_light.gif" class="waiting" style="margin-left: 6px;" />');
// go do the sorting stuff via ajax
$.post( ajaxurl, { action: 'woocommerce-term-ordering', id: termid, nextid: nexttermid, thetaxonomy: woocommerce_term_ordering_params.taxonomy }, function(response){
$.post( ajaxurl, { action: 'woocommerce_term_ordering', id: termid, nextid: nexttermid, thetaxonomy: woocommerce_term_ordering_params.taxonomy }, function(response){
if ( response == 'children' ) window.location.reload();
else {
ui.item.find('.check-column input').show().siblings('img').remove();

View File

@ -350,7 +350,7 @@ class WC_Admin_CPT_Product extends WC_Admin_CPT {
}
break;
case 'featured':
$url = wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce-feature-product&product_id=' . $post->ID ), 'woocommerce-feature-product' );
$url = wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_feature_product&product_id=' . $post->ID ), 'woocommerce-feature-product' );
echo '<a href="' . $url . '" title="'. __( 'Toggle featured', 'woocommerce' ) . '">';
if ( $the_product->is_featured() ) {
echo '<span class="wc-featured tips" data-tip="' . __( 'Yes', 'woocommerce' ) . '">' . __( 'Yes', 'woocommerce' ) . '</span>';

View File

@ -281,14 +281,14 @@ class WC_Admin_CPT_Shop_Order extends WC_Admin_CPT {
if ( in_array( $the_order->status, array( 'pending', 'on-hold' ) ) )
$actions['processing'] = array(
'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce-mark-order-processing&order_id=' . $post->ID ), 'woocommerce-mark-order-processing' ),
'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_processing&order_id=' . $post->ID ), 'woocommerce-mark-order-processing' ),
'name' => __( 'Processing', 'woocommerce' ),
'action' => "processing"
);
if ( in_array( $the_order->status, array( 'pending', 'on-hold', 'processing' ) ) )
$actions['complete'] = array(
'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce-mark-order-complete&order_id=' . $post->ID ), 'woocommerce-mark-order-complete' ),
'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_complete&order_id=' . $post->ID ), 'woocommerce-mark-order-complete' ),
'name' => __( 'Complete', 'woocommerce' ),
'action' => "complete"
);

1553
includes/class-wc-ajax.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -114,7 +114,7 @@ class WC_Frontend_Scripts {
'update_order_review_nonce' => wp_create_nonce( "update-order-review" ),
'apply_coupon_nonce' => wp_create_nonce( "apply-coupon" ),
'option_guest_checkout' => get_option( 'woocommerce_enable_guest_checkout' ),
'checkout_url' => add_query_arg( 'action', 'woocommerce-checkout', WC()->ajax_url() ),
'checkout_url' => add_query_arg( 'action', 'woocommerce_checkout', WC()->ajax_url() ),
'is_checkout' => is_page( woocommerce_get_page_id( 'checkout' ) ) && empty( $wp->query_vars['order-pay'] ) && ! isset( $wp->query_vars['order-received'] ) ? 1 : 0,
'locale' => json_encode( WC()->countries->get_country_locale() )
) ) );

File diff suppressed because it is too large Load Diff

View File

@ -315,7 +315,7 @@ final class WooCommerce {
* Include required ajax files.
*/
public function ajax_includes() {
include_once( 'woocommerce-ajax.php' ); // Ajax functions for admin and the front-end
include_once( 'includes/class-wc-ajax.php' ); // Ajax functions for admin and the front-end
}
/**