2016-11-24 91 views
0

我正在運行一個WordPress的多站點安裝,我已經得到了WooCommerce積分&獎勵插件安裝。WordPress的:積分和獎勵WP_Term錯誤

在查看結帳時,出現此錯誤。

Notice: Object of class WP_Term could not be converted to int 
in /wp-content/plugins/woocommerce-points-and-rewards/includes 
/class-wc-points-rewards-product.php on line 547 

,它是指過的代碼是:

$category_ids_string = implode(',', array_map('intval', $category_ids)); 

我試圖解決這一點,但我一直沒能如願。任何人都可以提出任何我可以解決這個問題的方法嗎?

的網站是不是由於發射到下週,但地址:http://bartonsdrinks.com

感謝

回答

0

$category_ids可能是長期對象的數組。它需要是一個單值的數組。

所以通過$category_ids環和分配術語IDS到一個新的數組:

// I would rename your: $category_ids to: $categories cause it makes more sense 
$categories = $category_ids; 
$category_ids = array(); 

// It would be better if you changed the definition instead of above solution 

if(!empty($categories)){ 
    foreach($categories as $cat){ 
     $category_ids[] = $cat->term_id; 
    } 
} 

$category_ids_string = implode(',', array_map('intval', $category_ids)); 

這也許應該使其工作。