Plugin Directory

Changeset 3027301


Ignore:
Timestamp:
01/26/2024 10:38:32 AM (2 years ago)
Author:
simonefontana
Message:

Update plugin version 1.5

Location:
sf-autosuggest-product-search
Files:
41 added
8 edited

Legend:

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

    r3021136 r3027301  
    55Requires PHP: 7.0
    66Tested up to: 6.4
    7 Stable tag: 1.4.1
     7Stable tag: 1.5
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.txt
     
    5858
    5959== Changelog ==
     60= 1.5 =
     61* Add price in search results
     62* Add uninstall functionality
     63
    6064= 1.4.1 =
    6165* Change Prefix Class for more compatibility
  • sf-autosuggest-product-search/trunk/assets/js/sf_pa.js

    r3015788 r3027301  
    3333                            if(response[i].show_cat == 'on' && response[i].type == 'product'){
    3434                                to_append += '<p>'+response[i].cat_title+'</p>';
     35                            }
     36                            //Category title
     37                            if(response[i].show_price == 'on' && response[i].type == 'product'){
     38                                to_append += '<p>'+response[i].price+'</p>';
    3539                            }
    3640                            to_append += '</div></div>';
  • sf-autosuggest-product-search/trunk/assets/js/sf_pa_admin.js

    r2911702 r3027301  
    22    $('.sf_pa_color_picker').wpColorPicker();
    33    $('#sf_remove_transient').on('click', function(){
    4         /* TODO: fare ajax per cancellazione transients */
     4        /* TODO: ajax to delete transients */
    55        var data = {
    66            'action': 'delete_sf_pa_transient'
  • sf-autosuggest-product-search/trunk/classes/AdminClass.php

    r3021136 r3027301  
    11<?php
     2
     3if ( ! defined( 'ABSPATH' ) ) {
     4    exit;
     5}
    26
    37class SFPA_AdminClass {
     
    106110                            ),
    107111                            array(
     112                                'title' => __('Show Price', 'sf_products_autosuggest'),
     113                                'section' => 'sf_pa_apparance',
     114                                'key' => 'show_price',
     115                                'input' => 'checkbox',
     116                                'instruction' => __('Check if you want to show product price in results', 'sf_products_autosuggest')
     117                            ),
     118                            array(
    108119                                'title' => __('Exclude categories from search', 'sf_products_autosuggest'),
    109120                                'section' => 'sf_pa_apparance',
     
    213224            $newinput['show_cat'] = $validator->checkbox($input['show_cat']);
    214225        }
     226        if(isset($input['show_price']) && !empty($input['show_price'])){
     227            $newinput['show_price'] = $validator->checkbox($input['show_price']);
     228        }
    215229        $newinput['exclude_cat'] = $validator->ids($input['exclude_cat']);
    216230        $newinput['exclude_ids'] =  $validator->ids($input['exclude_ids']);
  • sf-autosuggest-product-search/trunk/classes/FeedbackClass.php

    r3021136 r3027301  
    11<?php
     2
     3if ( ! defined( 'ABSPATH' ) ) {
     4    exit;
     5}
     6
    27
    38class SFPA_FeedbackClass {
  • sf-autosuggest-product-search/trunk/classes/SearchClass.php

    r3021136 r3027301  
    11<?php
     2
     3if ( ! defined( 'ABSPATH' ) ) {
     4    exit;
     5}
     6
    27class SFPA_SearchClass {
    38    private $options;
     
    611        $content_url = wp_upload_dir();
    712        $this->options = get_option( 'sf_pa_autosuggest_plugin_options' );
     13        if(!isset($this->options['show_cat'])){
     14            $this->options['show_cat'] = 0;
     15        }
     16        if(!isset($this->options['show_thumbnail'])){
     17            $this->options['show_thumbnail'] = 0;
     18        }
     19        if(!isset($this->options['show_price'])){
     20            $this->options['show_price'] = 0;
     21        }
    822        $this->count = 6;
    923        $this->content_url = $content_url['baseurl'];
     
    1832        if(!$results){
    1933
    20             $prepare =  array($this->options['show_cat'], $this->options['show_thumbnail'], '%' . $wpdb->esc_like($sf_pa_search) .'%');
     34            $prepare =  array($this->options['show_cat'], $this->options['show_thumbnail'], $this->options['show_price'], '%' . $wpdb->esc_like($sf_pa_search) .'%');
    2135            $join = '';
    2236            $where = '';
     
    3044            }
    3145
    32             $sql = "SELECT ".$wpdb->prefix."posts.ID, ".$wpdb->prefix."posts.post_title as title, img_postmeta.meta_value as img_url,  ".$wpdb->prefix."terms.name as cat_title, %s as show_cat, %s as show_thumbnail, 'product' AS type
     46            // TODO: Join only if entity checkbox is true
     47            $sql = "SELECT ".$wpdb->prefix."posts.ID, ".$wpdb->prefix."posts.post_title as title, img_postmeta.meta_value as img_url, price_postmeta.meta_value as price,  ".$wpdb->prefix."terms.name as cat_title, %s as show_cat, %s as show_thumbnail, %s as show_price, 'product' AS type
    3348                    FROM ".$wpdb->prefix."posts
    3449                    LEFT JOIN ".$wpdb->prefix."postmeta ON ".$wpdb->prefix."postmeta.post_id =  ".$wpdb->prefix."posts.ID AND ".$wpdb->prefix."postmeta.meta_key = '_thumbnail_id'
    3550                    LEFT JOIN ".$wpdb->prefix."postmeta as img_postmeta ON img_postmeta.post_id =  ".$wpdb->prefix."postmeta.meta_value AND img_postmeta.meta_key = '_wp_attachment_metadata'
     51                    LEFT JOIN ".$wpdb->prefix."postmeta as price_postmeta ON price_postmeta.post_id =  ".$wpdb->prefix."posts.ID AND price_postmeta.meta_key = '_price'
    3652                    LEFT JOIN ".$wpdb->prefix."term_relationships ON ".$wpdb->prefix."term_relationships.object_id = ".$wpdb->prefix."posts.ID
    3753                    LEFT JOIN ".$wpdb->prefix."terms ON ".$wpdb->prefix."terms.term_id = ".$wpdb->prefix."term_relationships.term_taxonomy_id
     
    6682                $single_prod->cat_title = esc_html($single_prod->cat_title);
    6783                $single_prod->link = esc_url($this->build_link($single_prod->type, $single_prod->ID));
     84                $single_prod->price = number_format((float)esc_html($single_prod->price), 2, '.', '').' '.get_woocommerce_currency_symbol();
    6885                $this->results[] = $single_prod;
    6986            }
    7087
    7188            foreach($results_cat as $single_cat){
    72                 $single_cat->name = esc_html($single_cat->name);
     89                $single_cat->name = esc_html($single_cat->title);
    7390                $single_cat->link = esc_url($this->build_link($single_cat->type, false, $single_cat->taxonomy,$single_cat->slug ));
    7491                $this->results[] = $single_cat;
  • sf-autosuggest-product-search/trunk/classes/ValidatorClass.php

    r3021136 r3027301  
    11<?php
     2
     3if ( ! defined( 'ABSPATH' ) ) {
     4    exit;
     5}
    26
    37class SFPA_ValidatorClass{
  • sf-autosuggest-product-search/trunk/sf_products_autosuggest.php

    r3021136 r3027301  
    33* Plugin Name: SF Autosuggest Product Search
    44* Description: Autosuggest Product Search for Woocommerce
    5 * Version: 1.4.1
     5* Version: 1.5
    66* Author: Simone Fontana
    77* Author URI: https://www.simonefontana.net/
    88* WC requires at least: 3.0.0
    9 * WC tested up to: 8.4.0
     9* WC tested up to: 8.5
    1010**/
    1111
    12 const SF_VERSION = "1.4.1";
     12if ( ! defined( 'ABSPATH' ) ) {
     13    exit;
     14}
    1315
     16const SF_VERSION = "1.5";
    1417
    1518/* Add style and script to plugin*/
     
    4750}
    4851
    49 function sf_pa_input_search_shortcode( $attributi ){
     52function sf_pa_input_search_shortcode( $attrs ){
    5053    $options = get_option( 'sf_pa_autosuggest_plugin_options' );
    5154    $all_bg = '#000';
Note: See TracChangeset for help on using the changeset viewer.