WC Lovers

WooCommerce Frontend Manager - Multivendor marketplace vendor dashboard

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Forum Replies Created

Viewing 22 posts - 1 through 22 (of 22 total)
  • Author
    Posts
  • SSC
    Participant

    Best option would be to copy the template /wc-frontend-manager/views/enquiry/wcfm-view-enquiry-form.php to a child theme, as there are no other hooks/filters for the inquiry forms.

    in reply to: CHANGES in WCFM Marketplace NOT GETTING SAVED #141501
    SSC
    Participant

    Cool, I’ll check it out.

    in reply to: CHANGES in WCFM Marketplace NOT GETTING SAVED #141495
    SSC
    Participant

    Interesting.. I too am experiencing save issues with the settings, but only ever since wcfm v6.5.0
    I see you are using v6.4.8, is this accurate?
    I am well-versed in coding and development but can not find any obvious errors.
    I was starting to think maybe it is a error with the new woocommerce version, but it works fine with woo v4.2.0 and wcfm v6.4.9
    I see you have a higher wcfm ultimate version, than the base version; I still don’t believe that is the issue though.
    For sure this is a head-banger. Do you have access to the server files? Are you able to view apache2 error logs?
    I have no errors anywhere…. really makes no sense why settings are no longer being saved for a lot of people…

    SSC
    Participant

    Where exactly do you want the message to show?
    There are not many filters for the enquiry form.
    This snippet will replace the title on the form. The only other filter is for the recaptcha gglcptch_display_recaptcha

    add_filter( 'wcfm_enquiry_form_heading', function( $wcfm_enquiry_form_heading ) {
    	$wcfm_enquiry_form_heading = 'custom text here';
    	return $wcfm_enquiry_form_heading;
    }, 50, 1 );

    The only filters I see for the ‘inquiry boards’ page, which the vendors see, is for data filters. i.e. sold by, date range, products, etc.

    in reply to: Custom Fields Stopped Working #120289
    SSC
    Participant

    I also mentioned, “The fields are no longer saving as post_meta”.
    I suppose I should have added more info, it has been quite hectic over here and it was very late when I posted this xD.
    I believe it stopped working after the latest update. I got back around to this today and figure out what the issue was.
    Changed “woocommerce_before_checkout_form” to “woocommerce_checkout_before_customer_details” and added “$checkout = WC()->checkout();” everything works fine now, and I will no longer need help on this issue.

    in reply to: Downloadable not saving #110268
    SSC
    Participant

    It seems all the logic is there and that it should work, but it sadly does not. I tried moving things around a few different ways, but that product type still always showed for the vendor when it should be disabled. I ended up just using a purchase check, which would check if they purchased that membership, but this would be a issue doing it this way when manually adding a vendor to the group.

    in reply to: Downloadable not saving #110008
    SSC
    Participant

    The if statements in _allow_custom_product_types_manager did fix the issue with most capabilities, but I am still having a problem with group capabilities when the group is linked to a membership. The only thing I was able to find that came close to those hooks were _wcfm_vendor_group and _group_capability_options but that didn’t work.

    in reply to: Downloadable not saving #109917
    SSC
    Participant

    && !current_user_can( 'administrator' )
    Is normally removed, I just added that to do a test and forgot to remove it here.

    in reply to: Downloadable not saving #109915
    SSC
    Participant

    I did get this solved with the following snippet

    add_filter( 'wcfm_capability_settings_fields_product_types', function(
    $product_types, $handler, $wcfm_capability_options = array() ) {
    global $WCFM;
    $CustomType = ( isset( $wcfm_capability_options['CustomType'] ) ) ? $wcfm_capability_options['CustomType'] : 'no';
    $product_types['CustomType'] = array('label' => __('CustomType', 'wc-frontend-manager') , 'name' => $handler.'[CustomType]','type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $CustomType);
    return $product_types;
    }, 60, 3 );

    Though, I am still experiencing some problems. All the capabilities are saving, but they are not being respected. With the capability turned off, the vendor is still able to select that product type when creating a product.

    function _allow_custom_product_types_manager( $product_types, $wcfm_capability_options = array() ) {
    global $WCFM;
    $CustomType = ( isset( $wcfm_capability_options['CustomType'] ) ) ? $wcfm_capability_options['CustomType'] : 'no';
    if( $CustomType == 'yes' && !current_user_can( 'administrator' ) ) unset( $product_types[ 'CustomType' ] );
    return $product_types;
    }
    add_filter( 'wcfm_product_types', '_allow_custom_product_types_manager', 700 );

    I was suggested to change it to the below snippet, but that does not work either.

    add_filter( 'wcfm_allowed_product_types', function( $product_types, $wcfm_capability_options ) {
    $CustomType = ( isset( $wcfm_capability_options['CustomType'] ) ) ? $wcfm_capability_options['CustomType'] : 'no';
    if( $CustomType == 'yes' ) unset( $product_types[ 'CustomType' ] );
    return $product_types;
    }, 50, 2 );
    in reply to: Downloadable not saving #109416
    SSC
    Participant

    Thank you for the help, I have solved the downloadable problems with that snippet, but I am a little confused on the capability issues still.
    I added $handler = 'wcfm_capability_options', is the handler suppose to be called somewhere? Do I need to make multiple functions for each user type (i.e. manager, staff, default)?
    Currently, I can change the options on the ‘vendor’ level only, but it does not save. The other capability levels do not allow the option to be selected at all.

    in reply to: Email verification text #109099
    SSC
    Participant

    If you mean for ‘multivendor membership’ you would make a copy in your child theme of ‘wc-multivendor-marketplace/views/emails/email-verification.php’

    in reply to: Downloadable not saving #109050
    SSC
    Participant

    The capabilities problem is coming from ‘wcfmgs-view-shop-manager-capability’ and ‘wcfmgs-view-shop-staff-capability’.
    I tried adding wcfm_shop_manager_capability_options and wcfm_shop_staff_capability_options hooks to the capability settings but I don’t think I’m doing it properly.

    add_filter( 'wcfm_capability_settings_fields_product_types', function( $product_types, $wcfm_shop_manager_capability_options = array() ) {
    global $WCFM, $WCFMu;
    
    $wcfm_shop_manager_capability_options = get_option( 'wcfm_shop_manager_capability_options', array() );
    
    $Currency = ( isset( $wcfm_shop_manager_capability_options['Currency'] ) ) ? $wcfm_shop_manager_capability_options['Currency'] : 'no';
    $Accounts = ( isset( $wcfm_shop_manager_capability_options['Accounts'] ) ) ? $wcfm_shop_manager_capability_options['Accounts'] : 'no';
    $CDKey = ( isset( $wcfm_shop_manager_capability_options['CDKey'] ) ) ? $wcfm_shop_manager_capability_options['CDKey'] : 'no';
    $Powerleveling = ( isset( $wcfm_shop_manager_capability_options['Powerleveling'] ) ) ? $wcfm_shop_manager_capability_options['Powerleveling'] : 'no';
    $Items = ( isset( $wcfm_shop_manager_capability_options['Items'] ) ) ? $wcfm_shop_manager_capability_options['Items'] : 'no';
    
    $product_types['Currency'] = array('label' => __('Currency', 'wc-frontend-manager') , 'name' => 'wcfm_shop_manager_capability_options[Currency]','type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $Currency );
    $product_types['Accounts'] = array('label' => __('Accounts', 'wc-frontend-manager') , 'name' => 'wcfm_shop_manager_capability_options[Accounts]','type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $Accounts );
    $product_types['CD Key'] = array('label' => __('CD Key', 'wc-frontend-manager') , 'name' => 'wcfm_shop_manager_capability_options[CD Key]','type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $CDKey );
    $product_types['Powerleveling'] = array('label' => __('Powerleveling', 'wc-frontend-manager') , 'name' => 'wcfm_shop_manager_capability_options[Powerleveling]','type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $Powerleveling );
    $product_types['Items'] = array('label' => __('Items', 'wc-frontend-manager') , 'name' => 'wcfm_shop_manager_capability_options[Items]','type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $Items );
    
    return $product_types;
    }, 60, 3 );
    
    function _allow_custom_product_types_manager( $product_types, $wcfm_shop_manager_capability_options = array() ) {
    global $WCFM, $WCFMu;
    
    $wcfm_shop_manager_capability_options = get_option( 'wcfm_shop_manager_capability_options', array() );
    
    $Currency = ( isset( $wcfm_shop_manager_capability_options['Currency'] ) ) ? $wcfm_shop_manager_capability_options['Currency'] : 'no';
    $Accounts = ( isset( $wcfm_shop_manager_capability_options['Accounts'] ) ) ? $wcfm_shop_manager_capability_options['Accounts'] : 'no';
    $CDKey = ( isset( $wcfm_shop_manager_capability_options['CDKey'] ) ) ? $wcfm_shop_manager_capability_options['CDKey'] : 'no';
    $Powerleveling = ( isset( $wcfm_shop_manager_capability_options['Powerleveling'] ) ) ? $wcfm_shop_manager_capability_options['Powerleveling'] : 'no';
    $Items = ( isset( $wcfm_shop_manager_capability_options['Items'] ) ) ? $wcfm_shop_manager_capability_options['Items'] : 'no';
    
    if( $Currency == 'yes' && !current_user_can( 'administrator' ) ) unset( $product_types[ 'Currency' ] );
    elseif( $Accounts == 'yes' && !current_user_can( 'administrator' ) ) unset( $product_types[ 'Accounts' ] );
    elseif( $CDKey == 'yes' && !current_user_can( 'administrator' ) )  unset( $product_types[ 'CD Key' ] );
    elseif( $Powerleveling == 'yes' && !current_user_can( 'administrator' ) ) unset( $product_types[ 'Powerleveling' ] );
    elseif($Items == 'yes' && !current_user_can('administrator') ) unset($product_types[ 'Items' ]);
    return $product_types;
    }
    add_filter( 'wcfm_product_types', '_allow_custom_product_types_manager', 700 );
    in reply to: Downloadable not saving #109045
    SSC
    Participant

    I have discovered that the problems are separate.
    The capabilities for the custom post types are not being saved as active only with Groups & Staffs add-on activated.
    The download type not saving when creating a product is always happening, even on a fresh install.

    in reply to: Downloadable not saving #109028
    SSC
    Participant

    It is a product type which I created. I have also found another problem. I think they might be related. Did a hook recently change?
    Now, I can turn off the capability for that product type, but I can not turn it back on. It was working fine earlier.

    add_action( 'init', 'register_product_Custom_Type' );
    function register_product_Custom Type() {
      class WC_Product_Custom_Type extends WC_Product {	
        public function __construct( $product ) {
            $this->product_type = 'Custom Type';
    	parent::__construct( $product );
        } } }
    add_filter( 'product_type_selector', 'add_product_Custom_Type' );
    add_filter( 'wcfm_product_types', 'add_product_Custom_Type', 50 );
    function add_mog_product_type( $types ){
        $types[ 'Custom Type' ] = __( 'Custom Type', 'custom_product' );
    
        return $types;
    }
    add_filter( 'wcfm_capability_settings_fields_product_types', function( $product_types, $wcfm_capability_options = array() ) {
    global $WCFM;
    
    $wcfm_capability_options = get_option( 'wcfm_capability_options', array() );
    $CustomType = ( isset( $wcfm_capability_options['Custom Type'] ) ) ? $wcfm_capability_options['Custom Type'] : 'no';
    $product_types['Custom Type'] = array('label' => __('Custom Type', 'wc-frontend-manager') , 'name' => 'wcfm_capability_options[Custom Type]','type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $CustomType );
    
    return $product_types;
    }, 60, 3 );
    
    function _allow_custom_product_types( $product_types, $wcfm_capability_options = array() ) {
    global $WCFM;
    $wcfm_capability_options = get_option( 'wcfm_capability_options', array() );
    $CustomType = ( isset( $wcfm_capability_options['CustomType'] ) ) ? $wcfm_capability_options['CustomType'] : 'no';
    
    if( $CustomType == 'yes' ) unset( $product_types[ 'Custom Type' ] );
    return $product_types;
    }
    add_filter( 'wcfm_product_types', '_allow_custom_product_types', 700 );
    function _products_manage_meta_save_offer_type( $new_product_id, $wcfm_products_manage_form_data ) {
    	global $WCFM;
    		if($wcfm_products_manage_form_data['product_type'] == 'Custom Type') {
    		update_post_meta( $new_product_id, 'offer_type_filter', esc_attr( $wcfm_products_manage_form_data['product_type'] ) );
    		}
    		else{}
    }
    add_action( 'after_wcfm_products_manage_meta_save', '_products_manage_meta_save_offer_type', 50, 2 );
    
    in reply to: Custom Simple Type Options #92987
    SSC
    Participant

    Certainly. Thank you

    in reply to: Custom Simple Type Options #92657
    SSC
    Participant

    Makes sense x) I really confused myself adding different types of fields. Thank you for the help

    in reply to: Custom Simple Type Options #92487
    SSC
    Participant

    It does show on the add new product page. It does show on the capability options. It does save on both the product page and capability page. But the problem is that it still shows on the add new product page when they do not have the capability to.

    //Capability
    add_filter( 'wcfm_capability_settings_fields_product_types', function( $fields, $wcfm_capability_options = array() ) {
    $wcfm_capability_options = get_option( 'wcfm_capability_options', array() );
    $is_new_val = ( isset( $wcfm_capability_options['is_new_val'] ) ) ? $wcfm_capability_options['is_new_val'] : 'no';
    $fields['is_new_val'] = array('label' => __('is_new_val', 'wc-frontend-manager') , 'name' => 'wcfm_capability_options[is_new_val]','type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $is_new_val );
    return $fields;
    }, 60, 3 );
    
    function _allow_new_general_field( $fields, $wcfm_capability_options = array() ) {
    $wcfm_capability_options = get_option( 'wcfm_capability_options', array() );
    $is_new_val = ( isset( $wcfm_capability_options['is_new_val'] ) ) ? $wcfm_capability_options['is_new_val'] : 'no';
    if( $is_new_val == 'yes' ) unset( $fields[ 'is_new_val' ] );
    
    return $fields;
    }
    add_filter( 'wcfm_product_types', '_allow_new_general_field', 700 );
    //Meta Save
    function add_new_general_field($fields, $product_id, $product_type) {
        $is_new_val = ( get_post_meta( $product_id, '_is_new_val', true) == 'yes' ) ? 'enable' : '';
        $new_field = array("is_new_val" => array('desc' => __('New Value', 'wc-frontend-manager') , 'type' => 'checkbox', 'class' => 'wcfm-checkbox wcfm_ele wcfm_half_ele_checkbox simple non-booking non-variable-subscription non-job_package non-resume_package non-redq_rental non-accommodation-booking' . ' ', 'desc_class' => 'wcfm_title wcfm_ele virtual_ele_title checkbox_title simple non-booking non-variable-subscription non-job_package non-resume_package non-redq_rental non-accommodation-booking' . ' ', 'value' => 'enable', 'dfvalue' => $is_new_val));
        $fields = array_slice($fields, 0, 1, true) + $new_field + array_slice($fields, 1, count($fields) - 1, true);
        return $fields;
    }
    
    add_filter('wcfm_product_manage_fields_general', 'add_new_general_field', 9, 3);
    
    function save_new_field_value($new_product_id, $wcfm_products_manage_form_data) {
        $is_new_val = !empty( $wcfm_products_manage_form_data['is_new_val'] ) ? 'yes' : 'no';
        update_post_meta( $new_product_id, '_is_new_val', $is_new_val );
    }
    add_action('after_wcfm_products_manage_meta_save', 'save_new_field_value', 10, 2);
    in reply to: Custom Simple Type Options #92407
    SSC
    Participant

    I managed to fix my original problem with the meta_save hook .
    The code I sent, should have it work with the capability settings. I believe.
    It’s pretty much the same method I used for product types. But it doesn’t seem to be working for the checkbox. There are no errors.

    in reply to: Custom Simple Type Options #92009
    SSC
    Participant

    Thank you so much, That code does give errors x) But it helped me figure out my problem.

    Fatal error: Uncaught ArgumentCountError: Too few arguments to function add_new_general_field(), 3 passed in /var...... on line *** and exactly 5 expected in

    Just removing ‘$wcfm_is_translated_product, $wcfm_wpml_edit_disable_elementg’ fixes that problem, not sure if it may cause issues later on x) but they seem like un-needed arguments.

    I seem to be missing something to add it to the capability controller though.
    I have added some restrictions for product types earlier, and they work fine. I used pretty much the same code with slight changes, but it’s not working for me.

    add_filter( 'wcfm_capability_settings_fields_product_types', function( $fields, $wcfm_capability_options = array() ) {
    $wcfm_capability_options = get_option( 'wcfm_capability_options', array() );
    $is_new_val = ( isset( $wcfm_capability_options['is_new_val'] ) ) ? $wcfm_capability_options['is_new_val'] : 'no';
    $fields['is_new_val'] = array('label' => __('is_new_val', 'wc-frontend-manager') , 'name' => 'wcfm_capability_options[is_new_val]','type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $is_new_val );
    return $fields;
    }, 60, 3 );
    
    function _allow_new_general_field( $fields, $wcfm_capability_options = array() ) {
    $wcfm_capability_options = get_option( 'wcfm_capability_options', array() );
    $is_new_val = ( isset( $wcfm_capability_options['is_new_val'] ) ) ? $wcfm_capability_options['is_new_val'] : 'no';
    if( $is_new_val == 'yes' ) unset( $fields[ 'is_new_val' ] );
    
    return $fields;
    }
    add_filter( 'wcfm_product_types', '_allow_new_general_field', 700 );
    in reply to: Custom Simple Type Options #91869
    SSC
    Participant

    I solved my issue, but I am still having problems getting it to save or show properly.
    When I use the ‘wcfm_product_manage_fields_general’ hook, it does not add the option to WCFM.
    When I hardcode the option into the form, the ‘after_wcfm_products_manage_meta_save’ hook does not trigger.

    in reply to: Custom Simple Type Options #91839
    SSC
    Participant

    Hmm, I seem to be doing something wrong xD
    That does seem to be what I needed. I’m having problems with my code now though =/ I just copied what I already made back, and now it’s not even working on the back-end.
    I’ll figure it out. Thank you for the info.

    in reply to: Limit Child Categories #77512
    SSC
    Participant

    Alright.
    I did manage to get something to work by making some changes to the terms array for ‘product_category_lists’.
    I do seem to be having a problem to get it to work in a child theme though. I copied the file to ‘wcfm>capability’ but it does not recognize it. I didn’t have any problems with any other files, seems to just not work for ‘wcfmu-view-capability’ file

Viewing 22 posts - 1 through 22 (of 22 total)