Made shipping classes a bit more DRY

This commit is contained in:
Geert De Deckere 2012-05-05 15:32:24 +02:00
parent 473347d1f6
commit 75d8163d36
5 changed files with 7 additions and 7 deletions

View File

@ -19,8 +19,8 @@ class WC_Flat_Rate extends WC_Shipping_Method {
$this->admin_page_heading = __('Flat Rates', 'woocommerce');
$this->admin_page_description = __('Flat rates let you define a standard rate per item, or per order.', 'woocommerce');
add_action('woocommerce_update_options_shipping_flat_rate', array(&$this, 'process_admin_options'));
add_action('woocommerce_update_options_shipping_flat_rate', array(&$this, 'process_flat_rates'));
add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_admin_options'));
add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_flat_rates'));
$this->init();
}

View File

@ -33,7 +33,7 @@ class WC_Free_Shipping extends WC_Shipping_Method {
$this->requires_coupon = $this->settings['requires_coupon'];
// Actions
add_action('woocommerce_update_options_shipping_free_shipping', array(&$this, 'process_admin_options'));
add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_admin_options'));
}
/**

View File

@ -22,8 +22,8 @@ class WC_International_Delivery extends WC_Flat_Rate {
$this->admin_page_heading = __('International Delivery', 'woocommerce');
$this->admin_page_description = __('International delivery based on flat rate shipping.', 'woocommerce');
add_action('woocommerce_update_options_shipping_international_delivery', array(&$this, 'process_admin_options'));
add_action('woocommerce_update_options_shipping_international_delivery', array(&$this, 'process_flat_rates'));
add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_admin_options'));
add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_flat_rates'));
$this->init();
}

View File

@ -35,7 +35,7 @@ class WC_Local_Delivery extends WC_Shipping_Method {
$this->availability = empty( $this->settings['availability'] ) ? '' : $this->settings['availability'];
$this->countries = empty( $this->settings['countries'] ) ? '' : $this->settings['countries'];
add_action('woocommerce_update_options_shipping_local_delivery', array(&$this, 'process_admin_options'));
add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_admin_options'));
}
function calculate_shipping( $package = array() ) {

View File

@ -31,7 +31,7 @@ class WC_Local_Pickup extends WC_Shipping_Method {
$this->availability = $this->settings['availability'];
$this->countries = $this->settings['countries'];
add_action('woocommerce_update_options_shipping_local_pickup', array(&$this, 'process_admin_options'));
add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_admin_options'));
}
function calculate_shipping() {