I don’t know much about writing code just copy and paste. I was trying to use short code on the product page where they would enter the pickup location or on the checkout page when customer inputs the delivery location. Am I on the right path or will this not work
function pickup_location_shortcode() {
function wcfmmp_vendor_manage_marketplace_setting( $vendor_id ) {
global $WCFM, $WCFMmp;
if( $vendor_id ) { ?>
<div class="wcfm-clearfix"></div>
<div class="wcfm-message" tabindex="-1"></div>
<div class="wcfm-clearfix"></div>
<div class="wcfm_messages_submit">
<input type="submit" name="save-data" value="<?php _e( 'Update', 'wc-frontend-manager' ); ?>" id="wcfm_store_general_setting_save_button" class="wcfm_submit_button" />
</div>
<div class="wcfm-clearfix"></div>
<?php } ?>
$api_key = isset( $WCFMmp->wcfmmp_marketplace_options['wcfm_google_map_api'] ) ? $WCFMmp->wcfmmp_marketplace_options['wcfm_google_map_api']:'';
$wcfm_map_lib = isset( $WCFMmp->wcfmmp_marketplace_options['wcfm_map_lib'] ) ? $WCFMmp->wcfmmp_marketplace_options['wcfm_map_lib'] : '';
if( !$wcfm_map_lib && $api_key ) { $wcfm_map_lib = 'google'; } elseif( !$wcfm_map_lib && !$api_key ) { $wcfm_map_lib = 'leaftlet'; }
if ( ( ($wcfm_map_lib == 'google') && !empty( $api_key ) ) || ($wcfm_map_lib == 'leaflet') ) {
?>
<div class="wcfm_clearfix"></div><br />
<div class="wcfm_vendor_settings_heading"><h2><?php _e( 'Pickup Location', 'wc-frontend-manager' ); ?></h2></div>
<div class="wcfm_clearfix"></div>
<div class="store_address store_location_wrap">
<?php
$WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( 'wcfm_marketplace_settings_fields_location', array(
"find_address" => array( 'label' => __( 'Find Location', 'wc-frontend-manager' ), 'placeholder' => __( 'Type an address to find (eg. 123 Street, City, Province)', 'wc-frontend-manager' ), 'type' => 'text', 'name' => 'geolocation[find_address]', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $map_address ),
"store_location" => array( 'type' => 'hidden', 'name' => 'geolocation[store_location]', 'value' => $store_location ),
"store_lat" => array( 'type' => 'hidden', 'name' => 'geolocation[store_lat]', 'value' => $store_lat ),
"store_lng" => array( 'type' => 'hidden', 'name' => 'geolocation[store_lng]', 'value' => $store_lng ),
), $vendor_id ) );
?>
<div class="wcfm_clearfix"></div><br />
<div class="wcfm-marketplace-google-map" id="wcfm-marketplace-map"></div>
<div class="wcfm_clearfix"></div><br />
</div>
<?php
}
?>
<?php do_action( 'wcfmmp_admin_wcfm_store_location_settings_after', $vendor_id ); ?>
<?php if( $vendor_id != 99999 ) { ?>
<div class="wcfm-clearfix"></div>
<div class="wcfm-message" tabindex="-1"></div>
<div class="wcfm-clearfix"></div>
<div class="wcfm_messages_submit">
<input type="submit" name="save-data" value="<?php _e( 'Update', 'wc-frontend-manager' ); ?>" id="wcfm_store_address_setting_save_button" class="wcfm_submit_button" />
</div>
<div class="wcfm-clearfix"></div>
<?php }
add_shortcode('pickup_location', 'pickup_location_shortcode');
}
-
This reply was modified 4 years ago by george1225.