Hello,
I've created a site to allow businesses to showcase their stores and associated coupons. In the front-end, they can select from a list of stores they've created, and can even see the address of each location in the dropdown as well. In the back-end, however, I can only view their name from the theme's custom post type meta box. This is a problem for me in case I need to update something, mainly because there might be multiple stores with the same name, and I have no to see which exact store is being referenced.
I'm using ACF Plugin for the custom fields.
Here's the code that works in the front end:
<select name="offer_store" id="offer_store" class="form-control" data-validation="conditional" data-conditional-field="offer_new_store" data-error="<?php esc_attr_e( 'Select the store this coupon is valid for', 'couponxl' ); ?>">
<option value=""><?php _e( 'Select the store this coupon is valid for...', 'couponxl' ) ?></option>
<?php
$stores = couponxl_get_custom_list( 'store', array(
'author' => $current_user->ID,
'orderby' => 'title',
'order' => 'ASC',
'posts_per_page' => '-1',
) );
if( !empty( $stores ) ){
foreach( $stores as $store_key => $store_name ){
$address = get_field( "store_address_1", $store_key );
$city = get_field( "store_city", $store_key );
$state = get_field( "store_state", $store_key );
echo '<option value="'.$store_key.'">'.$store_name.' ( '.$address.',  '.$city.', '.$state.' )'.'</option>';
}
}
?>
</select>
I'm not sure how to insert the above code into the array below; I'm trying to show the address info next to the store name:
array(
'id' => 'offer_store',
'name' => __( 'Offer Store', 'couponxl' ),
'type' => 'select',
'options' => couponxl_get_custom_list( 'store', array(), 'title' ),
'desc' => __( 'Select store of the offer.', 'couponxl' )
),
Thanks in advance.