Skip to content

Commit

Permalink
Merge pull request #106 from codersaiful/2.9.3.0
Browse files Browse the repository at this point in the history
2.9.3.0
  • Loading branch information
codersaiful authored Jun 21, 2021
2 parents 5cf45f2 + 41da15e commit c8e7203
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 37 deletions.
13 changes: 11 additions & 2 deletions admin/action-hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,15 @@ function wpt_configure_basic_part( $settings,$current_config_value,$field_name )
</select>
</td>
</tr>
<tr>
<th> <label class="wpt_label" for="wpt_table_query_by_url"><?php esc_html_e( 'Query by URL', 'wpt_pro' ); ?></label></th>
<td>
<select name="<?php echo esc_attr( $field_name ); ?>[query_by_url]" id="wpt_table_instant_search_filter" class="wpt_fullwidth ua_input" >
<option value="0" <?php wpt_selected( 'query_by_url', '0', $current_config_value ); ?>><?php esc_html_e( 'Off', 'wpt_pro' ); ?></option>
<option value="1" <?php wpt_selected( 'query_by_url', '1', $current_config_value ); ?>><?php esc_html_e( 'On', 'wpt_pro' ); ?></option>
</select>
</td>
</tr>
</tbody>
</table><?php do_action( 'wpto_admin_configuration_panel_bottom',$settings,$current_config_value ); ?>
</div>
Expand Down Expand Up @@ -358,7 +367,7 @@ function wpt_configure_label_part($settings, $current_config_value,$field_name){
</td>
</tr>
<tr>
<th><label for="wpt_table_search_keyword_text" class="wpt_label"><?php echo sprintf(esc_html__( '%s[Search Keyword]%s - Text', 'wpt_pro' ), '<b>', '</b>' ); ?></label></th>
<th><label for="wpt_table_search_keyword_text" class="wpt_label"><?php echo sprintf(esc_html__( '%s[Search Keyword Title]%s - Text', 'wpt_pro' ), '<b>', '</b>' ); ?></label></th>
<td>
<input name="<?php echo esc_attr( $field_name ); ?>[search_keyword_text]" class="wpt_data_filed_atts ua_input" value="<?php echo esc_attr( $current_config_value['search_keyword_text'] ); ?>" id="wpt_table_search_keyword_text" type="text" placeholder="<?php esc_attr_e( 'Search Keyword', 'wpt_pro' ); ?>">
</td>
Expand Down Expand Up @@ -426,7 +435,7 @@ function wpt_configure_label_part($settings, $current_config_value,$field_name){
</td>
</tr>
<tr>
<th><label for="wpt_table_search_box_searchkeyword" class="wpt_label"><?php esc_html_e( 'Search Keyword text', 'wpt_pro' ); ?></label></th>
<th><label for="wpt_table_search_box_searchkeyword" class="wpt_label"><?php esc_html_e( 'Search Keyword Placeholder', 'wpt_pro' ); ?></label></th>
<td>
<input name="<?php echo esc_attr( $field_name ); ?>[search_box_searchkeyword]" class="wpt_data_filed_atts ua_input" value="<?php echo esc_attr( $current_config_value['search_box_searchkeyword'] ); ?>" id="wpt_table_search_box_searchkeyword" type="text" placeholder="<?php esc_attr_e( 'Search Keyword text', 'wpt_pro' ); ?>">
</td>
Expand Down
6 changes: 4 additions & 2 deletions admin/post_metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,14 @@ function wpt_shortcode_configuration_metabox_save_meta( $post_id, $post ) { // s
'flags' => FILTER_REQUIRE_ARRAY,
),
'column_settings' => array(
'filter' => FILTER_SANITIZE_STRING,
'filter' => FILTER_CALLBACK,
'flags' => FILTER_REQUIRE_ARRAY,
'options' => 'wp_kses_post'
),
'column_settings_tablet' => array(
'filter' => FILTER_SANITIZE_STRING,
'filter' => FILTER_CALLBACK,
'flags' => FILTER_REQUIRE_ARRAY,
'options' => 'wp_kses_post'
),
'column_settings_mobile' => array(
'filter' => FILTER_SANITIZE_STRING,
Expand Down
66 changes: 46 additions & 20 deletions assets/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@
var current_link = window.location.href;
window.history.pushState('data', null, current_link.replace(/(paged=\d)+/, "paged=" + (pageNumber-1)));


/**
* Scrolling to Table Top
*
* @type window.$|$
*/
var body = $('html, body');
var thisTableTop = $('#table_id_' + temp_number).offset();
body.animate({scrollTop:thisTableTop.top}, 500, 'swing');

},
success: function(data) {
targetTableBody.html(data);
Expand All @@ -141,7 +151,7 @@


if($('#table_id_' + temp_number + ' table.wpt_product_table').attr('data-queried') !== 'true'){
generat_url_by_search_query(temp_number);
generate_url_by_search_query(temp_number);
$('#table_id_' + temp_number + ' table.wpt_product_table').attr('data-queried','true');
}

Expand Down Expand Up @@ -451,7 +461,7 @@
* for Ajax add to cart
* for Variation product
*/
$('body').on('click', 'a.ajax_active.wpt_variation_product.single_add_to_cart_button.button.enabled, a.ajax_active.add_to_cart_button.wpt_woo_add_cart_button', function(e) {
$('body').on('click', 'a.ajax_active.wpt_variation_product.single_add_to_cart_button.button.enabled, a.add_to_cart_button.ajax_add_to_cart, a.ajax_active.add_to_cart_button.wpt_woo_add_cart_button', function(e) {
e.preventDefault();
var thisButton = $(this);
//Adding disable and Loading class
Expand Down Expand Up @@ -1392,7 +1402,7 @@
/**
* Generate here where query
*/
generat_url_by_search_query(temp_number, extra_link_tax_cf);
generate_url_by_search_query(temp_number, extra_link_tax_cf);
$('#wpt_query_reset_button_' + temp_number).fadeIn('medium');
/**
* Trigger on this event, when search will be completed
Expand Down Expand Up @@ -1460,7 +1470,13 @@
* @param {type} table_id
* @returns {undefined}
*/
function generat_url_by_search_query( table_id = 0, extra = '' ){
function generate_url_by_search_query( table_id = 0, extra = '' ){
config_json = getConfig_json( table_id ); //Added vat v2.9.3.0

if(config_json.query_by_url !== '1'){
return;
}

var key,value;
var link = window.location.origin + window.location.pathname + "?table_ID=" + table_id + "&";
$('.query_box_direct_value').each(function(){
Expand Down Expand Up @@ -1576,15 +1592,29 @@
updateCheckBoxCount(temp_number);
}


/**
* Mainly for shortmessage field
*/
$('body').on('change', '.wpt_row input.message', function() {
var temp_number = $(this).parents('tr.wpt_row').data('temp_number');
var msg = $(this).val();
var product_id = $(this).parents('tr').data('product_id');

var thisRow = '#table_id_' + temp_number + ' tr.product_id_' + product_id;
$( thisRow + ' input.message').val(msg);
});
$('body').on('change', '.wpt_row input.input-text.qty.text', function() {
var temp_number = $(this).parents('tr.wpt_row').data('temp_number');
var Qty_Val = $(this).val();
var product_id = $(this).parents('tr').data('product_id');

//.product_id_' + product_id + ' This a Table Trow Class
$('#table_id_' + temp_number + ' tr.product_id_' + product_id + ' input.input-text.qty.text').val(Qty_Val);
$('#table_id_' + temp_number + ' tr.product_id_' + product_id).attr('data-quantity',Qty_Val);
var thisRow = '#table_id_' + temp_number + ' tr.product_id_' + product_id;

$( thisRow + ' input.input-text.qty.text').val(Qty_Val);
$( thisRow ).attr('data-quantity', Qty_Val);
$( thisRow + ' a.wpt_woo_add_cart_button').attr('data-quantity', Qty_Val);
$( thisRow + ' a.add_to_cart_button ').attr('data-quantity', Qty_Val);

var targetTotalSelector = $('#table_id_' + temp_number + ' .product_id_' + product_id + ' .wpt_total_item.total_general');


Expand Down Expand Up @@ -1622,7 +1652,6 @@
break;
}

$('#table_id_' + temp_number + ' .product_id_' + product_id + ' .wpt_action a.wpt_woo_add_cart_button').attr('data-quantity', Qty_Val);
$('.yith_request_temp_' + temp_number + '_id_' + product_id).attr('data-quantity', Qty_Val);
$('#table_id_' + temp_number + ' .product_id_' + product_id + ' .wpt_total_item.total_general strong').html(newPrice);
//$(target_row_id + ' a.add_to_cart_button').attr('data-quantity', Qty_Val); //wpt_total_item total_general
Expand Down Expand Up @@ -1773,9 +1802,8 @@
if( typeof split_params[1] !== 'undefined' && type === 'variation' ){
quote_data = '&' + split_params[1];
}
add_to_cart_info = 'action=yith_ywraq_action&ywraq_action=add_item';
add_to_cart_info = 'action=yith_ywraq_action&ywraq_action=add_item&quantity=' + quantity + '&product_id='+ product_id +'&_wpnonce='+ywraq_frontend.yith_ywraq_action_nonce;
add_to_cart_info += quote_data;
add_to_cart_info += '&quantity=' + quantity;
/**
* When Table will show "Only Variation" as row
* Then Product ID will get from Parent ID
Expand All @@ -1788,14 +1816,13 @@
product_id = parent_id;
add_to_cart_info += '&variation_id=' + variation_id;
}
add_to_cart_info += '&product_id=' + product_id;
add_to_cart_info += '&wp_nonce=' + wp_nonce;
add_to_cart_info += '&yith-add-to-cart=' + product_id;

var yith_ajax_url;// = ywraq_frontend.ajaxurl;
yith_ajax_url = ywraq_frontend.ajaxurl.toString().replace( '%%endpoint%%', 'yith_ywraq_action' );

$.ajax({
type : 'POST',
url : yith_ajax_url,
url : ywraq_frontend.ajaxurl,//yith_ajax_url,
dataType: 'json',
data : add_to_cart_info,
beforeSend: function(){
Expand All @@ -1806,11 +1833,10 @@
success: function (response) {
if( response && ( response.result === 'true' || response.result === 'exists' ) ){
$('.' + selector).html(msg.added);
if(response.result === 'exists'){

$('.' + selector).attr('data-response_msg',response.message);
//alert(response.message);
}
//if(response.result === 'exists'){
//$('.' + selector).attr('data-response_msg',response.message);
//}
$('.' + selector).attr('data-response_msg',response.message);
var html;
//$('.wpt_quoterequest img').remove();
//$('.' + selector + '+.yith_ywraq_add_item_browse_message').remove();
Expand Down
4 changes: 4 additions & 0 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,10 @@ function wpt_freeze_column_maintain( $table_ID, $args, $column_settings, $enable
if( !function_exists( 'wpt_add_div_at_top' ) ){

/**
* Top Scrollbar
* To hide, top scrollbar, we can use this action hook
*
*
* Add a new div at the top of the table, To add a Wrapper wrapper at the Top
*
* @param Int $table_ID
Expand Down
4 changes: 2 additions & 2 deletions includes/helper-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function wpt_ajax_paginate_links_load(){
$table_ID = $args['table_ID'];
$search_from = get_post_meta( $table_ID, 'search_n_filter', true );

$search_from = isset( $search_from['search_from'] ) && is_array( $search_from['search_from'] ) && count( $search_from['search_from'] ) > 0 ? sanitize_text_field( $search_from['search_from'] ) : false;
$search_from = isset( $search_from['search_from'] ) && is_array( $search_from['search_from'] ) && count( $search_from['search_from'] ) > 0 ? $search_from['search_from'] : false;

$search_key = isset( $directkey['s'] ) && !empty( $directkey['s'] ) ? sanitize_text_field( $directkey['s'] ) : "";

Expand Down Expand Up @@ -208,7 +208,7 @@ function wpt_ajax_table_row_load(){

$table_ID = $args['table_ID'];
$search_from = get_post_meta( $table_ID, 'search_n_filter', true );
$search_from = isset($search_from['search_from']) && is_array( $search_from['search_from'] ) && count( $search_from['search_from'] ) > 0 ? sanitize_text_field( $search_from['search_from'] ) : false;
$search_from = isset($search_from['search_from']) && is_array( $search_from['search_from'] ) && count( $search_from['search_from'] ) > 0 ? $search_from['search_from'] : false;

$search_key = isset( $directkey['s'] ) && !empty( $directkey['s'] ) ? sanitize_text_field( $directkey['s'] ) : "";

Expand Down
9 changes: 5 additions & 4 deletions includes/items/message.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
echo "<input type='text' class='message message_{$id}' id='message_{$id}' placeholder='" . $config_value['type_your_message'] . "'>";


<input type='text'
class='message message_<?php echo esc_attr( $id ); ?>'
value=''
id='message_<?php echo esc_attr( $id ); ?>'
placeholder='<?php echo esc_attr( $config_value['type_your_message'] ); ?>'>
7 changes: 6 additions & 1 deletion includes/items/quoterequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
if( $product->get_type() == 'variable' ){
$quote_class = 'variations_button disabled';
}

$c_product_id = $data['id'];
$Add_to_Quote = $config_value['yith_add_to_quote_text'];//'Add to Quote';
$data_message = '{"text":"'. $Add_to_Quote .'","adding":"' . $config_value['yith_add_to_quote_adding'] . '","added":"' . $config_value['yith_add_to_quote_added'] . '"}';

$q_final_class = "{$quote_class} yith_request_temp_{$temp_number}_id_{$data['id']} wpt_yith_add_to_quote_request wpt_add-request-quote-button";

?>
<a data-yith_browse_list='<?php echo esc_attr( $config_value['yith_browse_list'] ); ?>'
data-response_msg=''
Expand All @@ -21,4 +26,4 @@ class='<?php echo esc_attr( "{$quote_class} yith_request_temp_{$temp_number}_id_
data-quantity='<?php echo esc_attr( $default_quantity ); ?>'
data-selector='<?php echo esc_attr( "yith_request_temp_{$temp_number}_id_{$data['id']}" ); ?>'>
<?php echo esc_html( $Add_to_Quote ); ?>
</a>
</a>
5 changes: 3 additions & 2 deletions includes/shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -1303,10 +1303,11 @@ function wpt_search_box($temp_number, $search_box_texonomiy_keyword = array( 'pr
$order_by = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : $order_by;
$order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : $order;

$single_keyword = $config_value['search_box_searchkeyword'];//__( 'Search keyword', 'wpt_pro' );
$single_keyword = $config_value['search_keyword_text'];//__( 'Search keyword', 'wpt_pro' );
$search_box_placeholder = $config_value['search_box_searchkeyword'];//__( 'Search keyword', 'wpt_pro' );
$html .= "<div class='search_single_column'>";
$html .= '<label class="search_keyword_label single_keyword" for="single_keyword_' . $temp_number . '">' . $single_keyword . '</label>';
$html .= '<input data-key="s" value="' . $search_keyword . '" class="query_box_direct_value" id="single_keyword_' . $temp_number . '" value="" placeholder="' . $single_keyword . '"/>';
$html .= '<input data-key="s" value="' . $search_keyword . '" class="query_box_direct_value" id="single_keyword_' . $temp_number . '" value="" placeholder="' . $search_box_placeholder . '"/>';
$html .= "</div>";// End of .search_single_column

$order_by_validation = apply_filters( 'wpto_searchbox_order_show', false,$temp_number, $config_value, $search_box_texonomiy_keyword );
Expand Down
12 changes: 11 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://codecanyon.net/item/woo-product-table-pro/20676867?ref=Code
Tags: wc product table,woocommerce product table, product table, wc table, quick order table, wholesale table, restaurants table
Requires at least: 4.0.0
Tested up to: 5.7.2
Stable tag: 2.9.1
Stable tag: 2.9.3
Requires PHP: 5.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -157,6 +157,16 @@ You can easily show specific category products. While creating new table click o

== Changelog ==

= 2.9.3 =
* Fixed: Shop page quantity issue
* Fixed: After add to cart quantity issue
* Fixed: Quote button issue
* Fixed: YITH Quote button issue
* Fixed: Short Message not sending issue
* Fixed: Advance Search on latest verion
* Added: Query by URL - on off from Configuraton page and tab
* Bug Fix

= 2.9.1 =
* escapping issue fixed

Expand Down
6 changes: 3 additions & 3 deletions woo-product-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
* Author URI: https://profiles.wordpress.org/codersaiful/
* Tags: woocommerce product list,woocommerce product table, wc product table, product grid view, inventory, shop product table
*
* Version: 2.9.1
* Version: 2.9.3
* Requires at least: 4.0.0
* Tested up to: 5.7.2
* WC requires at least: 3.0.0
* WC tested up to: 5.3.0
* WC tested up to: 5.4.1
*
* Text Domain: wpt_pro
* Domain Path: /languages/
Expand All @@ -30,7 +30,7 @@
}

if( !defined( 'WPT_DEV_VERSION' ) ){
define( 'WPT_DEV_VERSION', '2.9.1.3' );
define( 'WPT_DEV_VERSION', '2.9.3.0' );
}

if( !defined( 'WPT_CAPABILITY' ) ){
Expand Down

0 comments on commit c8e7203

Please sign in to comment.