/**
 * Returns whole product gallery for product page
 *
 * @param int $product_id
 * @param array $v_single_options
 * @return string
 */
function get_product_gallery($product_id, $v_single_options = null)
{
    $single_options = isset($v_single_options) ? $v_single_options : get_product_page_settings();
    if ($single_options['enable_product_gallery'] == 1) {
        $product_gallery = '';
        ob_start();
        do_action('before_product_image', $product_id);
        $product_gallery .= ob_get_clean();
        $product_gallery .= '<div class="entry-thumbnail product-image">';
        ob_start();
        do_action('above_product_image', $product_id);
        $product_gallery .= ob_get_clean();
        $image_size = apply_filters('product_image_size', 'medium');
        if (has_post_thumbnail($product_id)) {
            if (is_lightbox_enabled()) {
                $img_url = wp_get_attachment_image_src(get_post_thumbnail_id($product_id), 'large');
                $product_gallery .= '<a class="a-product-image" href="' . $img_url[0] . '">' . get_the_post_thumbnail($product_id, $image_size) . '</a>';
            } else {
                $product_gallery .= get_the_post_thumbnail($product_id, $image_size);
            }
        } else {
            if ($single_options['enable_product_gallery_only_when_exist'] != 1) {
                $product_gallery .= default_product_thumbnail();
            }
        }
        ob_start();
        do_action('below_product_image', $product_id);
        $product_gallery .= ob_get_clean();
        $product_gallery .= '</div>';
        ob_start();
        do_action('after_product_image', $product_id);
        $product_gallery .= ob_get_clean();
        return $product_gallery;
    } else {
        return;
    }
}
/**
 * Handles wizard avanced mode settings save
 */
function save_wizard_advanced_mode_settings()
{
    if (current_user_can('manage_product_settings')) {
        $archive_multiple_settings = get_multiple_settings();
        $product_currency_settings = get_currency_settings();
        $product_page_settings = get_product_page_settings();
        $archive_multiple_settings['container_width'] = intval($_POST['container_width']);
        $archive_multiple_settings['container_bg'] = isset($_POST['container_bg']) ? strval($_POST['container_bg']) : '';
        $archive_multiple_settings['container_padding'] = intval($_POST['container_padding']);
        $archive_multiple_settings['disable_name'] = intval($_POST['disable_name']);
        $archive_multiple_settings['default_sidebar'] = strval($_POST['default_sidebar']);
        $breadcrumbs = intval($_POST['disable_breadcrumbs']);
        if ($breadcrumbs == 1) {
            $archive_multiple_settings['enable_product_breadcrumbs'] = 0;
        } else {
            $archive_multiple_settings['enable_product_breadcrumbs'] = 1;
        }
        update_option('archive_multiple_settings', $archive_multiple_settings);
        $price = intval($_POST['disable_price']);
        if ($price == 1) {
            $product_currency_settings['price_enable'] = 'off';
            update_option('product_currency_settings', $product_currency_settings);
        } else {
            $product_currency_settings['price_enable'] = 'on';
            update_option('product_currency_settings', $product_currency_settings);
        }
        $image = intval($_POST['disable_image']);
        if ($image == 1) {
            $product_page_settings['enable_product_gallery'] = 0;
            update_option('multi_single_options', $product_page_settings);
        } else {
            $product_page_settings['enable_product_gallery'] = 1;
            update_option('multi_single_options', $product_page_settings);
        }
        $shipping = intval($_POST['disable_shipping']);
        if ($shipping == 1) {
            update_option('product_shipping_options_number', 0);
        } else {
            if (!is_ic_shipping_enabled()) {
                update_option('product_shipping_options_number', 2);
            }
        }
        $attributes = intval($_POST['disable_attributes']);
        if ($attributes == 1) {
            update_option('product_attributes_number', 0);
        } else {
            if (!is_ic_attributes_enabled()) {
                update_option('product_attributes_number', 3);
            }
        }
    }
    echo 'done';
    wp_die();
    // this is required to terminate immediately and return a proper response
}
}
/**
 * The template for displaying products content.
 *
 *
 *
 * @version		1.1.2
 * @package		ecommerce-product-catalog/templates
 * @author 		Norbert Dreszer
 */
global $post;
$product_id = $post->ID;
$current_post_type = get_post_type();
$taxonomies = product_taxonomy_array();
$single_names = get_single_names();
$single_options = get_product_page_settings();
do_action('single_product_begin', $product_id);
?>

<article id="product-<?php 
the_ID();
?>
" <?php 
post_class('al_product responsive type-page product-' . $product_id);
?>
>
	<?php 
do_action('before_product_entry', $post, $single_names);
?>
	<div class="entry-content product-entry"><?php 
//do_action( 'start_product_entry', $post, $single_names );