コード例 #1
0
ファイル: Coupon.php プロジェクト: hyyan/woo-poly-integration
 /**
  * Get array of term translations IDS.
  *
  * @param int $ID the term ID
  *
  * @return array array contains all translation IDS for the given term
  */
 protected function getProductTermTranslationIDS($ID)
 {
     $IDS = Utilities::getTermTranslationsArrayByID($ID);
     return $IDS ? $IDS : array($ID);
 }
コード例 #2
0
 /**
  * Collect products from category translations
  *
  * Add all products in the given category translations
  *
  * @param array   $productIDS array of products in the given category
  * @param integer $categoryID category ID
  *
  * @return array array of producs in the given category and its translations
  */
 public function addProductsInCategoryTranslations($productIDS, $categoryID)
 {
     if (static::isCombine()) {
         /* Find the category translations */
         $translations = Utilities::getTermTranslationsArrayByID($categoryID);
         foreach ($translations as $slug => $ID) {
             if ($ID === $categoryID) {
                 continue;
             }
             $termIDS = get_term_children($ID, 'product_cat');
             $termIDS[] = $ID;
             $productIDS = array_merge($productIDS, (array) get_objects_in_term($termIDS, 'product_cat'));
         }
     }
     return $productIDS;
 }
コード例 #3
0
 /**
  * Do sync category custom fields
  *
  * @param integer $ID    the term ID
  * @param string  $key   the key
  * @param mixed   $value the value
  */
 public function doSyncProductCatCustomFields($ID, $key, $value = '')
 {
     $translations = Utilities::getTermTranslationsArrayByID($ID);
     foreach ($translations as $translation) {
         update_woocommerce_term_meta($translation, $key, $value);
     }
 }