public function wcva_register_my_scripts()
 {
     global $post, $product;
     if (!$post) {
         return;
     }
     $displaytypenumber = 0;
     $product = get_product($post->ID);
     if (is_product()) {
         $displaytypenumber = wcva_return_displaytype_number($product, $post);
     }
     wp_register_style('wcva-frontend', wcva_PLUGIN_URL . 'css/front-end.css');
     $goahead = 1;
     if (isset($_SERVER['HTTP_USER_AGENT'])) {
         $agent = $_SERVER['HTTP_USER_AGENT'];
     }
     if (preg_match('/(?i)msie [5-8]/', $agent)) {
         $goahead = 0;
     }
     if ($displaytypenumber > 0 && $goahead == 1) {
         wp_deregister_script('wc-add-to-cart-variation');
         wp_dequeue_script('wc-add-to-cart-variation');
         wp_register_script('wc-add-to-cart-variation', wcva_PLUGIN_URL . 'js/manage-variation-selection.js', array('jquery'), false, true);
     }
     if (is_product()) {
         if ($displaytypenumber > 0 && $goahead == 1) {
             wp_enqueue_script('wc-add-to-cart-variation');
         }
         wp_enqueue_style('wcva-frontend');
     }
 }
 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;
 }
Exemplo n.º 3
0
/**
 * Variable product add to cart
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     2.4.0
 */
if (!defined('ABSPATH')) {
    exit;
}
global $woocommerce, $post, $product, $venedor_settings, $venedor_woo_version;
$displaytypenumber = 0;
if ($venedor_settings['product-addcart']) {
    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;
    }
    if ($goahead == 1 && $displaytypenumber > 0) {
        ?>

<?php 
        $woo_version = wcva_get_woo_version_number();
        $_coloredvariables = get_post_meta($post->ID, '_coloredvariables', true);
        /*
Exemplo n.º 4
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;
}
Exemplo n.º 5
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;
}