add extra fields to store page

This topic contains 10 reply and 2 voices, and was last updated by towhid 9 years, 7 months ago
Viewing 10 Posts - 1 through 10 (of 10 total)
Author Posts
April 21, 2015 at 9:59 am 41881
towhid Hi there I have been searching for a while how to add in extra fields to the store page - ie I want to add in an about us section with an editor for the store owner and show it on their store page under the banner. quite easy I would have thought, but no! I have seen a couple of links on how to add in a postcode etc, but that does not seem to work as when I add in any info, save it - the page comes up with undefined. if you could just copy and paste the info I need to add to my functions file I would appreciate it!
April 21, 2015 at 1:07 pm 41903
towhid towhid

Hello Paul,

Send me the those code which you had worked. Also send me links of those site where describes how to add in a postcode etc.

Thank you 🙂

April 22, 2015 at 5:58 am 41970
Paul Paul

Hey Towhid, the link to the page is below..

http://stackoverflow.com/questions/26985251/add-custom-fields-to-existing-form-on-dokan-wordpress-woocoomerce

all I am wanting is a way of adding in an about us field to the merchants shop page.

April 22, 2015 at 1:32 pm 42009
towhid towhid

Hello Paul,

I need to discuss about this issue with our developer team. Please allow me some time.

Thank you 🙂

April 23, 2015 at 6:10 pm 42149
towhid towhid

Hello Paul,

Please try with following code and let me know the result:

function endereco( $current_user, $profile_info ) {
	$pv_local_pickup_enabled = isset( $profile_info['pv_local_pickup_enabled'] ) ? esc_attr($profile_info['pv_local_pickup_enabled']) : 'no';
	$billing_city = isset( $profile_info['billing_city'] ) ? $profile_info['billing_city'] : '';
	$billing_postcode = isset( $profile_info['billing_postcode'] ) ? $profile_info['billing_postcode'] : '';
	$billing_state = isset( $profile_info['billing_state'] ) ? $profile_info['billing_state'] : '';
	$billing_address_1 = isset( $profile_info['billing_address_1'] ) ? $profile_info['billing_address_1'] : '';
	?>       

	<div class="gregcustom dokan-form-group">
        <label class="dokan-w3 dokan-control-label" for="setting_address"><?php _e( 'Local Pickup', 'dokan' ); ?></label>
        <div class="dokan-w5">
	        <div class="checkbox">
		           <label>             
			           <input name="pv_local_pickup_enabled" type="checkbox"
			               id="pv_local_pickup_enabled" class="<?php echo 'id_' . $store_id; ?>" value="yes" <?php checked( $pv_local_pickup_enabled, 'yes' ); ?>/>
				        <?php
				        _e('Enable Local Pickup for the shop products', 'dokan');
		        ?></label>
		    </div>
	    </div>
	</div>
	<div class="gregcustom dokan-form-group">
	    <label class="dokan-w3 dokan-control-label" for="setting_address"><?php _e( 'Cidade', 'dokan' ); ?></label>
	    <div class="dokan-w5">
			<input type="text" class="dokan-form-control input-md valid" name="billing_city" id="reg_billing_city" value="<?php echo $billing_city; ?>" />
		</div>
	</div>   
                
	<div class="gregcustom dokan-form-group">
		<label class="dokan-w3 dokan-control-label" for="setting_address"><?php _e( 'Estado', 'dokan' ); ?></label>
		<div class="dokan-w5">
			<input type="text" class="dokan-form-control input-md valid" name="billing_postcode" id="reg_billing_postcode" value="<?php echo $billing_postcode; ?>" />
		</div>
	</div>
                
	<div class="gregcustom dokan-form-group"> 
		<label class="dokan-w3 dokan-control-label" for="setting_address"><?php _e( 'CEP', 'dokan' ); ?></label>
		<div class="dokan-w5">
			<input type="text" class="dokan-form-control input-md valid" name="billing_state" id="reg_billing_state" value="<?php echo $billing_postcode; ?>" />
		</div>
	</div>    
	<div class="gregcustom dokan-form-group">
		<label class="dokan-w3 dokan-control-label" for="setting_address"><?php _e( 'Endereço', 'dokan' ); ?></label>
		<div class="dokan-w5">
			<input type="text" class="dokan-form-control input-md valid" name="billing_address_1" id="reg_billing_address_1" value="<?php echo $billing_address_1; ?>" />
		</div>
	</div>
				
	<?php
}
add_filter( 'dokan_settings_after_banner', 'endereco', 10, 2);

/**
 * Save the extra fields.
 *
 * @param  int  $customer_id Current customer ID.
 *
 * @return void
 */
function save_extra_endereco_fields( $store_id, $dokan_settings ) {

	if (isset($_POST['pv_local_pickup_enabled'])) {
        $dokan_settings['pv_local_pickup_enabled'] = $_POST['pv_local_pickup_enabled'];
    }

	if ( isset( $_POST['billing_city'] ) ) {
		$dokan_settings['billing_city'] = $_POST['billing_city'];
	}

	if ( isset( $_POST['billing_postcode'] ) ) {
		$dokan_settings['billing_postcode'] = $_POST['billing_postcode'];
	}

	if ( isset( $_POST['billing_state'] ) ) {
		$dokan_settings['billing_state'] = $_POST['billing_state'];
	}

	if ( isset( $_POST['billing_address_1'] ) ) {
		$dokan_settings['billing_address_1'] = $_POST['billing_address_1'];
	}
	update_user_meta( $store_id, 'dokan_profile_settings', $dokan_settings );
}

add_action( 'dokan_store_profile_saved', 'save_extra_endereco_fields', 10, 2 );

Thank you 🙂

April 24, 2015 at 6:17 am 42173
Paul Paul

Settings → Visit Store

undefined
this is what I get when I add in the code into the funtions.php of the theme…

April 25, 2015 at 10:46 am 42206
towhid towhid

Please provide your login details by using this form: http://wedevs.com/provide-login-details/. I will have a look what is going wrong.

Thank you 🙂

April 27, 2015 at 12:00 pm 42413
towhid towhid

Hello Paul,

Please let me know are you able to add extra filed to store page using the code I had provided to you? I am here to help you.

Thank you 🙂

April 28, 2015 at 3:07 am 42488
Paul Paul

Hey mate I have sent login info to you twice now. the site is eshops.co.nz
I have tried to add in the info you have given me and get “undefined” when I fill in the information…

can you go in and try it and see what you think?

April 29, 2015 at 11:19 am 42545
towhid towhid

Hello Paul,

I am able to login your site successfully. Please allow me some time checkout the issue.

Thank you 🙂

April 30, 2015 at 12:45 pm 42747
towhid towhid

Hello Paul,

I have upload a new theme in the theme folder. Can you please active that theme. I am not able to active the theme because of permission of wp-admin.(You did not provide full permission).

Please check and let me know the result.

Thank you 🙂

Viewing 10 Posts - 1 through 10 (of 10 total)