WCMp Advanced Frontend Manager
Tagged: #custom field #vendor dashboard
-
AuthorPosts
-
-
March 14, 2022 at 3:17 PM #135346Klaus Thomas RussParticipant
Dear all,
I would like to add a custom field named ‘Einheitspreis’ at the General tab. I have attached an image showing you where the text field should appear. Is it also possible to show the filled text field on each product preview (product listing) and also on each single product page (both underneath the regular price)? Which snippet can I add to the functions.php to meet that target?
Best regards and thanks in advance!
-
March 14, 2022 at 9:28 PM #135370NerdySupportExpert MoumitaKeymaster
@Klaus Thomas Russ, thanks for getting in touch with us.
In order to add an extra field, you need to do custom code. Do you have any developers so we can assist you accordingly?
-
March 15, 2022 at 1:27 PM #135399Klaus Thomas RussParticipant
Dear Nerdy,
yes, we have a developer that can add/change some custom code. So how should we proceed?
Best regards!
-
March 15, 2022 at 7:28 PM #135430NerdySupportExpert MoumitaKeymaster
Klaus, please use this action
do_action( 'wcmp_afm_before_general_product_data', $post->ID, $product_object, $post );
CopyFor further help, please check this : https://github.com/wcmarketplace/dc-woocommerce-multi-vendor/blob/master/templates/vendor-dashboard/product-manager/views/html-product-data-general.php
-
March 16, 2022 at 9:27 PM #135515Klaus Thomas RussParticipant
Dear Nerdy,
the following code was added to html-product-data-general.php to create a custom field named ‘Einheitspreis’ (please see the attached image):
line 50 – 58:
<div class=”form-group-row”>
<div class=”form-group”>
<label class=”control-label col-sm-3 col-md-3″ for=”einheitspreis”><?php echo __( ‘Einheitspreis’, ‘dc-woocommerce-multi-vendor’ ); ?></label>
<div class=”col-md-6 col-sm-9″>
<input type=”text” id=”einheitspreis” name=”einheitspreis” class=”form-control”>
</div>
</div>
</div>Well, the custom field appears under the General Tab, but the data won’t be saved. Which code or snippet do we have to add too, so that the data will be saved and appears on the product page and also on the product overview in the listings?
Best regards,
Klaus -
March 17, 2022 at 5:54 PM #135546MVX Support NinjaKeymaster
Hi,
kindly use below code to save the data/* Save Custom Tab content data. */ function save_custom_general_data( $product, $post_data ) { if( isset($post_data['post_ID']) && isset($post_data['einheitspreis'])) { update_post_meta( absint( $post_data['post_ID'] ), 'einheitspreis', $post_data['einheitspreis']); } } add_action( 'wcmp_process_product_object', 'save_custom_general_data', 100, 2 );
Copyregards
-
March 21, 2022 at 1:01 PM #135624Klaus Thomas RussParticipant
Hi,
I added this code to the functions.php, but unfortunately the data still won’t be saved. The problem still exists…
-
March 21, 2022 at 7:49 PM #135639MVX Support NinjaKeymasterThis reply has been marked as private.
-
March 23, 2022 at 6:20 PM #135702Klaus Thomas RussParticipant
Hi, you can close the ticket. I found an other solution… But thanks for your support.
-
March 23, 2022 at 8:58 PM #135721MVX Support NinjaKeymaster
Thanks for the update.
-
-
AuthorPosts
The topic ‘Add Field at ‘General Tab’ (vendor dashboard)’ is closed to new replies.