예제 #1
0
				</select>
				</label>
				
				<?php 
    // SELECT TERMS //
    ?>
				<label class="field"><a class="datatips" data-tip="<?php 
    _e('If you do not select a term, the mold will be applied only to variations set on -any-', 'woocommerce-molds');
    ?>
" href="#"><b><?php 
    _e('Terms', 'woocommerce-molds');
    ?>
 :</b></a>
					<?php 
    ## Let's get the mold terms already registered ##
    $the_terms = $mold->pm_get_mold_terms();
    ## If we have an attribute we can get the terms ##
    if ($the_attribute != "none" && $the_attribute != "default") {
        global $wpdb;
        // We connect to the DB to get the terms
        $attribute_name = "order_" . $the_attribute;
        $rows = $wpdb->get_results($wpdb->prepare("SELECT name FROM " . $wpdb->prefix . "terms WHERE term_id IN ( SELECT woocommerce_term_id FROM " . $wpdb->prefix . "woocommerce_termmeta WHERE meta_key = '%s')", $attribute_name));
        ## ALL CHECKED FLAG ##
        $all = false;
        $script_terms = array();
        $counter = 0;
        // Get the damn terms
        foreach ($rows as $row) {
            $name = $row->name;
            // Registering the terms id for javascript use
            $script_terms[$counter] = $name;