<?php foreach ($products as $i => $product) { $product_class = ($i % 2 == 0 ? 'odd' : 'even') . ' product_' . $product->id; ?> <td class="<?php echo esc_attr($product_class); ?> "><?php switch ($field) { case 'image': echo '<div class="image-wrap">' . wp_get_attachment_image($product->fields[$field], 'yith-woocompare-image') . '</div>'; break; case 'add-to-cart': //$wc_get_template( 'loop/add-to-cart.php' ); mango_add_to_cart(); break; default: echo empty($product->fields[$field]) ? ' ' : $product->fields[$field]; break; } ?> </td> <?php } ?> </tr> <?php }
<?php foreach ($grouped_products as $product_id) { $product = wc_get_product($product_id); if ('yes' === get_option('woocommerce_hide_out_of_stock_items') && !$product->is_in_stock()) { continue; } $post = $product->post; setup_postdata($post); ?> <tr> <td> <?php if ($product->is_sold_individually() || !$product->is_purchasable()) { ?> <?php mango_add_to_cart($product_id); ?> <?php } else { ?> <?php $quantites_required = true; woocommerce_quantity_input(array('input_name' => 'quantity[' . $product_id . ']', 'input_value' => '0', 'min_value' => apply_filters('woocommerce_quantity_input_min', 0, $product), 'max_value' => apply_filters('woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product))); ?> <?php } ?> </td> <td class="label margin_top_20"> <label class="input-desc" for="product-<?php