mage-eventpress/templates/template-prts/event_extra_service.php

67 lines
1.9 KiB
PHP
Raw Normal View History

2018-07-02 05:44:24 -04:00
<?php
add_action('mep_event_extra_service','mep_ev_extra_serv');
function mep_ev_extra_serv(){
global $post, $product;
$pid = $post->ID;
$count=1;
$mep_events_extra_prices = get_post_meta($post->ID, 'mep_events_extra_prices', true);
if ( $mep_events_extra_prices ){
_e("<h3 class='ex-sec-title'>".mep_get_label($pid,'mep_event_extra_service_text','Extra Service:')."</h3>");
2018-07-02 05:44:24 -04:00
?>
<table>
<tr>
<td align="left"><?php _e('Name'); ?></td>
<td><?php _e('Quantity'); ?></td>
<td><?php _e('Price'); ?></td>
</tr>
<?php
foreach ($mep_events_extra_prices as $field) {
$total_ext = $field['option_qty'];
$opt_name = $pid.str_replace(' ', '', $field['option_name']);
$tes = get_post_meta($pid,"mep_xtra_$opt_name",true);
$ext_left = ($total_ext-$tes);
$qty_type = $field['option_qty_type'];
?>
<tr>
<td align="Left"><?php echo $field['option_name']; ?>
<div class="xtra-item-left">-<?php echo $ext_left; ?> Left</div>
</td>
<td>
<?php if($qty_type=='dropdown'){ ?>
<select name="option_qty[]" id="eventpxtp_<?php //echo $count; ?>" class='extra-qty-box'>
<?php for ($i = 0; $i <= $ext_left; $i++) { ?>
<option value="<?php echo $i; ?>"><?php echo $i; ?> <?php echo $field['option_name']; ?></option>
<?php } ?>
2018-07-02 05:44:24 -04:00
</select>
<?php }else{ ?>
2018-07-02 05:44:24 -04:00
<input id="eventpx" <?php //if($ext_left<=0){ echo "disabled"; } ?> size="4" pattern="[0-9]*" inputmode="numeric" type="number" class='extra-qty-box' name='option_qty[]' data-price='<?php echo $field['option_price']; ?>' value='0' min="0" max="<?php echo $ext_left; ?>">
<?php } ?>
2018-07-02 05:44:24 -04:00
</td>
<td><?php echo get_woocommerce_currency_symbol().$field['option_price']; ?>
<p style="display: none;" class="price_jq"><?php echo $field['option_price']; ?></p>
<input type="hidden" name='option_name[]' value='<?php echo $field['option_name']; ?>'>
<input type="hidden" name='option_price[]' value='<?php echo $field['option_price']; ?>'>
</td>
</tr>
<?php
$count++;
}
?>
</table>
<?php
}
}