Version Description
- Fixed: WPML Support on Compare Widget
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Compare |
Version | 1.1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.1.2
- README.txt +5 -1
- assets/js/woocompare.js +4 -1
- class.yith-woocompare-admin.php +1 -1
- class.yith-woocompare-frontend.php +14 -3
- class.yith-woocompare-helper.php +1 -1
- class.yith-woocompare.php +1 -1
- functions.yith-woocompare.php +1 -1
- init.php +3 -3
- templates/compare.php +12 -2
- widgets/class.yith-woocompare-widget.php +7 -2
- yith-woocompare-options.php +1 -1
README.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
|
|
4 |
Tags: woocommerce, compare, compare products, product compare, widget
|
5 |
Requires at least: 3.5.1
|
6 |
Tested up to: 3.8.1
|
7 |
-
Stable tag: 1.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -83,6 +83,10 @@ Yes, you can sort the fields in the compare table. You can do it in Woocommerce
|
|
83 |
|
84 |
== Changelog ==
|
85 |
|
|
|
|
|
|
|
|
|
86 |
= 1.1.1 =
|
87 |
|
88 |
* Fixed: Add to cart Button on Compare page
|
4 |
Tags: woocommerce, compare, compare products, product compare, widget
|
5 |
Requires at least: 3.5.1
|
6 |
Tested up to: 3.8.1
|
7 |
+
Stable tag: 1.1.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
83 |
|
84 |
== Changelog ==
|
85 |
|
86 |
+
= 1.1.2 =
|
87 |
+
|
88 |
+
* Fixed: WPML Support on Compare Widget
|
89 |
+
|
90 |
= 1.1.1 =
|
91 |
|
92 |
* Fixed: Add to cart Button on Compare page
|
assets/js/woocompare.js
CHANGED
@@ -146,13 +146,16 @@ jQuery(document).ready(function($) {
|
|
146 |
.on('click', 'li a.remove, a.clear-all', function (e) {
|
147 |
e.preventDefault();
|
148 |
|
|
|
|
|
149 |
var button = $(this),
|
150 |
data = {
|
151 |
_yitnonce_ajax: yith_woocompare.nonceremove,
|
152 |
action: yith_woocompare.actionremove,
|
153 |
id: button.data('product_id'),
|
154 |
context: 'frontend',
|
155 |
-
responseType: 'product_list'
|
|
|
156 |
},
|
157 |
product_list = button.parents('.yith-woocompare-widget').find('ul.products-list');
|
158 |
|
146 |
.on('click', 'li a.remove, a.clear-all', function (e) {
|
147 |
e.preventDefault();
|
148 |
|
149 |
+
var lang = $( '.yith-woocompare-widget .products-list').data('lang');
|
150 |
+
|
151 |
var button = $(this),
|
152 |
data = {
|
153 |
_yitnonce_ajax: yith_woocompare.nonceremove,
|
154 |
action: yith_woocompare.actionremove,
|
155 |
id: button.data('product_id'),
|
156 |
context: 'frontend',
|
157 |
+
responseType: 'product_list',
|
158 |
+
lang: lang
|
159 |
},
|
160 |
product_list = button.parents('.yith-woocompare-widget').find('ul.products-list');
|
161 |
|
class.yith-woocompare-admin.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH WooCommerce Magnifier
|
7 |
-
* @version 1.1.
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH WooCommerce Magnifier
|
7 |
+
* @version 1.1.2
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
class.yith-woocompare-frontend.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH Woocommerce Compare
|
7 |
-
* @version 1.1.
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
@@ -456,6 +456,8 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
456 |
public function remove_product_from_compare_ajax() {
|
457 |
check_ajax_referer( $this->action_remove, '_yitnonce_ajax' );
|
458 |
|
|
|
|
|
459 |
if ( ! isset( $_REQUEST['id'] ) ) die();
|
460 |
|
461 |
if ( $_REQUEST['id'] == 'all' ) {
|
@@ -470,7 +472,7 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
470 |
header('Content-Type: text/html; charset=utf-8');
|
471 |
|
472 |
if ( isset( $_REQUEST['responseType'] ) && $_REQUEST['responseType'] == 'product_list' ) {
|
473 |
-
echo $this->list_products_html();
|
474 |
} else {
|
475 |
$this->compare_table_html();
|
476 |
}
|
@@ -489,9 +491,18 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
489 |
/**
|
490 |
* The list of products as HTML list
|
491 |
*/
|
492 |
-
public function list_products_html() {
|
493 |
ob_start();
|
494 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
495 |
if ( empty( $this->products_list ) ) {
|
496 |
echo '<li>' . __( 'No products to compare', 'yit' ) . '</li>';
|
497 |
return ob_get_clean();
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH Woocommerce Compare
|
7 |
+
* @version 1.1.2
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
456 |
public function remove_product_from_compare_ajax() {
|
457 |
check_ajax_referer( $this->action_remove, '_yitnonce_ajax' );
|
458 |
|
459 |
+
$lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
|
460 |
+
|
461 |
if ( ! isset( $_REQUEST['id'] ) ) die();
|
462 |
|
463 |
if ( $_REQUEST['id'] == 'all' ) {
|
472 |
header('Content-Type: text/html; charset=utf-8');
|
473 |
|
474 |
if ( isset( $_REQUEST['responseType'] ) && $_REQUEST['responseType'] == 'product_list' ) {
|
475 |
+
echo $this->list_products_html( $lang );
|
476 |
} else {
|
477 |
$this->compare_table_html();
|
478 |
}
|
491 |
/**
|
492 |
* The list of products as HTML list
|
493 |
*/
|
494 |
+
public function list_products_html( $lang = false ) {
|
495 |
ob_start();
|
496 |
|
497 |
+
/**
|
498 |
+
* WPML Suppot: Localize Ajax Call
|
499 |
+
*/
|
500 |
+
global $sitepress;
|
501 |
+
|
502 |
+
if( defined( 'ICL_LANGUAGE_CODE' ) && $lang != false && isset( $sitepress )) {
|
503 |
+
$sitepress->switch_lang( $lang, true );
|
504 |
+
}
|
505 |
+
|
506 |
if ( empty( $this->products_list ) ) {
|
507 |
echo '<li>' . __( 'No products to compare', 'yit' ) . '</li>';
|
508 |
return ob_get_clean();
|
class.yith-woocompare-helper.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH WooCommerce Compare
|
7 |
-
* @version 1.1.
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH WooCommerce Compare
|
7 |
+
* @version 1.1.2
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
class.yith-woocompare.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH Woocommerce Compare
|
7 |
-
* @version 1.1.
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH Woocommerce Compare
|
7 |
+
* @version 1.1.2
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
functions.yith-woocompare.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH Woocommerce Compare
|
7 |
-
* @version 1.1.
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH Woocommerce Compare
|
7 |
+
* @version 1.1.2
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
init.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: YITH Woocommerce Compare
|
4 |
* Plugin URI: http://yithemes.com/
|
5 |
* Description: YITH Woocommerce Compare allows you to compare more products with woocommerce plugin, through product attributes.
|
6 |
-
* Version: 1.1.
|
7 |
* Author: Your Inspiration Themes
|
8 |
* Author URI: http://yithemes.com/
|
9 |
* Text Domain: yit
|
@@ -11,7 +11,7 @@
|
|
11 |
*
|
12 |
* @author Your Inspiration Themes
|
13 |
* @package YITH Woocommerce Compare
|
14 |
-
* @version 1.1.
|
15 |
*/
|
16 |
/* Copyright 2013 Your Inspiration Themes (email : plugins@yithemes.com)
|
17 |
|
@@ -44,7 +44,7 @@ function yith_woocompare_constructor() {
|
|
44 |
load_plugin_textdomain( 'yit', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );
|
45 |
|
46 |
define( 'YITH_WOOCOMPARE', true );
|
47 |
-
define( 'YITH_WOOCOMPARE_VERSION', '1.1.
|
48 |
define( 'YITH_WOOCOMPARE_URL', plugin_dir_url( __FILE__ ) );
|
49 |
define( 'YITH_WOOCOMPARE_DIR', plugin_dir_path( __FILE__ ) );
|
50 |
|
3 |
* Plugin Name: YITH Woocommerce Compare
|
4 |
* Plugin URI: http://yithemes.com/
|
5 |
* Description: YITH Woocommerce Compare allows you to compare more products with woocommerce plugin, through product attributes.
|
6 |
+
* Version: 1.1.2
|
7 |
* Author: Your Inspiration Themes
|
8 |
* Author URI: http://yithemes.com/
|
9 |
* Text Domain: yit
|
11 |
*
|
12 |
* @author Your Inspiration Themes
|
13 |
* @package YITH Woocommerce Compare
|
14 |
+
* @version 1.1.2
|
15 |
*/
|
16 |
/* Copyright 2013 Your Inspiration Themes (email : plugins@yithemes.com)
|
17 |
|
44 |
load_plugin_textdomain( 'yit', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );
|
45 |
|
46 |
define( 'YITH_WOOCOMPARE', true );
|
47 |
+
define( 'YITH_WOOCOMPARE_VERSION', '1.1.2' );
|
48 |
define( 'YITH_WOOCOMPARE_URL', plugin_dir_url( __FILE__ ) );
|
49 |
define( 'YITH_WOOCOMPARE_DIR', plugin_dir_path( __FILE__ ) );
|
50 |
|
templates/compare.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH Woocommerce Compare
|
7 |
-
* @version 1.1.
|
8 |
*/
|
9 |
|
10 |
global $product;
|
@@ -205,7 +205,17 @@ $wc_get_template = function_exists('wc_get_template') ? 'wc_get_template' : 'woo
|
|
205 |
// remove add to cart button after added
|
206 |
$('body').on('added_to_cart', function(){
|
207 |
button_clicked.hide();
|
208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
});
|
210 |
|
211 |
// close window
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH Woocommerce Compare
|
7 |
+
* @version 1.1.2
|
8 |
*/
|
9 |
|
10 |
global $product;
|
205 |
// remove add to cart button after added
|
206 |
$('body').on('added_to_cart', function(){
|
207 |
button_clicked.hide();
|
208 |
+
|
209 |
+
<?php if ( $is_iframe ) : ?>
|
210 |
+
$('a').attr('target', '_parent');
|
211 |
+
|
212 |
+
// Replace fragments
|
213 |
+
if ( fragments ) {
|
214 |
+
$.each(fragments, function(key, value) {console.log( key, window.parent.document );
|
215 |
+
$(key, window.parent.document).replaceWith(value);
|
216 |
+
});
|
217 |
+
}
|
218 |
+
<?php endif; ?>
|
219 |
});
|
220 |
|
221 |
// close window
|
widgets/class.yith-woocompare-widget.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH WooCommerce Ajax Navigation
|
7 |
-
* @version 1.1.
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
@@ -26,11 +26,16 @@ if( !class_exists( 'YITH_WOOCOMPARE' ) ) {
|
|
26 |
function widget( $args, $instance ) {
|
27 |
global $yith_woocompare;
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
extract( $args );
|
30 |
|
31 |
echo $before_widget . $before_title . $instance['title'] . $after_title; ?>
|
32 |
|
33 |
-
<ul class="products-list">
|
34 |
<?php echo $yith_woocompare->obj->list_products_html(); ?>
|
35 |
</ul>
|
36 |
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH WooCommerce Ajax Navigation
|
7 |
+
* @version 1.1.2
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
26 |
function widget( $args, $instance ) {
|
27 |
global $yith_woocompare;
|
28 |
|
29 |
+
/**
|
30 |
+
* WPML Support
|
31 |
+
*/
|
32 |
+
$lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
|
33 |
+
|
34 |
extract( $args );
|
35 |
|
36 |
echo $before_widget . $before_title . $instance['title'] . $after_title; ?>
|
37 |
|
38 |
+
<ul class="products-list" data-lang="<?php echo $lang ?>">
|
39 |
<?php echo $yith_woocompare->obj->list_products_html(); ?>
|
40 |
</ul>
|
41 |
|
yith-woocompare-options.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH Woocommerce Compare
|
7 |
-
* @version 1.1.
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH Woocommerce Compare
|
7 |
+
* @version 1.1.2
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|