Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM › display only certain attributes
- This topic has 8 replies, 2 voices, and was last updated 5 years, 2 months ago by Jovica.
- AuthorPosts
- February 17, 2019 at 6:04 pm #48620JocaGuest
Hello, how can I edit my attribute. I’d like to show only certain attributes, not everything. I would like to have certain attributes based on the selected category, but I do not know how to modify this code
- February 17, 2019 at 6:04 pm #48621JocaGuest
<?php
do_action( ‘wcfm_products_manage_attributes’, $product_id );$WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( ‘product_simple_fields_attributes’, array(
“attributes” => array( ‘label’ => __( ‘Attributes’, ‘wc-frontend-manager’ ), ‘type’ => ‘multiinput’, ‘class’ => ‘wcfm-text wcfm_ele simple variable external grouped booking’, ‘has_dummy’ => true, ‘label_class’ => ‘wcfm_title’, ‘value’ => ‘vino’, ‘options’ => array(
“term_name” => array(‘type’ => ‘checkbox’),
“is_active” => array(‘label’ => __(‘Active?’, ‘wc-frontend-manager’), ‘type’ => ‘checkbox’, ‘value’ => ‘enable’, ‘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’, ‘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’ => ‘textarea’, ‘class’ => ‘wcfm-textarea wcfm_ele simple variable external grouped booking’, ‘placeholder’ => sprintf( __(‘Enter some text, some attributes by “%s” separating values.’, ‘wc-frontend-manager’), WC_DELIMITER ), ‘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’)
))
)) );
?> - February 17, 2019 at 8:28 pm #48635JocaGuest
I found the function wcfm_products_manage_select_attributes
in the path core / class-wcfm-frontend.php and got a hundred I want but how to transfer all of that to the function of my you. What I want is that when a category is selected through wp_dropdown_categories of the bobbies, its terms are attributed. - February 18, 2019 at 6:52 am #48717WCFM ForumKeymaster
Hi,
Do you want to allow certain attributes to your vendors?
Then this is possible using WCFM Capability setting – https://ibb.co/ZMH8HjH
Well, this capability option comes with WCFM Ultimate.
But there is no category-attribute relation yet.
Thank You
- February 18, 2019 at 6:13 pm #48819JovicaGuest
category-attribute relation би ја урадио тако што би у мета терм категорије додао аттрибуте.
Приликом додавања производа и одабиром категорије мењају се атрибјти које сам ја додао.Вендор не додаје атрибуте.
Термс мета би одредио бутем селектоване категорије путем ајаxа и wp_dropdown_чатегориес.Све то сам урадио само немогу како путем сопствене функције да листам atribute.Ако сам добро схватио овај код листа аттрибуте и само би wc_get_attribute_taxonomies() заменио са термс мета укоји су атрубути везани за ту kategoriju. /**
* WCFMu Product Select Attributes using WC Taxonomy Attribute
*/
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 );
}
print_r($attribute_taxonomies);
$attribute_taxonomies = wc_get_attribute_taxonomies();
$attributes = array();
$acnt = 0;
if ( ! empty( $attribute_taxonomies ) ) {
foreach ( $attribute_taxonomies as $attribute_taxonomy ) {
if ( ( ‘text’ !== $attribute_taxonomy->attribute_type ) && $attribute_taxonomy->attribute_name ) {
$att_taxonomy = wc_attribute_taxonomy_name( $attribute_taxonomy->attribute_name );
$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; - February 19, 2019 at 6:35 am #48885WCFM ForumKeymaster
Hi,
This code is for generating Attributes list.
But you have to add your logic using JavaScript, as attributes has to be alter on depend upon category selection.
Thank You
- February 19, 2019 at 9:10 am #48914JovicaGuest
What is the hook for changing this code or how to insert it into my function of the topic. To get the id through JavaScript I know how to link to this code? Thanks
- February 19, 2019 at 1:45 pm #48990WCFM ForumKeymaster
Hi,
Please check here – https://ibb.co/kHhy5C7
It has many filters to alter this attributes list.
Thank You
- February 23, 2019 at 8:16 am #49667JovicaGuest
Thanks, I just do not know how to add it to my function. I did not do that, so if you help me do this. This is my function function cat_select_attributes ($ attribute_taxonomies) {?>
<? php $ _POST [‘cat’];?>
<? php}
add_action (‘wp_ajax_my_special_ajax_call’, ‘cat_select_attributes’);
add_action (‘wp_ajax_nopriv_my_special_ajax_call’, ‘cat_select_attributes’);
- AuthorPosts
- The topic ‘display only certain attributes’ is closed to new replies.