So sánh sản phẩm
No products added in the compare table.
jQuery( document ).ready( ( $ ) { $( 'a' ).attr( 'target', '_parent' ); // ########## DATA TABLES ############ $.dataTableFunction = () { var t = $( 'table.compare-list' ), dTable; if( t.length && ! t.find('.no-products').length && typeof $.fn.DataTable != 'undefined' && typeof $.fn.imagesLoaded != 'undefined' ) { t.imagesLoaded( (){ dTable = t.DataTable( { 'info': false, 'scrollX': true, 'scrollCollapse': true, 'paging': false, 'ordering': false, 'searching': false, 'autoWidth': false, 'destroy': true, 'fixedColumns': { leftColumns: 1 } }); }); $(window) .off('resize') .off('orientationchange') .on('resize orientationchange', (){ if ( typeof dTable !== 'undefined' ) { dTable.destroy(); $.dataTableFunction(); } }); } }; $.dataTableFunction(); $( document ).on( 'yith_woocompare_render_table yith_woocompare_product_removed', () { $.dataTableFunction(); } ); // add to cart var redirect_to_cart = false, body = $( 'body' ); // close colorbox if redirect to cart is active after add to cart body.on( 'adding_to_cart', ( $thisbutton, data ) { if ( wc_add_to_cart_params.cart_redirect_after_add == 'yes' ) { wc_add_to_cart_params.cart_redirect_after_add = 'no'; redirect_to_cart = true; } } ); body.on( 'wc_cart_button_updated', ( ev, button ) { $( 'a.added_to_cart' ).attr( 'target', '_parent' ); } ); // remove add to cart button after added body.on( 'added_to_cart', ( ev, fragments, cart_hash, button ) { $( 'a' ).attr( 'target', '_parent' ); if ( redirect_to_cart == true ) { // redirect parent.window.location = wc_add_to_cart_params.cart_url; return; } // Replace fragments if ( fragments ) { $.each( fragments, ( key, value ) { $( key, window.parent.document ).replaceWith( value ); } ); } } ); // close window $( document ).on( 'click', 'a.close', ( e ) { e.preventDefault(); window.close(); } ); } );