Plugin Directory

Changeset 3015788


Ignore:
Timestamp:
12/30/2023 03:58:48 PM (2 years ago)
Author:
simonefontana
Message:

Update plugin version 1.4

Location:
sf-autosuggest-product-search
Files:
45 added
6 edited

Legend:

Unmodified
Added
Removed
  • sf-autosuggest-product-search/trunk/README.txt

    r2997478 r3015788  
    55Requires PHP: 7.0
    66Tested up to: 6.4
    7 Stable tag: 1.3.2
     7Stable tag: 1.4
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.txt
     
    3434== Frequently asked questions ==
    3535
     36=How can I view the search input on the site?=
     37You can use the shortcode [sf_pa_search] or use "Sf Search" gutenberg block
     38
    3639=Can I show the product thumbnail in search suggests?=
    3740Yes, you have to flag "Show Thumbnails" option in settings page.
     
    5659== Changelog ==
    5760
     61= 1.4 =
     62* Added message "Nothing Found"
     63* Restyling Admin Area
     64* Add Gutenber "Sf Search" Block
    5865
    5966= 1.3.2 =
  • sf-autosuggest-product-search/trunk/assets/css/sf_pa_admin.css

    r2870187 r3015788  
    3737    text-align: center;
    3838    font-size: 26px;
    39     margin-bottom: 50px;
     39    padding-bottom: 50px;
     40    margin-top: 0;
     41    padding-top: 30px;
     42    background-color: #10e89f;
     43}
     44
     45.sf_pa-be-container input {
     46    border-radius: 10px !important;
     47    text-align: center;
     48}
     49
     50.sf_pa-be-container input[type="submit"] {
     51    background: #10e89f !important;
     52    border-color: #10e89f !important;
     53    padding: 2px 40px;
     54    font-weight: bold;
     55    color: #0a0a0a;
     56    margin-top: 30px;
     57    border-radius: 20px !important;
    4058}
    4159
  • sf-autosuggest-product-search/trunk/assets/js/sf_pa.js

    r2911702 r3015788  
    2020                    hideLoader();
    2121                    jQuery(input_container).append('<div class="sf_pa_autosuggest_container"></div>');
    22                     for (var i = 0; i < response.length; ++i) {
    23                         var to_append = '<div class="sf_pa_autosuggest_response"><div>';
    24                        
    25                         //Product Image
    26                         if(response[i].show_thumbnail == 'on' && response[i].type == 'product'){
    27                             to_append += '<div><img style="width:50px; height: auto;" src="'+response[i].img_url+'"></div>';
     22                    if(response.length > 0){
     23                        for (var i = 0; i < response.length; ++i) {
     24                            var to_append = '<div class="sf_pa_autosuggest_response"><div>';
     25                           
     26                            //Product Image
     27                            if(response[i].show_thumbnail == 'on' && response[i].type == 'product'){
     28                                to_append += '<div><img style="width:50px; height: auto;" src="'+response[i].img_url+'"></div>';
     29                            }
     30                            //Title and Link
     31                            to_append += '<div><div class="sf_pa_autosuggest_title"><a href="'+response[i].link+'">'+response[i].title+'</a>';
     32                            //Category title
     33                            if(response[i].show_cat == 'on' && response[i].type == 'product'){
     34                                to_append += '<p>'+response[i].cat_title+'</p>';
     35                            }
     36                            to_append += '</div></div>';
     37                           
     38                            jQuery('.sf_pa_autosuggest_container').append(to_append);
    2839                        }
    29                         //Title and Link
    30                         to_append += '<div><div class="sf_pa_autosuggest_title"><a href="'+response[i].link+'">'+response[i].title+'</a>';
    31                         //Category title
    32                         if(response[i].show_cat == 'on' && response[i].type == 'product'){
    33                             to_append += '<p>'+response[i].cat_title+'</p>';
    34                         }
    35                         to_append += '</div></div>';
    36                        
    37                         jQuery('.sf_pa_autosuggest_container').append(to_append);
    3840                    }
     41                    else{
     42                        jQuery('.sf_pa_autosuggest_container').append('<p>'+sf_pa_ajax_object.not_found+'</p>');
     43                    }
     44                   
    3945                    jQuery('.sf_pa_autosuggest_container').append('<div class="sf_pa_autosuggest_all_res">'+sf_pa_ajax_object.show_results+'</div>');
    4046                });
  • sf-autosuggest-product-search/trunk/classes/AdminClass.php

    r2911702 r3015788  
    66        add_action( 'admin_menu', [$this, 'add_settings_page'] );
    77        add_action( 'wp_ajax_delete_sf_pa_transient', [$this, 'delete_sf_pa_transient'] );
     8        add_action( 'init', [$this, 'create_block_sf_search_block'] );
    89   }
    910
     
    8485                            ),
    8586                            array(
     87                                'title' => __('Text "Nothing Found"', 'sf_products_autosuggest'),
     88                                'section' => 'sf_pa_apparance',
     89                                'key' => 'not_found',
     90                                'input' => 'text_input',
     91                                'instruction' => __('Text of the element "Nothing Found"', 'sf_products_autosuggest')
     92                            ),
     93                            array(
    8694                                'title' => __('Show thumbnails', 'sf_products_autosuggest'),
    8795                                'section' => 'sf_pa_apparance',
     
    198206        $newinput['all_bg'] =  $validator->hexadecimal($input['all_bg'], '#000');
    199207        $newinput['all_color'] =  $validator->hexadecimal($input['all_color'], '#fff');
     208        $newinput['not_found'] =  $validator->plaintext($input['not_found']);
    200209        if(isset($input['show_thumbnail']) && !empty($input['show_thumbnail'])){
    201210            $newinput['show_thumbnail'] = $validator->checkbox($input['show_thumbnail']);
     
    235244        return 1;
    236245    }
     246
     247    function create_block_sf_search_block() {
     248        register_block_type( dirname(__FILE__) . '/../build' );
     249    }
     250
    237251}
    238252new AdminClass();
  • sf-autosuggest-product-search/trunk/sf_products_autosuggest.php

    r2972184 r3015788  
    44* Plugin URI: https://www.your-site.com/
    55* Description: Autosuggest Product Search for Woocommerce
    6 * Version: 1.3.2
     6* Version: 1.4
    77* Author: Simone Fontana
    88* Author URI: https://www.simonefontana.net/
    99* WC requires at least: 3.0.0
    10 * WC tested up to: 8.1.0
     10* WC tested up to: 8.4.0
    1111**/
    1212
    13 const SF_VERSION = "1.3.2";
     13const SF_VERSION = "1.4";
    1414
    1515
     
    2020    $options = get_option( 'sf_pa_autosuggest_plugin_options' );
    2121    $all_text = __('Show all results', 'sf_products_autosuggest');
     22    $not_found = __('Nothing found', 'sf_products_autosuggest');
    2223    if(isset($options['all_text']) && !empty($options['all_text'])){
    2324        $all_text = $options['all_text'];
    24     }   
    25     wp_localize_script( 'sf_pa-js', 'sf_pa_ajax_object', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'show_results' => esc_attr($all_text) ));
     25    }
     26    if(isset($options['not_found']) && !empty($options['not_found'])){
     27        $not_found = $options['not_found'];
     28    }     
     29    wp_localize_script( 'sf_pa-js', 'sf_pa_ajax_object', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'show_results' => esc_attr($all_text), 'not_found' => esc_attr($not_found) ));
    2630}
    2731add_action( 'wp_enqueue_scripts', 'add_sf_pa_scripts' );
     
    6266                <form method="get" role="search" action="'.get_site_url().'">
    6367                    <input type="search" id="sf_pa_search_input" class="search-field" placeholder="'.esc_attr($placeholder).'" value="" name="s">
    64                     <img class="sf_pa_loader" src="'.plugins_url().'/sf-autosuggest-product-search/assets/img/loading.gif">
     68                    <img class="sf_pa_loader" src="'.untrailingslashit( plugin_dir_url( __FILE__ ) ).'/assets/img/loading.gif">
    6569                    <input type="submit">
    6670                </form>
Note: See TracChangeset for help on using the changeset viewer.