php – Cant save new custom field relation on db

Question

I use dokan multivendor for my website. And also i have added new custom field “Regions” on my product taxonomy, also i fetch on vendor dashboard add new product modal. So far so good, but now i need to save selected option when i create new product from vendor dashboard. I dows not know how to save this, can you help me?

file path -> dokan-lite/templates/products/tmpl-add-product-popup.php

and code i have added here

<div class="product-full-container">

        <!-- this was here and is used for select category i thing -->
        <?php
            $data = Helper::get_saved_products_category();
            $data['from'] = 'new_product_popup';
            dokan_get_template_part( 'products/dokan-category-header-ui', '', $data );
        ?>

        
        
        <!-- this is what i haev added here -->
        <div class="dokan-form-group">
        
            <?php
                $regions = get_terms([
                    'hierarchical' => 1,
                    'show_option_none' => '',
                    'hide_empty' => 0,
                    'taxonomy' => 'region'
                ]);    
            ?>

                <!-- <?php    foreach ($regions as $region) { ?> -->
                <!-- <pre> <?php print_r($regions) ?> </pre> -->
            <!-- <?php    } ?> -->

            <label for="regions"><?php esc_html_e( 'Region', 'your-text-domain' ); ?></label></br>
            <select name="regions" class="dokan-form-control">
                <option value=""><?php esc_html_e( 'Select Region', 'your-text-domain' ); ?></option>
                <optgroup label="Piemonte">
                    <?php foreach ( $regions as $region ) { ?>
                        <option value="<?php echo $region->term_taxonomy_id ?>" id="in-region-<?php echo $region->term_taxonomy_id ?>"> <?php echo $region->name ?> </option>
                    <?php } ?>
                </optgroup>
            </select>

        </div>  


        <?php do_action( 'dokan_new_product_after_product_tags' ); ?>

        <div class="dokan-form-group">
            <textarea name="post_excerpt" id="" class="dokan-form-control" rows="5" placeholder="<?php esc_attr_e( 'Enter some short description about this product...' , 'dokan-lite' ) ?>"></textarea>
        </div>
    </d>

</div>

0
tilamap365 4 weeks 2023-05-08T04:33:57-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse