Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.10.1 #325

Merged
merged 81 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
16a6787
Side cart feedback
DevWael Oct 1, 2024
d202795
remove this FBT and BOGO from "suggested products" option in added to…
DevWael Oct 1, 2024
4d195f8
Fix Side Cart Module: Total price color remains default
DevWael Oct 2, 2024
03c4c6e
Fix slick slider rtl
DevWael Oct 2, 2024
8eb8f42
Fix side cart rtl
DevWael Oct 2, 2024
9879101
Side cart: add coupon code managing functionality
DevWael Oct 2, 2024
43968ae
hide coupon code managing functionality from mini cart
DevWael Oct 2, 2024
f4a6dfd
Side cart: add toggles
DevWael Oct 2, 2024
957525c
Side cart: control showing on devices
DevWael Oct 3, 2024
1373efc
Side cart: control showing savings
DevWael Oct 3, 2024
bdcb432
Side cart: control showing savings
DevWael Oct 3, 2024
74f999c
Side cart: control showing buttons
DevWael Oct 3, 2024
c328baf
Side cart: disable upsells carousel autoplay
DevWael Oct 3, 2024
f963608
Side cart: control sliding direction
DevWael Oct 3, 2024
982df59
Side cart: update fields to add conditional logic to update exclusion…
DevWael Oct 3, 2024
b2fa9f5
Side cart: update module frontend styles
DevWael Oct 4, 2024
fa21094
Side cart: update exclusion logic
DevWael Oct 7, 2024
3691edf
Expand selectors
thenahidul Oct 8, 2024
4c0d0b6
Variation swatch compatibility Bricks Builder
thenahidul Oct 10, 2024
0b75d57
Added shortcode support
thenahidul Oct 10, 2024
89a3d11
Added content width option for mobile
thenahidul Oct 11, 2024
43fe70b
Added tags selection option
thenahidul Oct 11, 2024
244f0a4
Added tags selection option to pre-orders
thenahidul Oct 11, 2024
f5b5a2d
Merge branch 'quick-view-shortcode' into real-time-search-shortcode
thenahidul Oct 14, 2024
6df90c6
Change the plugin home link to https://athemes.com/merchant
DevWael Oct 14, 2024
6b1d546
Fix admin framework radio buttons checking
DevWael Oct 14, 2024
99f5322
Add shortcode for real-time search
thenahidul Oct 15, 2024
3d316e9
Fix styling issues
thenahidul Oct 16, 2024
7b7537c
Add advanced reviews new options
DevWael Oct 17, 2024
4c26c47
Quick view button
thenahidul Oct 17, 2024
0727183
Make the add review button limited width
DevWael Oct 17, 2024
b5667c6
Add loading spinner animation
DevWael Oct 17, 2024
0d320f4
Add settings for discounts emails
DevWael Oct 18, 2024
aa545b1
Rename field value
DevWael Oct 18, 2024
6ab0ac3
Fix default value
DevWael Oct 18, 2024
0761fb6
Improve ajax message styling
DevWael Oct 18, 2024
6e477da
Fixed toggle inside flexible content
thenahidul Oct 21, 2024
66408ac
Update copy
DevWael Oct 21, 2024
8cc53dc
Fix multiline textarea not working
DevWael Oct 21, 2024
63705a1
Remove review type btn
DevWael Oct 21, 2024
f9797e8
Add email subject and body to registered strings
DevWael Oct 21, 2024
fc3251a
Added usable tags to the fields description
DevWael Oct 21, 2024
a220660
Advanced reviews product description escaping
thenahidul Oct 22, 2024
0a5cd08
Reasons to buy list refactoring
thenahidul Oct 22, 2024
cd9d5b1
Nonce
thenahidul Oct 22, 2024
728cfe2
cleanup
thenahidul Oct 22, 2024
94c9310
Merge pull request #310 from athemes/quickview-realtime-search-shortcode
thenahidul Oct 22, 2024
dec4ffd
Merge pull request #311 from athemes/product-labels-pre-orders-tags-s…
thenahidul Oct 22, 2024
f6c7775
Update copy
DevWael Oct 22, 2024
a901b71
Set coupon code url
DevWael Oct 22, 2024
a247676
Restructure the file
DevWael Oct 22, 2024
04e9c84
Added Exclude Categories & Tags
thenahidul Oct 22, 2024
efaae2f
Merge pull request #312 from athemes/dw-sprint
DevWael Oct 22, 2024
979162f
Merge branch 'free-gifts-widget-mobile-size' into quickview-realtime-…
thenahidul Oct 22, 2024
0cae98f
Option improvements
thenahidul Oct 22, 2024
647ae04
code
thenahidul Oct 22, 2024
add998d
Merge pull request #313 from athemes/quickview-realtime-search-shortcode
thenahidul Oct 22, 2024
d8f1bed
Merge pull request #314 from athemes/fbt-your-savings-styling
thenahidul Oct 23, 2024
b58c160
Fix sidecart wrong field id
DevWael Oct 23, 2024
42d6cc6
Merge pull request #316 from athemes/dw-sprint
DevWael Oct 23, 2024
9942af7
Remove comment
thenahidul Oct 23, 2024
7222b56
Merge pull request #315 from athemes/variation-swatch-bricks-quick-view
thenahidul Oct 23, 2024
ce21c17
Add Exclusion list
thenahidul Oct 23, 2024
35c0f50
undo a change
thenahidul Oct 23, 2024
ddcdc24
Fix product labels
thenahidul Oct 23, 2024
33be623
Merge remote-tracking branch 'origin/develop' into reasons-to-buy-ref…
thenahidul Oct 23, 2024
d190759
Merge pull request #317 from athemes/reasons-to-buy-refactor
thenahidul Oct 23, 2024
eba050a
Adds threaded to advanced reviews
maaprote Oct 23, 2024
efc129a
Merge pull request #318 from athemes/bugfix/rt/adv-reviews
maaprote Oct 23, 2024
284c194
Add Pre-order Products options to Product labels
thenahidul Oct 23, 2024
94aee3b
Merge pull request #319 from athemes/product-labels-pre-oder-option
thenahidul Oct 23, 2024
0ab65d0
adds store owner reply label
maaprote Oct 23, 2024
05fb407
Merge pull request #320 from athemes/bugfix/rt/adv-reviews
maaprote Oct 23, 2024
ccf6a48
Fix toggle inside flexible content
thenahidul Oct 23, 2024
e2b7f7f
Merge pull request #321 from athemes/switch-toggle-fix
thenahidul Oct 23, 2024
97a88b5
bump version, changelog, pot file
maaprote Oct 23, 2024
57f55f8
Merge pull request #322 from athemes/release/1.10.1
maaprote Oct 23, 2024
bc10acd
remove enqueue from animated add to cart
maaprote Oct 23, 2024
da2194d
Merge pull request #323 from athemes/improvement/rt/animated-add-to-cart
maaprote Oct 23, 2024
088dc54
remove sass folder from zip file generation
maaprote Oct 23, 2024
a375653
Merge pull request #324 from athemes/improvement/rt/wpgulp
maaprote Oct 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion admin/classes/class-merchant-admin-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ public static function save_options( $settings ) {
} elseif ( 'textarea_multiline' === $field['type'] ) {
$value = sanitize_textarea_field( $_POST['merchant'][ $field['id'] ] );
} elseif ( is_array( $_POST['merchant'][ $field['id'] ] ) ) {
$value = array_filter( map_deep( wp_unslash( $_POST['merchant'][ $field['id'] ] ), 'sanitize_text_field' ) );
$value = array_filter( map_deep( wp_unslash( $_POST['merchant'][ $field['id'] ] ), 'sanitize_textarea_field' ) );
} else {
$value = sanitize_text_field( wp_unslash( $_POST['merchant'][ $field['id'] ] ) );
}
Expand Down Expand Up @@ -454,6 +454,7 @@ public static function sanitize( $field, $value ) {
$value = sanitize_text_field( $value );
break;

case 'textarea_multiline':
case 'textarea':
$value = sanitize_textarea_field( $value );
break;
Expand Down Expand Up @@ -2092,6 +2093,8 @@ public static function flexible_content( $settings, $value, $module_id = '' ) {
$value = null;
if ( isset( $option[ $sub_field['id'] ] ) ) {
$value = $option[ $sub_field['id'] ];
} elseif ( isset( $sub_field['type'] ) && $sub_field['type'] === 'switcher' ) {
$value = is_null( $value ) ? 0 : 1;
} elseif ( isset( $sub_field['default'] ) ) {
$value = $sub_field['default'];
}
Expand Down
84 changes: 62 additions & 22 deletions assets/js/src/admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,18 @@
}
}

// Intialize Sortable.
// Initialize Sortable.
SortableField.init();
flexibleToggleField.init();

// When adding/duplicating new item, refresh sorting
$( document ).on('merchant-flexible-content-added', function (e, $layout) {
const $sortableWrapper = $layout.find( '.merchant-sortable-repeater-control' );
const $sortableElement = $sortableWrapper.find('.merchant-sortable-repeater.sortable');

SortableRepeaterField.makeFieldsSortable( $sortableElement );
});

// Sortable Repeater.
const SortableRepeaterField = {
init: function (field) {
Expand All @@ -373,30 +381,31 @@
$('.merchant-sortable-repeater-control').each(function () {

// If there is an existing customizer value, populate our rows
var defaultValuesArray = JSON.parse($(this).find('.merchant-sortable-repeater-input').val());
var numRepeaterItems = defaultValuesArray.length;
const defaultValuesArray = JSON.parse($(this).find('.merchant-sortable-repeater-input').val());
const numRepeaterItems = defaultValuesArray.length;

if (numRepeaterItems > 0) {
// Add the first item to our existing input field
$(this).find('.repeater-input').val(defaultValuesArray[0]);

// Create a new row for each new value
if (numRepeaterItems > 1) {
var i;
for (i = 1; i < numRepeaterItems; ++i) {
// var i;
for (let i = 1; i < numRepeaterItems; ++i) {
self.appendRow($(this), defaultValuesArray[i]);
}
}
}

// Make our Repeater fields sortable.
if (!$(this).hasClass('disable-sorting')) {
$(this).find('.merchant-sortable-repeater.sortable').sortable({
update: function (event, ui) {
self.getAllInputs($(this).parent());
}
});
}
// Todo: remove
// Make our Repeater fields sortable. Doesn't work with flexible content
// if (!$(this).hasClass('disable-sorting')) {
// $(this).find('.merchant-sortable-repeater.sortable').sortable({
// update: function (event, ui) {
// self.getAllInputs($(this).parent());
// }
// });
// }
});

// Events.
Expand All @@ -407,28 +416,30 @@
const self = this;

// Remove item starting from its parent element
$('.merchant-sortable-repeater.sortable').on('click', '.customize-control-sortable-repeater-delete', function (event) {
$( document ).on('click', '.merchant-sortable-repeater.sortable .customize-control-sortable-repeater-delete', function (event) {
event.preventDefault();
$(this).parent().slideUp('fast', function () {
var parentContainer = $(this).parent().parent();
$(this).remove();
self.getAllInputs(parentContainer);
})

$( document ).trigger( 'merchant-sortable-repeater-item-deleted' );
});

// Add new item
$('.customize-control-sortable-repeater-add').click(function (event) {
$( document ).on('click', '.customize-control-sortable-repeater-add', function(event) {
event.preventDefault();
self.appendRow($(this).parent());
self.getAllInputs($(this).parent());
});

// Refresh our hidden field if any fields change
$('.merchant-sortable-repeater.sortable').change(function () {
$(document).on( 'change', '.merchant-sortable-repeater.sortable', function() {
self.getAllInputs($(this).parent());
})

$('.merchant-sortable-repeater.sortable').on('focusout', '.repeater-input', function () {
$( document ).on('focusout', '.merchant-sortable-repeater.sortable .repeater-input', function() {
self.getAllInputs($(this).parent());
});
},
Expand All @@ -438,12 +449,30 @@
*
*/
appendRow: function ($element, defaultValue = '') {
var newRow = '<div class="repeater" style="display:none"><input type="text" value="' + defaultValue + '" class="repeater-input" /><span class="dashicons dashicons-menu"></span><a class="customize-control-sortable-repeater-delete" href="#"><span class="dashicons dashicons-no-alt"></span></a></div>';
const newRow = '<div class="repeater" style="display:none"><input type="text" value="' + defaultValue + '" class="repeater-input" /><span class="dashicons dashicons-menu"></span><a class="customize-control-sortable-repeater-delete" href="#"><span class="dashicons dashicons-no-alt"></span></a></div>';

$element.find('.sortable').append(newRow);
$element.find('.sortable').find('.repeater:last').slideDown('slow', function () {

const $newItem = $element.find('.sortable').find('.repeater:last');

$newItem.slideDown('slow', function () {
$(this).find('input').focus();
});

// Make Repeater fields sortable; Putting here works better with flexible content
this.makeFieldsSortable( $element.find('.sortable') );

$( document ).trigger( 'merchant-sortable-repeater-item-added', [ $newItem, $element.find('.sortable') ] );
},

makeFieldsSortable: function ( $sortableElement ) {
if ( ! $sortableElement.hasClass( 'disable-sorting' ) ) {
$sortableElement.sortable( {
update: function ( event, ui ) {
SortableRepeaterField.getAllInputs( $sortableElement.parent() );
}
} );
}
},

/**
Expand All @@ -464,6 +493,8 @@
$element.find('.merchant-sortable-repeater-input').val(JSON.stringify(inputValues));
// Important! Make sure to trigger change event so Customizer knows it has to save the field
$element.find('.merchant-sortable-repeater-input').trigger('change');

$element.find('.merchant-sortable-repeater-input').trigger('sortable.repeater.change');
}
}

Expand Down Expand Up @@ -990,8 +1021,8 @@
});
}).trigger('merchant.change');

$(document).on('merchant-admin-check-fields merchant-flexible-content-added keyup', function () {
$('.merchant-module-page-setting-field').each(function () {
$(document).on('merchant-admin-check-fields merchant-flexible-content-added change keyup', function () {
$(document).find('.merchant-module-page-setting-field').each(function () {
let $field = $(this);
if ($field.data('conditions')) {
let conditions = $field.data('conditions'),
Expand Down Expand Up @@ -1670,11 +1701,20 @@
$target = $('input[name="merchant[' + condition.field + '][]"],select[name="merchant[' + condition.field + '][]"]')
}

if (!$target.length) {
// Maybe the field is inside fields group
$target = $('.merchant-group-fields-container').find('.merchant-field-' + condition.field + ' input[name*="' + condition.field + '"],.merchant-field-' + condition.field + ' select[name*="' + condition.field + '"]');
}

let value = $target.val();
if ($target.attr('type') === 'checkbox' || $target.attr('type') === 'radio') {
if ($target.attr('type') === 'checkbox') {
value = $target.is(':checked');
}

if ($target.attr('type') === 'radio') {
value = $target.filter(':checked').val();
}

// check if the field is multiple checkbox
if ($target.attr('type') === 'checkbox' && $target.length > 1) {
value = [];
Expand Down
101 changes: 51 additions & 50 deletions assets/js/src/modules/real-time-search/real-time-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ merchant.modules = merchant.modules || {};
init: function () {

var self = this;
var fields = document.querySelectorAll('.woocommerce-product-search .wc-search-field, .widget_product_search .search-field, .wp-block-search .wp-block-search__input, .wc-block-product-search-field, .woocommerce-product-search .search-field, .w-search-form input');
var fields = document.querySelectorAll('.woocommerce-product-search .wc-search-field, .widget_product_search .search-field, .wp-block-search .wp-block-search__input, .wc-block-product-search-field, .woocommerce-product-search .search-field, .w-search-form input, .the7-search-form__input, input[type="search"]');

if (fields.length) {

Expand Down Expand Up @@ -47,69 +47,71 @@ merchant.modules = merchant.modules || {};

},

searchFormHandler: function (el) {

if (el.value.length < 3) {
searchFormHandler: function ( el ) {
if ( el.value.length < 3 ) {
return false;
}

var self = this,
term = el.value,
clist = el.classList,
type = clist.contains('wc-block-product-search-field') || clist.contains('wc-search-field') ? 'product' : 'post';

$.post(window.merchant.setting.ajax_url, {
action: 'ajax_search_callback',
nonce: window.merchant.setting.nonce,
type: type,
search_term: term,
posts_per_page: window.merchant.setting.ajax_search_results_amounth_per_search,
orderby: window.merchant.setting.ajax_search_results_order_by,
order: window.merchant.setting.ajax_search_results_order,
display_categories: window.merchant.setting.ajax_search_results_display_categories,
enable_search_by_sku: window.merchant.setting.ajax_search_results_enable_search_by_sku,
}, function (response) {

var wrapper = el.parentNode.getElementsByClassName('merchant-ajax-search-wrapper')[0];

if (typeof wrapper === 'undefined') {

wrapper = document.createElement('div');
wrapper.className = 'merchant-ajax-search-wrapper';
el.parentNode.append(wrapper);
el.parentNode.classList.add('merchant-ajax-search');

}
const self = this;
const term = el.value;
const clist = el.classList;
const type = clist.contains( 'wc-block-product-search-field' ) || clist.contains( 'wc-search-field' ) ? 'product' : 'post';

const {
ajax_search_results_amount_per_search: posts_per_page = 15,
ajax_search_results_order_by: orderby = 'title',
ajax_search_results_order: order = 'asc',
ajax_search_results_display_categories: display_categories = 0,
ajax_search_results_enable_search_by_sku: enable_search_by_sku = 0
} = window.merchant.setting.real_time_search || {};

$.ajax( {
url: window.merchant.setting.ajax_url,
method: 'POST',
data: {
action: 'ajax_search_callback',
nonce: window.merchant.setting.nonce,
type: type,
search_term: term,
posts_per_page,
orderby,
order,
display_categories,
enable_search_by_sku
},
success: function (response) {
let wrapper = el.parentNode.querySelector( '.merchant-ajax-search-wrapper' );

if ( ! wrapper ) {
wrapper = document.createElement( 'div' );
wrapper.className = 'merchant-ajax-search-wrapper';
el.parentNode.append( wrapper );
el.parentNode.classList.add( 'merchant-ajax-search' );
}

wrapper.innerHTML = response.output;
wrapper.innerHTML = response.output;

var products_wrapper = document.querySelector('.merchant-ajax-search-products');
const productsWrapper = document.querySelector( '.merchant-ajax-search-products' );

if (products_wrapper !== null && self.scrollbarVisible(products_wrapper)) {
products_wrapper.classList.add('has-scrollbar');
}
if ( productsWrapper && self.scrollbarVisible( productsWrapper ) ) {
productsWrapper.classList.add( 'has-scrollbar' );
}

if (self.elementIsOutOfScreenHorizontal(wrapper)) {
wrapper.classList.add('merchant-reverse');
if ( self.elementIsOutOfScreenHorizontal( wrapper ) ) {
wrapper.classList.add( 'merchant-reverse' );
}
}

});
} );
},

destroy: function () {

if ($('body').hasClass('wp-admin')) {
if ( document.body.classList.contains( 'wp-admin' ) ) {
return;
}

var wrappers = document.querySelectorAll('.merchant-ajax-search-wrapper');

if (wrappers.length) {
for (var i = 0; i < wrappers.length; i++) {
wrappers[i].remove();
}
}
const wrappers = document.querySelectorAll( '.merchant-ajax-search-wrapper' );

wrappers.forEach( wrapper => wrapper.remove() );
},

debounce: function (callback, wait) {
Expand All @@ -134,7 +136,6 @@ merchant.modules = merchant.modules || {};
var rect = el.getBoundingClientRect();
return rect.x + rect.width > window.innerWidth;
}

};

$(document).ready(function () {
Expand Down
Loading
Loading