<?php
/**
 * This template can be overridden by copying it to yourtheme/woocommerce/shortcodes/mysterx.php.
 *
 * @see https://docs.woocommerce.com/document/template-structure/
 * @package Mysterx
 * @since 1.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 *
 * My boxes shortcode template
*/
if ( $boxes ) { ?>

	<ul class="products columns-<?php echo esc_attr( wc_get_loop_prop( 'columns' ) ); ?>">

	<?php
	foreach ( $boxes as $key => $value ) {

		global $product;

		$product = wc_get_product( $value['product_id'] );
		wc_get_template( 'mysterx/loopmysterxopening.php' );
	}
	?>
	</ul>

	<div id="all-rewards-modal" class="box-modal hidden">
		<div class="box-modal-inner">
			<span class="close-modal">&times;</span>
			<div class="reward-grid"></div>
		</div>
	</div>
	<?php

		$args = array(
			'total'   => intval( $max_num_pages ),
			'current' => $current_page,
		);

		wc_get_template( 'loop/pagination.php', $args );


} else {
	?>

	<div class="woocommerce-message woocommerce-message--info woocommerce-Message woocommerce-Message--info woocommerce-info">
		<?php esc_html_e( 'No boxes found.', 'mysterx-mystery-boxes-for-woocommerce' ); ?>
	</div>

	<?php
}
