Ejemplo n.º 1
0
        ?>
</h3>
								<p class="[ no-margin ]"><?php 
        echo format_contenido_platillo($guarnicion_1, $guarnicion_2);
        ?>
</p>
							</div>
							<?php 
        if (is_user_logged_in()) {
            ?>
								<div class="[ col-xs-12 col-sm-4 ]">
									<div class="[ pull-right ][ width-xs-100 ]">
										<?php 
            if (!$product->is_in_stock()) {
                echo '<a rel="nofollow" class="[ btn btn-sm btn-default btn-hollow ]">agotado</a>';
            } elseif (!is_lunch() && can_order_breakfast()) {
                echo '<a href="' . get_permalink() . '" rel="nofollow" class="[ btn btn-sm btn-primary btn-xs-block ][ js-view-details ]"  data-id="' . $post->ID . '" data-name="' . get_the_title() . '" data-price="' . $product->price . '">ver detalles</a>';
            } else {
                echo woocommerce_template_loop_add_to_cart();
            }
            ?>
									</div>
								</div>
							<?php 
        }
        ?>
						</div>
					</article>
					<?php 
        if ($query_count % 2 == 0) {
            echo '<div class="[ clearfix ]"></div>';
Ejemplo n.º 2
0
	<?php 
if (can_order_breakfast() || can_order_tomorrows_breakfast()) {
    get_template_part('templates/menu', 'desayuno');
}
?>
	<?php 
if (can_order_lunch()) {
    get_template_part('templates/menu', 'comida');
}
?>
	<?php 
// if( can_order_dinner() ) get_template_part( 'templates/menu', 'cena' );
?>

	<?php 
if (!can_order_breakfast() and !can_order_lunch() and !can_order_tomorrows_breakfast()) {
    get_template_part('templates/menu', 'empty');
}
?>

	<?php 
//if ( is_user_logged_in() ) get_template_part( 'templates/store_credits' );
?>

	<section class="[ detalles ][ margin-bottom--large ]">
		<div class="[ container ][ text-center color-secondary ]">
			<div class="[ block ][ col-xs-12 col-sm-10 col-md-8 col-lg-6 col-centered ][ text-center ]">
				<h2 class="">Detalles</h2>
				<div class="[ row ]">
					<div class="[ col-xs-12 col-sm-6 ][ margin-bottom ]">
						<img class="[ svg ][ icon icon--feature icon--stroke ][ margin-bottom--small ]" src="<?php 
Ejemplo n.º 3
0
/**
 * Regresa las ventanas de tiempo disponibles para el platillo del día / semana
 * @return array $timeframe_options
 */
function get_valid_timeframe($type = "json")
{
    if (is_breakfast() && can_order_breakfast()) {
        return get_valid_breakfast_timeframe($type);
    }
    if (!can_order_breakfast() && can_order_lunch()) {
        return get_valid_lunch_timeframe($type);
    }
    if (can_order_tomorrows_breakfast()) {
        return get_valid_breakfast_timeframe($type);
    }
    //if( is_dinner() ) return get_valid_dinner_timeframe( $type );
    return 0;
}
Ejemplo n.º 4
0
 public function today_menu()
 {
     $data = array('can_order_today' => can_order_today(), 'menu' => array(), 'aguas' => array(), 'postres' => array(), 'sides' => array());
     error_log(can_order_today());
     $dia = date('Y-m-d');
     if (!can_order_today()) {
         DABBA_API_Output::get()->output(true, 200, '', $data);
     }
     $product_args = array('post_type' => 'product', 'posts_per_page' => -1, 'meta_query' => array(array('key' => '_fecha_menu_meta', 'value' => $dia)));
     if (can_order_breakfast() && has_breakfast()) {
         $product_args['tax_query'] = array(array('taxonomy' => 'comida-del-dia', 'field' => 'slug', 'terms' => 'desayuno'));
     } else {
         if (can_order_lunch() && has_lunch()) {
             $product_args['tax_query'] = array(array('taxonomy' => 'comida-del-dia', 'field' => 'slug', 'terms' => 'comida'));
         } else {
             if (can_order_dinner() && has_dinner()) {
                 $product_args['tax_query'] = array(array('taxonomy' => 'comida-del-dia', 'field' => 'slug', 'terms' => 'cena'));
             }
         }
     }
     $query = new WP_Query($product_args);
     while ($query->have_posts()) {
         if ($query->have_posts()) {
             $query->the_post();
             global $product;
             global $post;
             $image_ids = $product->get_gallery_attachment_ids();
             $image = wp_get_attachment_url($image_ids[0]);
             $horizontal_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
             if (!$image) {
                 $image = $horizontal_image;
             }
             $carTemp = get_the_terms($post->ID, 'caracteristica-platillo');
             $caracteristicas_platillo = array();
             if (!empty($carTemp)) {
                 foreach ($carTemp as $caracteristica) {
                     $caracteristicas_platillo[] = array('icon' => THEMEPATH . "icons/" . $caracteristica->slug . ".svg", 'name' => $caracteristica->name);
                 }
             }
             $ingredientes = get_ingredientes($post->ID);
             $guarnicion_1 = get_post_meta($post->ID, '_guarnicion_1_meta', true);
             $guarnicion_2 = get_post_meta($post->ID, '_guarnicion_2_meta', true);
             $porcion = get_post_meta($post->ID, '_porcion_meta', true);
             $proteina = get_post_meta($post->ID, '_proteina_meta', true);
             $calorias = get_post_meta($post->ID, '_calorias_meta', true);
             $fibra_dietetica = get_post_meta($post->ID, '_fibra_dietetica_meta', true);
             $menu = array('id' => get_the_ID(), 'title' => html_entity_decode(get_the_title()), 'descripcion' => format_contenido_platillo($guarnicion_1, $guarnicion_2), 'content' => get_the_content(), 'image' => $image, 'horizontal_image' => $horizontal_image[0], 'guarnicion_1' => $guarnicion_1, 'guarnicion_2' => $guarnicion_2, 'caracteristicas_platillo' => $caracteristicas_platillo, 'ingredientes' => $ingredientes, 'porcion' => $porcion, 'proteina' => $proteina, 'calorias' => $calorias, 'fibra_dietetica' => $fibra_dietetica, 'price' => $product->get_price(), 'stock' => $product->get_stock_quantity(), 'is_in_stock' => $product->is_in_stock(), 'menu_date' => $dia);
             $data['menu'][] = $menu;
         }
     }
     $data['aguas'] = $this->get_additional_items('agua', 4);
     $data['postres'] = $this->get_additional_items('postre', 4);
     $data['sides'] = $this->get_additional_items('complemento', 4);
     DABBA_API_Output::get()->output(true, 200, '', $data);
 }
Ejemplo n.º 5
0
        ?>
</h3>
								<p class="[ no-margin ]"><?php 
        echo format_contenido_platillo($guarnicion_1, $guarnicion_2);
        ?>
</p>
							</div>
							<?php 
        if (is_user_logged_in()) {
            ?>
								<div class="[ col-xs-12 col-sm-4 ]">
									<div class="[ pull-right ][ width-xs-100 ]">
										<?php 
            if (!$product->is_in_stock()) {
                echo '<a rel="nofollow" class="[ btn btn-sm btn-default btn-hollow ]">agotado</a>';
            } elseif (!is_breakfast() && !can_order_breakfast() && !can_order_tomorrows_breakfast()) {
                echo '<a href="' . get_permalink() . '" rel="nofollow" class="[ btn btn-sm btn-primary btn-xs-block ][ js-view-details ]"  data-id="<?php echo $post->ID; ?>" data-name="<?php echo get_the_title(); ?>" data-price="<?php echo $product->price; ?>">ver detalles</a>';
            } else {
                echo woocommerce_template_loop_add_to_cart();
            }
            ?>
									</div>
								</div>
							<?php 
        }
        ?>
						</div>
					</article>
					<?php 
        if ($query_count % 2 == 0) {
            echo '<div class="[ clearfix ]"></div>';