Fixed "undefined index" errors and made sure term meta database table is registered.
This commit is contained in:
parent
5d84ea814a
commit
104166adba
|
@ -275,7 +275,9 @@ function woocommerce_products_by_category() {
|
|||
$output = "<select name='product_cat' id='dropdown_product_cat'>";
|
||||
$output .= '<option value="">'.__('Show all categories', 'woothemes').'</option>';
|
||||
foreach($terms as $term){
|
||||
$output .="<option value='$term->slug' ".selected($term->slug, $wp_query->query['product_cat'], false).">$term->name ($term->count)</option>";
|
||||
if ( isset( $wp_query->query['product_cat'] ) ) {
|
||||
$output .="<option value='$term->slug' ".selected($term->slug, $wp_query->query['product_cat'], false).">$term->name ($term->count)</option>";
|
||||
}
|
||||
}
|
||||
$output .="</select>";
|
||||
echo $output;
|
||||
|
|
|
@ -15,7 +15,10 @@
|
|||
function woocommerce_update_options($options) {
|
||||
|
||||
if(!isset($_POST) || !$_POST) return false;
|
||||
|
||||
|
||||
// Nonce security check.
|
||||
check_admin_referer( 'woocommerce_admin_fields' );
|
||||
|
||||
foreach ($options as $value) {
|
||||
if (isset($value['id']) && $value['id']=='woocommerce_tax_rates') :
|
||||
|
||||
|
@ -125,6 +128,9 @@ function woocommerce_update_options($options) {
|
|||
*/
|
||||
function woocommerce_admin_fields($options) {
|
||||
global $woocommerce;
|
||||
|
||||
// Nonce security field.
|
||||
wp_nonce_field( 'woocommerce_admin_fields' );
|
||||
|
||||
foreach ($options as $value) :
|
||||
switch($value['type']) :
|
||||
|
|
|
@ -627,7 +627,7 @@ function woocommerce_settings() {
|
|||
$links = array();
|
||||
|
||||
foreach ($woocommerce->payment_gateways->payment_gateways() as $gateway) :
|
||||
$title = ($gateway->method_title) ? ucwords($gateway->method_title) : ucwords($gateway->id);
|
||||
$title = ( isset( $gateway->method_title ) && $gateway->method_title) ? ucwords($gateway->method_title) : ucwords($gateway->id);
|
||||
$links[] = '<a href="#gateway-'.$gateway->id.'">'.$title.'</a>';
|
||||
endforeach;
|
||||
|
||||
|
|
|
@ -13,18 +13,6 @@
|
|||
* Categories ordering
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add a table to $wpdb to benefit from wordpress meta api
|
||||
*/
|
||||
add_action('init','taxonomy_metadata_wpdbfix');
|
||||
add_action('switch_blog','taxonomy_metadata_wpdbfix');
|
||||
|
||||
function taxonomy_metadata_wpdbfix() {
|
||||
global $wpdb;
|
||||
$wpdb->woocommerce_termmeta = "{$wpdb->prefix}woocommerce_termmeta";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add product_cat ordering to get_terms
|
||||
*
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*
|
||||
* Actions/functions/hooks for WooCommerce related events.
|
||||
*
|
||||
* - Add a table to $wpdb to benefit from the WordPress Metadata API
|
||||
* - AJAX update shipping method on cart page
|
||||
* - AJAX update order review on checkout
|
||||
* - AJAX add to cart
|
||||
|
@ -23,6 +24,24 @@
|
|||
* @author WooThemes
|
||||
*/
|
||||
|
||||
/**
|
||||
* woocommerce_taxonomy_metadata_wpdbfix()
|
||||
*
|
||||
* Add a table to $wpdb to benefit from the WordPress Metadata API
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @uses $wpdb global
|
||||
*/
|
||||
add_action( 'init', 'woocommerce_taxonomy_metadata_wpdbfix', 0 );
|
||||
add_action( 'switch_blog', 'woocommerce_taxonomy_metadata_wpdbfix', 0 );
|
||||
|
||||
function woocommerce_taxonomy_metadata_wpdbfix() {
|
||||
global $wpdb;
|
||||
|
||||
$variable_name = 'woocommerce_termmeta';
|
||||
$wpdb->$variable_name = $wpdb->prefix . $variable_name;
|
||||
$wpdb->tables[] = $variable_name;
|
||||
} // End woocommerce_taxonomy_metadata_wpdbfix()
|
||||
|
||||
/**
|
||||
* AJAX update shipping method on cart page
|
||||
|
|
Loading…
Reference in New Issue