• If you want to get it to work with woocommerce:

    1. In batchmove/batch_admin.php, comment out line:

    if ($bm->cat == "") {return;}

    2. in batchmove/include/functions.php
    a) replace the whole ‘switch’ at line 21 with:

    switch ($apost['act-cats']) {
    	case "add":
    		foreach ((array) $apost['ids'] as $id) {
    			$id = intval($id);
    			wp_set_post_terms($id, array(intval($cat)), 'product_cat',true);
    		}
    		break;
    	case 'upd':
    		foreach ((array) $apost['ids'] as $id) {
    			$new = array();
    			$new[] = intval($cat);
    			wp_set_post_terms($id, (array) $new, 'product_cat');
    		}
    			break;
    	case 'del':
    		foreach ((array) $apost['ids'] as $id) {
    			$id = intval($id);
    			wp_remove_object_terms( $id, intval($cat), 'product_cat' );
    		}
    		break;
    	default:
    	;
    } // switch

    b) in function show_bm_selector:
    replace the line

    $html .= wp_dropdown_categories('hide_empty=0&hierarchical=1&echo=0&selected=' .
    			( isset($_REQUEST['cat']) ? intval($_REQUEST['cat']) : -1 ));

    with

    $html .= wp_dropdown_categories('hide_empty=0&hierarchical=1&echo=0&taxonomy=product_cat&selected=' .
    			( isset($_REQUEST['cat']) ? intval($_REQUEST['cat']) : -1 ));

    c) in function show_bm_actions:
    replace the line

    $html .= wp_dropdown_categories('name=qcat&hide_empty=0&hierarchical=1&echo=0' );

    with

    $html .= wp_dropdown_categories('name=qcat&hide_empty=0&hierarchical=1&echo=0&taxonomy=product_cat' );

    d) in function get_results
    replace the line

    $categories = wp_get_post_categories($post->ID);

    with

    $categories = wp_get_post_terms($post->ID,'product_cat');

    e) in function get_a_query

    Replace

    $qa = array( 'paged' => $bm->paged,
    	 			 'posts_per_page' => $bm->per_page,
    				 'orderby' => $bm->orderby,
    				 'order' => $bm->order);

    with

    $gets = $bm->get;
    	$cat = (empty($gets['cat']))?$gets['qcat']:$gets['cat'];
    	if ($cat) {
    		$qa['cat'] = intval($cat);
    	}
    	$qa = array( 'paged' => $bm->paged,
    	 			 'posts_per_page' => $bm->per_page,
    				 'orderby' => $bm->orderby,
    				 'order' => $bm->order,
    				 'tax_query' => array(
    					array(
    						'taxonomy' => 'product_cat',
    						'field' => 'term_id',
    						'terms' => intval($cat)
    					)
    				 )
    		);

    You should make a backup of the 2 files first. Good Luck!

  • The topic ‘Useful plugin – Getting it to work with woocommerce’ is closed to new replies.