woocomerce atribute samo za odredjene kategorij
-
Radim sajt sa pluginom WC Marketplace i https://wordpress.org/plugins/wc-frontend-manager/ gde korisnici sami dodaju proizvode.Medjutim problem je sledeci jer mi se vide svi atributi koje sam namestio u woocomercu ali ja bi zeleo da se vide samo proizvodi koji su za odredjenu kategoriju.Koja je kategorija to cu da odredim ali ne znam kako da mi ispise samo odredjene atribute.Atributa ima dosta da bi to radio peske ali na kraju cu izgleda morati
-
u samom pluginu nasao sam kod koji ispisuje sve atribyte prilikom dodavanja proizvoda to je ovaj kod `function wcfm_products_manage_select_attributes( $product_id = 0 ) {
global $WCFM, $WCFMu, $wc_product_attributes;$wcfm_attributes = array();
if( $product_id ) {
$wcfm_attributes = get_post_meta( $product_id, ‘_product_attributes’, true );
}$attribute_taxonomies = array(„alkohol“,“voce“);
$attributes = array();
$acnt = 0;
if ( ! empty( $attribute_taxonomies ) ) {
foreach ( $attribute_taxonomies as $attribute_taxonomy ) {
$att_taxonomy = wc_attribute_taxonomy_name( $attribute_taxonomy );
$attributes[$acnt][‘term_name’] = $att_taxonomy;
$attributes[$acnt][‘name’] = wc_attribute_label( $att_taxonomy );
$attributes[$acnt][‘attribute_taxonomy’] = $attribute_taxonomy;
$attributes[$acnt][‘tax_name’] = $att_taxonomy;
$attributes[$acnt][‘is_taxonomy’] = 1;$args = array(
‘orderby’ => ‘name’,
‘hide_empty’ => 0
);
$all_terms = get_terms( $att_taxonomy, apply_filters( ‘wcfm_product_attribute_terms’, $args ) );
$attributes_option = array();
if ( $all_terms ) {
foreach ( $all_terms as $term ) {
$attributes_option[$term->term_id] = esc_attr( apply_filters( ‘woocommerce_product_attribute_term_name’, $term->name, $term ) );
}
}
$attributes[$acnt][‘option_values’] = $attributes_option;
$attributes[$acnt][‘value’] = wp_get_post_terms( $product_id, $att_taxonomy, array( ‘fields’ => ‘ids’ ) );
$attributes[$acnt][‘is_active’] = “;
$attributes[$acnt][‘is_visible’] = “;
$attributes[$acnt][‘is_variation’] = “;if( $product_id && !empty( $wcfm_attributes ) ) {
foreach( $wcfm_attributes as $wcfm_attribute ) {
if ( $wcfm_attribute[‘is_taxonomy’] ) {
if( $att_taxonomy == $wcfm_attribute[‘name’] ) {
$attributes[$acnt][‘is_active’] = ‘enable’;
$attributes[$acnt][‘is_visible’] = $wcfm_attribute[‘is_visible’] ? ‘enable’ : “;
$attributes[$acnt][‘is_variation’] = $wcfm_attribute[‘is_variation’] ? ‘enable’ : “;
}
}
}
}// Global Level
$allow_add_term = “;
if( WCFM_Dependencies::wcfmu_plugin_active_check() && apply_filters( ‘wcfm_is_allow_add_attribute_term’, true ) ) {
$allow_add_term = ‘wc_attribute_values allow_add_term’;
}
$attrlimit = apply_filters( ‘wcfm_attribute_limit’, -1 );// Attribute wise level
if( !apply_filters( ‘wcfm_is_allow_add_attribute_term_’.$att_taxonomy, true, $att_taxonomy ) ) {
$allow_add_term = “;
}
$attrlimit = apply_filters( ‘wcfm_attribute_limit_’.$att_taxonomy, $attrlimit, $att_taxonomy );$attributes = apply_filters( ‘wcfm_product_custom_attributes_data’, apply_filters( ‘wcfm_product_custom_attribute_date_’.$att_taxonomy, $attributes, $att_taxonomy ) );
$WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( ‘wcfm_product_custom_attributes’, apply_filters( ‘wcfm_product_custom_attribute_’.$att_taxonomy, array(
„select_attributes_“.$att_taxonomy => array( ‘type’ => ‘multiinput’, ‘class’ => ‘wcfm-text wcfm_select_attributes wcfm_ele simple variable external grouped booking’, ‘label_class’ => ‘wcfm_title’, ‘value’ => $attributes, ‘options’ => array(
„term_name“ => array(‘type’ => ‘hidden’),
„is_active“ => array(‘label’ => __(‘Active?’, ‘wc-frontend-manager’), ‘type’ => ‘checkbox’, ‘value’ => ‘enable’, ‘attributes’ => array( ‘title’ => __( ‘Check to associate this attribute with the product’, ‘wc-frontend-manager-ultimate’ ) ), ‘class’ => ‘wcfm-checkbox wcfm_ele attribute_ele simple variable external grouped booking’, ‘label_class’ => ‘wcfm_title attribute_ele checkbox_title’),
„name“ => array(‘label’ => __(‘Name’, ‘wc-frontend-manager’), ‘type’ => ‘text’, ‘attributes’ => array( ‘readonly’ => true ), ‘class’ => ‘wcfm-text wcfm_ele attribute_ele simple variable external grouped booking’, ‘label_class’ => ‘wcfm_title attribute_ele’),
„value“ => array(‘label’ => __(‘Value(s):’, ‘wc-frontend-manager’), ‘type’ => ‘select’, ‘custom_attributes’ => array( ‘attrlimit’ => $attrlimit ), ‘attributes’ => array( ‘multiple’ => ‘multiple’, ‘style’ => ‘width: 60%;’ ), ‘class’ => ‘wcfm-select wcfm_ele simple variable external grouped booking ‘ . $allow_add_term, ‘label_class’ => ‘wcfm_title’),
„is_visible“ => array(‘label’ => __(‘Visible on the product page’, ‘wc-frontend-manager’), ‘type’ => ‘checkbox’, ‘value’ => ‘enable’, ‘class’ => ‘wcfm-checkbox wcfm_ele simple variable external grouped booking’, ‘label_class’ => ‘wcfm_title checkbox_title’),
„is_variation“ => array(‘label’ => __(‘Use as Variation’, ‘wc-frontend-manager’), ‘type’ => ‘checkbox’, ‘value’ => ‘enable’, ‘class’ => ‘wcfm-checkbox wcfm_ele variable variable-subscription’, ‘label_class’ => ‘wcfm_title checkbox_title wcfm_ele variable variable-subscription’),
„tax_name“ => array(‘type’ => ‘hidden’),
„is_taxonomy“ => array(‘type’ => ‘hidden’)
))
), ‘select_attributes_’.$att_taxonomy, $att_taxonomy, $attributes ), ‘select_attributes_’.$att_taxonomy ) );
}
}
}`Sad mene zanima kako pomocu funkcije da ga zamenim, da lista samo atribute koje ja zadam
- Тема woocomerce atribute samo za odredjene kategorij је закључана за нове одговоре.