is_type('simple')) { $allowed_products[$pid] = $p; } } $groups = array(); if (!empty($cat_ids)) { $others = array(); foreach ($allowed_products as $pid => $p) { $terms = get_the_terms($pid, 'product_cat'); $matched = false; if (is_array($terms)) { foreach ($terms as $t) { if (in_array($t->term_id, $cat_ids, true)) { if (!isset($groups[$t->term_id])) { $groups[$t->term_id] = array('term' => $t, 'items' => array()); } $groups[$t->term_id]['items'][] = $p; $matched = true; } } } if (!$matched) $others[] = $p; } if (!empty($others)) $groups[0] = array('term' => null, 'items' => $others); } else { $groups[0] = array('term' => null, 'items' => array_values($allowed_products)); } // --- 数据准备逻辑结束 --- ?>

0

$group) : ?>

name); ?>

get_id(); $thumbnail = $item->get_image('woocommerce_thumbnail'); ?>

get_name()); ?>

get_price_html()); ?>