Yeso Akshith
Forum Replies Created
-
Hi
I never told I am using $_POST variable(Please read the reply carefully before replying). I told that the variable $wcfm_products_manage_form_data will not contain all the values of $_POST and hence I won’t be able to get the value of the input value.
I am trying to be as clear as possible.
Please drop in a simple custom field working example so that any future developer searching for it will not be deserted.
Thank you
Regards
Yeso AkshithHi
I have already checked the file “\wp-content\plugins\wc-frontend-manager\controllers\products-manager\wcfm-controller-customfield-products-manage.php” with no luck.
I am adding html in view and I don’t think the variable $wcfm_products_manage_form_data will contain all $_POST values and hence I am not able to retrieve my input type checkbox value.
I think if you can drop in an example of adding a product custom, that would make things easier.
Thank you
Regards
Yeso AkshithHi
I have checked both the files already and I am not able to figure out the code.
I am trying to add a check box in products-manage page and I was able to add the html using “after_wcfm_products_manage_pricing_fields” action.
But I am not able to get the values and save it to product meta.
I need an action where I can get the post variable as I am not able to get the value with $_POST variable on the same page.
I hope I am clear.
Thank you
Regards
Yeso AkshithHi
I asked you that I want to code, like do you have any filter to add product custom fields or any action?
I clearly mentioned I want to code it myself rather than using any plugin. Please go through the question and answer.
I hope at least this time I’ll get a correct answer to my question.
Thank you
Regards
Yeso AkshithHi
And also I would like to know what is the price to get WCFM orders edit front end for lifetime.
Not the total WCFM ultimate. Just the orders edit part.
Thank you
Regards
Yeso Akshith
WebyTechsHi
This is a hack.
What do you mean by hack???
We can extend and use any wordpress plugin right?
I don’t get the point???
Please elaborate.
Thank you
Regards
YesoAkshith
WebyTechsHi
Sorry for late reply. The code doesn’t seem to be working. You can see that the same kind of topics have been created and been left without the topic creator saying it is resolved.
I have tried in localhost and in different installs and it didn’t work.
I guess ajax is limiting for the custom check boxes to be saved.
Anyways I have made my work around using actions instead of filters.
Thank you
Regards
Yeso Akshith
Designated Partner
WebyTechsHi
We have tried the following code in billing rather than general and yet the same result
add_filter ( 'wcfm_marketplace_settings_fields_billing' , 'add_vendor_vpa' ,20 , 2 ); function add_vendor_vpa($settings_fields_general, $vendor_id){ $vendor_vpa = get_user_meta( $vendor_id, 'vendor_store_vpa', true ); $settings_fields_general['vendor_vpa']= array( 'label' => __( 'Virtal Payment address(VPA)/UPI ID', 'wc-frontend-manager' ), 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $vendor_vpa ); if(current_user_can("manage_options")){ $vendor_is_fog_upi = get_user_meta( $vendor_id, 'vendor_is_fog_upi', true ); $settings_fields_general['is_fog_upi']= array( 'label' => __( 'Is FOG UPI ' . $vendor_is_fog_upi, 'wc-frontend-manager' ), 'type' => 'checkbox', 'class' => 'wcfm-checkbox wcfm_ele', 'label_class' => 'wcfm_title checkbox_title wcfm_ele', 'value' => 'yes', 'dfvalue' => $vendor_is_fog_upi ); } return $settings_fields_general; } add_action('wcfm_vendor_settings_update', 'update_vendor_vpa', 30, 2); //add_action("wcfm_vendor_settings_update", "update_vendor_vpa", 10, 2); function update_vendor_vpa($user_id, $wcfm_settings_form){ global $WCFM, $WCFMmp; if( isset( $wcfm_settings_form["vendor_vpa"] ) ) { update_user_meta( $user_id, 'vendor_store_vpa', $wcfm_settings_form["vendor_vpa"] ); } else { update_user_meta( $user_id, 'vendor_store_vpa', "" ); } if(current_user_can("manage_options")){ if( isset( $wcfm_settings_form["is_fog_upi"] ) && !empty($wcfm_settings_form['is_fog_upi']) ) { update_user_meta( $user_id, 'vendor_is_fog_upi', $wcfm_settings_form["is_fog_upi"] ); } else { update_user_meta( $user_id, 'vendor_is_fog_upi', $wcfm_settings_form["is_fog_upi"] ); } } }
I am still unaware of what I am doing wrong here. Everytime it is “YES” in the database.
And I have used $wcfm_settings_form[“is_fog_upi”] to debug and it is always yes.
I have deleted the row in usermeta table and yet again it goes to yes when form is submitted.
I hope I am sounding clear.
Thank you
Regards
Yeso Akshith
Designated Partner
WebyTechsHi
I have tried the total code and it is the same as mine but yet I have copied it all and tried. The meta value of “wcfm_vendor_vpa_key” is always “yes” in database. Don’t know why.
I tried googling this issue and google always leads me to the following page with the exact same issue.
https://wclovers.com/forums/topic/bug-custom-field-for-vendor-settings-uncheck-a-checkbox/
Please tell me the option to hard code it, as I am not able to figure our what action to go with.
Thank you
Regards
Yeso Akshith
WebyTechsHi
I have changed the meta key and also no luck. I have cross checked if it is changed in the database to NO anytime, but it is always YES in the database.
Please try it and get back.
WFCM Version: 6.4.8
Wordpress 5.4.1
Active theme twenty twenty
Active Plugins WCFM – WooCommerce Frontend Manager, WCFM – WooCommerce Multivendor Marketplace, WooCommerce
Is there any possibility to go with my own html and php instead of this array kind of things?
Thank you
Regards
Yeso Akshtih
WebyTechsHi
I have made changes in code as follows
if( isset( $settings_fields_general[‘store_name’] ) ) { $vendor_data = get_user_meta( $vendor_id, ‘vendor_store_vpa’, true ); $settings_fields_general[‘vendor_vpa’]= array( ‘label’ => __( ‘Virtal Payment address(VPA)/UPI ID’, ‘wc-frontend-manager’ ), ‘type’ => ‘checkbox’, ‘priority’ => 50, 'class' => 'wcfm-checkbox wcfm_ele', 'label_class' => 'wcfm_title checkbox_title wcfm_ele', 'value' => 'yes', 'dfvalue' => $vendor_data ); } return $settings_fields_general; }
Even though there is no change in the result.
Hi I am trying to create a checkbox instead of textbox by using the code as below
add_filter ( ‘wcfm_marketplace_settings_fields_general’ , ‘add_vendor_vpa’ ,20, 2 ); function add_vendor_vpa($settings_fields_general, $vendor_id ){ if( isset( $settings_fields_general[‘store_name’] ) ) { $vendor_data = get_user_meta( $vendor_id, ‘vendor_store_vpa’, true ); $settings_fields_general[‘vendor_vpa’]= array( ‘label’ => __( ‘Virtal Payment address(VPA)/UPI ID’, ‘wc-frontend-manager’ ), ‘type’ => ‘checkbox’, ‘priority’ => 50, ‘class’ => ‘wcfm-text wcfm_ele’, ‘label_class’ => ‘wcfm_title wcfm_ele’, ‘value’ => $vendor_data ); } return $settings_fields_general; }
add_action("wcfm_vendor_settings_update", "update_vendor_vpa", 10, 2); function update_vendor_vpa($user_id, $wcfm_settings_form){ global $WCFM, $WCFMmp; if(isset( $wcfm_settings_form["vendor_vpa"] ) && !empty($wcfm_settings_form['vendor_vpa']) ){ update_user_meta( $user_id, 'wcfm_vendor_vpa_key', "yes" ); }else{ update_user_meta( $user_id, 'wcfm_vendor_vpa_key', "no" ); } }
When executing and selecting the checkbox it goes to YES and later on when deselected it never goes to NO
I hope I am clear.
Thank you
Regards
Yeso Akshith
Designated Partner
WebyTechsHi
I am not able to do the same with the checkbox.
Any code references?
Thank you
Regards
Yeso Akshith
Designated Partner
WebyTechsHi
I do not think, going with “on-hold” will be possible with your plugin flow as it won’t allow you to go to checkout URL if the product is on-hold.
Any alternative thoughts?
Thank you
Regards
Yeso Akshith
Designated Partner
WebyTechsHi
If we change the status to on hold I am getting this error when I press pay with UPI
This order’s status is “On hold”—it cannot be paid for. Please contact us if you need assistance.
Please check and revert back.
Thank you
Regards
Yeso Akshith
Designated Partner
WebyTechs