Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WC Marketplace › Add custom fields to the vendor's settings form
- This topic has 6 replies, 3 voices, and was last updated 5 years, 12 months ago by WCFM Forum.
- AuthorPosts
- November 13, 2018 at 6:05 pm #36630RamiParticipant
Hi, I use WCFM Ultimate and WcMarketplace in my website, my vendors are teachers, and I need them to add topics they teach in their shop page under the description.
I have ACF Pro, but I think it works only in the add product page in WCFM not in the pages, so I need your advice on this..
In short:
I need the vendor to add the topics he teach as custom fields in his wcfm settings page (preferably repeater field but if can’t a text area will do the job) , and these fields have to be displayed in his shop page under the description.
for displaying the fields in the shop page, I think I can do that by editing wc-marketplace file “archive_vendor_info.php”, but still the first part that I can’t figure out.Thanks in advance.
- November 14, 2018 at 10:09 pm #36704RamiParticipant
Hi again,
I succeeded in adding the desired field in the vendor’s setting page using the following code:add_filter ( ‘wcfm_wcmarketplace_settings_fields_general’ , ‘add_teacher_topics’ ,20 );
function add_teacher_topics($settings_fields_general){
$settings_fields_general[‘teacher_topics’]= array(
‘title’ => __( ‘Topics I Teach’, ‘wc-frontend-manager’ ),
‘type’ => ‘text’,
‘priority’ => 50,
‘class’ => ‘wcfm-text wcfm_ele’,
‘label_class’ => ‘wcfm_title wcfm_ele’,
);
return $settings_fields_general;
}but I have the following issues:
1) When adding any data to the field and saving, it is not saved, i.e:the field remains blank after saving.
2) how can the field content be displayed in the store (shop) page of the vendor as does the description field for example.
3) I keep having an issue in saving or submitting anything in WCFM dashboard in general, which is the curser keeps spinning for infinity after clicking “save” button. The settings or fields are being saved but the only way to get rid of the spinning wheel is to refresh the page or go to another page. I have no errors in chrome console before saving, but after saving and appearance of the issue I have an error related to the wp admin ajax.I hope to have some help here.
Thanks…. - November 17, 2018 at 4:31 am #36880WCFM ForumMember
HI,
That’s Great 🙂
1. Use this hook to save those data -> do_action( ‘wcfm_vendor_settings_update’, $user_id, $wcfm_settings_form );
2. Use this short code in store side bar to make those visible – [wcfm_store_info data=”teacher_topics”]
3. Some error is generating, kindly open Google Chrome browser console and take a look. Also check at wp-admin -> WooCommerce -> Status -> Logs
Thank you
- November 17, 2018 at 7:46 am #36909RamiGuest
Hi, Thank you for your help but I think the code doesn’t work or I am missing something here, here is the code after adding the new hook you suggested:
add_filter ( ‘wcfm_wcmarketplace_settings_fields_general’ , ‘add_teacher_topics’ ,20 );
function add_teacher_topics($settings_fields_general){
$settings_fields_general[‘teacher_topics’]= array(
‘label’ => __( ‘Topics I Teach’, ‘wc-frontend-manager’ ),
‘type’ => ‘text’,
‘priority’ => 50,
‘class’ => ‘wcfm-text wcfm_ele’,
‘label_class’ => ‘wcfm_title wcfm_ele’,
);
return $settings_fields_general;
}do_action( ‘wcfm_vendor_settings_update’, $user_id, $wcfm_settings_form );
1) I still have the same situation, where the field content not being saved after saving, and I have the following errors:
Undefined variable: user_id
Undefined variable: wcfm_settings_form2) I tried to put the shortcode in a text widget in the sidebar, but it doesn’t work, it only displays the shortcode itself instead of the contents.
3) for the spinning wheel issue, I have the following error in chrome console:
Failed to load resource: the server responded with a status of 502 () /wp-admin/admin-ajax.php:1*** Thank you very much.
- November 17, 2018 at 3:06 pm #36948WCFM ForumMember
Hi,
1) I still have the same situation, where the field content not being saved after saving, and I have the following errors:
Undefined variable: user_id
Undefined variable: wcfm_settings_form** Please show me what code you have written for save.
do_action( ‘wcfm_vendor_settings_update’, $user_id, $wcfm_settings_form ); – this is the hook for which you have to write code for save.2) I tried to put the shortcode in a text widget in the sidebar, but it doesn’t work, it only displays the shortcode itself instead of the contents.
** Please show me screenshot what you have added in widget!
3) for the spinning wheel issue, I have the following error in chrome console:
Failed to load resource: the server responded with a status of 502 () /wp-admin/admin-ajax.php:1** Opps!! “/wp-admin/admin-ajax.php” – this WP core file, why it can’t be loaded? I think there has some file permission issue!
Thank You
- November 18, 2018 at 9:04 pm #37041RamiParticipant
Hi,
1) saving field issue has been fixed when I fixed the Ajax issue which is related to another plugin called “Query Monitor”. and I am sorry, but I only added the hook to the functions.php file. Is there any additional code to add to save the field content? If yes, can you help with it please?2) I will attach a screen shot for the shortcode widget settings, but I wonder, does it work with wc-marketplace, which I use?
3) solved by deactivating the “Query Monitor” plugin as mentioned in “1” above.
Thanks.
Attachments:
You must be logged in to view attached files. - November 19, 2018 at 4:20 pm #37080WCFM ForumMember
Hi,
2) I will attach a screen shot for the shortcode widget settings, but I wonder, does it work with wc-marketplace, which I use?
– Opps! I thought you are using WCFM Marketplace. Please contact WC Marketplace forum regarding this.
Thank You
- AuthorPosts
- The topic ‘Add custom fields to the vendor's settings form’ is closed to new replies.