public function wcva_override_default_variable_template($template, $template_name, $template_path)
 {
     global $woocommerce, $post, $product;
     $displaytypenumber = 0;
     if (is_product()) {
         $displaytypenumber = wcva_return_displaytype_number($product, $post);
     }
     $goahead = 1;
     if (isset($_SERVER['HTTP_USER_AGENT'])) {
         $agent = $_SERVER['HTTP_USER_AGENT'];
     }
     if (preg_match('/(?i)msie [5-8]/', $agent)) {
         $goahead = 0;
     }
     if ($goahead == 1 && strstr($template, 'variable.php') && $displaytypenumber > 0) {
         $template = wcva_plugin_path() . '/woocommerce/single-product/add-to-cart/variable.php';
     }
     return $template;
 }
Exemple #2
0
$porto_woo_version = porto_get_woo_version_number();
if (function_exists('wcva_get_woo_version_number')) {
    $displaytypenumber = 0;
    if ($product && $post) {
        //if (is_product()) {
        $displaytypenumber = wcva_return_displaytype_number($product, $post);
    }
    $goahead = 1;
    if (isset($_SERVER['HTTP_USER_AGENT'])) {
        $agent = $_SERVER['HTTP_USER_AGENT'];
    }
    if (preg_match('/(?i)msie [5-8]/', $agent)) {
        $goahead = 0;
    }
    if ($goahead == 1 && $displaytypenumber > 0) {
        $template = wcva_plugin_path() . '/woocommerce/single-product/add-to-cart/variable.php';
        require $template;
    }
} else {
    ?>

<?php 
    do_action('woocommerce_before_add_to_cart_form');
    ?>

<form class="variations_form cart" method="post" enctype='multipart/form-data' data-product_id="<?php 
    echo $post->ID;
    ?>
" data-product_variations="<?php 
    echo esc_attr(json_encode($available_variations));
    ?>
Exemple #3
0
function porto_product_quickview()
{
    global $post, $product;
    $post = get_post($_GET['pid']);
    $product = wc_get_product($post->ID);
    if (post_password_required()) {
        echo get_the_password_form();
        die;
        return;
    }
    $displaytypenumber = 0;
    if (function_exists('wcva_get_woo_version_number')) {
        require_once wcva_plugin_path() . '/includes/wcva_common_functions.php';
    }
    if (function_exists('wcva_return_displaytype_number')) {
        $displaytypenumber = wcva_return_displaytype_number($product, $post);
    }
    $goahead = 1;
    if (isset($_SERVER['HTTP_USER_AGENT'])) {
        $agent = $_SERVER['HTTP_USER_AGENT'];
    }
    if (preg_match('/(?i)msie [5-8]/', $agent)) {
        $goahead = 0;
    }
    ?>

    <div class="quickview-wrap quickview-wrap-<?php 
    echo $post->ID;
    ?>
 single-product">
        <div class="product product-summary-wrap">

            <div class="row">
                <div class="col-lg-6 col-md-6 col-sm-12 summary-before">
                    <?php 
    do_action('woocommerce_before_single_product_summary');
    ?>
                </div>

                <div class="col-lg-6 col-md-6 col-sm-12 summary entry-summary">
                    <?php 
    do_action('woocommerce_single_product_summary');
    ?>
                    <script type="text/javascript">
                        /* <![CDATA[ */
                        <?php 
    $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    $assets_path = esc_url(str_replace(array('http:', 'https:'), '', WC()->plugin_url())) . '/assets/';
    $frontend_script_path = $assets_path . 'js/frontend/';
    ?>
                        var wc_add_to_cart_params = <?php 
    echo array2json(apply_filters('wc_add_to_cart_params', array('ajax_url' => WC()->ajax_url(), 'ajax_loader_url' => apply_filters('woocommerce_ajax_loader_url', $assets_path . 'images/ajax-loader@2x.gif'), 'i18n_view_cart' => esc_attr__('View Cart', 'woocommerce'), 'cart_url' => get_permalink(wc_get_page_id('cart')), 'is_cart' => is_cart(), 'cart_redirect_after_add' => get_option('woocommerce_cart_redirect_after_add'))));
    ?>
;
                        var wc_single_product_params = <?php 
    echo array2json(apply_filters('wc_single_product_params', array('i18n_required_rating_text' => esc_attr__('Please select a rating', 'woocommerce'), 'review_rating_required' => get_option('woocommerce_review_rating_required'))));
    ?>
;
                        var woocommerce_params = <?php 
    echo array2json(apply_filters('woocommerce_params', array('ajax_url' => WC()->ajax_url(), 'ajax_loader_url' => apply_filters('woocommerce_ajax_loader_url', $assets_path . 'images/ajax-loader@2x.gif'))));
    ?>
;
                        var wc_cart_fragments_params = <?php 
    echo array2json(apply_filters('wc_cart_fragments_params', array('ajax_url' => WC()->ajax_url(), 'fragment_name' => apply_filters('woocommerce_cart_fragment_name', 'wc_fragments'))));
    ?>
;
                        var wc_add_to_cart_variation_params = <?php 
    echo array2json(apply_filters('wc_add_to_cart_variation_params', array('i18n_no_matching_variations_text' => esc_attr__('Sorry, no products matched your selection. Please choose a different combination.', 'woocommerce'), 'i18n_unavailable_text' => esc_attr__('Sorry, this product is unavailable. Please choose a different combination.', 'woocommerce'))));
    ?>
;
                        jQuery(document).ready(function($) {
                            $( document ).off( 'click', '.plus, .minus');
                            $( document ).off( 'click', '.add_to_cart_button');
                            $.getScript('<?php 
    echo $frontend_script_path . 'add-to-cart' . $suffix . '.js';
    ?>
');
                            $.getScript('<?php 
    echo $frontend_script_path . 'single-product' . $suffix . '.js';
    ?>
');
                            $.getScript('<?php 
    echo $frontend_script_path . 'woocommerce' . $suffix . '.js';
    ?>
');
                            <?php 
    if ($goahead == 1 && $displaytypenumber > 0) {
        ?>
                            $.getScript('<?php 
        echo porto_js . '/manage-variation-selection.js';
        ?>
');
                            <?php 
    } else {
        ?>
                            $.getScript('<?php 
        echo $frontend_script_path . 'add-to-cart-variation' . $suffix . '.js';
        ?>
');
                            <?php 
    }
    ?>
                        });
                        /* ]]> */
                    </script>
                </div><!-- .summary -->
            </div>
        </div>
    </div>

    <?php 
    die;
}
Exemple #4
0
function venedor_product_quickview()
{
    global $post, $product, $woocommerce, $wpdb, $venedor_quickview;
    $post = get_post($_GET['pid']);
    $product = wc_get_product($post->ID);
    $attachment_ids = $product->get_gallery_attachment_ids();
    if (post_password_required()) {
        echo get_the_password_form();
        die;
        return;
    }
    $venedor_quickview = true;
    $displaytypenumber = 0;
    if (function_exists('wcva_get_woo_version_number')) {
        require_once wcva_plugin_path() . '/includes/wcva_common_functions.php';
    }
    if (function_exists('wcva_return_displaytype_number')) {
        $displaytypenumber = wcva_return_displaytype_number($product, $post);
    }
    $goahead = 1;
    if (isset($_SERVER['HTTP_USER_AGENT'])) {
        $agent = $_SERVER['HTTP_USER_AGENT'];
    }
    if (preg_match('/(?i)msie [5-8]/', $agent) || strpos($agent, 'Trident/7.0; rv:11.0') !== false) {
        $goahead = 0;
    }
    ?>

    <div class="quickview-wrap single-product">
        <div class="column2">
            <div class="product product-essential">

                <div class="row">
                    <div class="col-lg-6 col-md-6 col-sm-12 summary-before">
                    <?php 
    if (defined('ADDTHIS_INIT')) {
        $addthis_options = get_option('addthis_settings');
        $atversion = is_array($addthis_options) && array_key_exists('addthis_profile', $addthis_options) && $addthis_options['addthis_profile'] == 1 ? $addthis_options['addthis_profile'] : 300;
        $pub = isset($addthis_options['profile']) ? $addthis_options['profile'] : false;
        if (!$pub) {
            $pub = isset($addthis_options['addthis_profile']) ? $addthis_options['addthis_profile'] : false;
        }
        if (!$pub) {
            $pub = 'wp-' . hash_hmac('md5', get_option('home'), 'addthis');
        }
        $pub = urlencode($pub);
    }
    do_action('woocommerce_before_single_product_summary');
    ?>
                    </div>

                    <div class="col-lg-6 col-md-6 col-sm-12 summary entry-summary">
                    <?php 
    /**
     * woocommerce_single_product_summary hook
     *
     * @hooked woocommerce_template_single_title - 5
     * @hooked woocommerce_template_single_rating - 10
     * @hooked woocommerce_template_single_price - 10
     * @hooked woocommerce_template_single_excerpt - 20
     * @hooked woocommerce_template_single_add_to_cart - 30
     * @hooked woocommerce_template_single_meta - 40
     * @hooked woocommerce_template_single_sharing - 50
     */
    do_action('woocommerce_single_product_summary');
    ?>
                        <script type="text/javascript">
                            /* <![CDATA[ */
                            <?php 
    $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    $assets_path = str_replace(array('http:', 'https:'), '', WC()->plugin_url()) . '/assets/';
    $frontend_script_path = $assets_path . 'js/frontend/';
    ?>
                            var wc_add_to_cart_params = <?php 
    echo array2json(apply_filters('wc_add_to_cart_params', array('ajax_url' => WC()->ajax_url(), 'ajax_loader_url' => apply_filters('woocommerce_ajax_loader_url', $assets_path . 'images/ajax-loader@2x.gif'), 'i18n_view_cart' => esc_attr__('View Cart', 'woocommerce'), 'cart_url' => get_permalink(wc_get_page_id('cart')), 'is_cart' => is_cart(), 'cart_redirect_after_add' => get_option('woocommerce_cart_redirect_after_add'))));
    ?>
;
                            var wc_single_product_params = <?php 
    echo array2json(apply_filters('wc_single_product_params', array('i18n_required_rating_text' => esc_attr__('Please select a rating', 'woocommerce'), 'review_rating_required' => get_option('woocommerce_review_rating_required'))));
    ?>
;
                            var woocommerce_params = <?php 
    echo array2json(apply_filters('woocommerce_params', array('ajax_url' => WC()->ajax_url(), 'ajax_loader_url' => apply_filters('woocommerce_ajax_loader_url', $assets_path . 'images/ajax-loader@2x.gif'))));
    ?>
;
                            var wc_cart_fragments_params = <?php 
    echo array2json(apply_filters('wc_cart_fragments_params', array('ajax_url' => WC()->ajax_url(), 'fragment_name' => apply_filters('woocommerce_cart_fragment_name', 'wc_fragments'))));
    ?>
;
                            var wc_add_to_cart_variation_params = <?php 
    echo array2json(apply_filters('wc_add_to_cart_variation_params', array('i18n_no_matching_variations_text' => esc_attr__('Sorry, no products matched your selection. Please choose a different combination.', 'woocommerce'), 'i18n_unavailable_text' => esc_attr__('Sorry, this product is unavailable. Please choose a different combination.', 'woocommerce'))));
    ?>
;
                            if (window.addthis) {
                                window.addthis = null;
                                for(var i in window) { if(i.match(/^_at/) ) { window[i]=null } }
                            }
                            jQuery(document).ready(function($) {
                                $( document ).off( 'click', '.plus, .minus');
                                $( document ).off( 'click', '.add_to_cart_button');
                                $.getScript('<?php 
    echo $frontend_script_path . 'add-to-cart' . $suffix . '.js';
    ?>
');
                                $.getScript('<?php 
    echo $frontend_script_path . 'single-product' . $suffix . '.js';
    ?>
');
                                $.getScript('<?php 
    echo $frontend_script_path . 'woocommerce' . $suffix . '.js';
    ?>
');
                                <?php 
    if ($goahead == 1 && $displaytypenumber > 0) {
        ?>
                                $.getScript('<?php 
        echo wcva_PLUGIN_URL . 'js/manage-variation-selection.js';
        ?>
');
                                <?php 
    } else {
        ?>
                                $.getScript('<?php 
        echo $frontend_script_path . 'add-to-cart-variation' . $suffix . '.js';
        ?>
');
                                <?php 
    }
    ?>
                                <?php 
    if (defined('ADDTHIS_INIT')) {
        ?>
                                $.getScript('//s7.addthis.com/js/<?php 
        echo $atversion;
        ?>
/addthis_widget.js?async=1&pubid=<?php 
        echo $pub;
        ?>
', function() {
                                    addthis.init();
                                });
                                 <?php 
    }
    ?>
                            });
                            /* ]]> */
                        </script>
                    </div><!-- .summary -->
                </div>
            </div>
        </div>
    </div>

    <?php 
    $venedor_quickview = true;
    die;
}