Plugin Directory

Changeset 2000371


Ignore:
Timestamp:
12/22/2018 05:39:13 PM (7 years ago)
Author:
RPG84
Message:

4.6.49

  • You can now use or while searching for items in item select example: beach or resort
  • You can now use and while searching for items in item select example: beach and resort
Location:
tradetracker-store
Files:
71 added
3 edited

Legend:

Unmodified
Added
Removed
  • tradetracker-store/trunk/Tradetracker-Store.php

    r2000173 r2000371  
    33* Plugin Name: Tradetracker-Store
    44* Plugin URI: http://wpaffiliatefeed.com
    5 * Version: 4.6.48
     5* Version: 4.6.49
    66* Description: A Plugin that will add a TradeTracker affiliate feed to your site with several options to choose from.
    77* Author: Robert Braam
  • tradetracker-store/trunk/menu/itemselect.php

    r2000173 r2000371  
    218218    if(isset($_GET['search']) && $_GET['search'] !=""){
    219219        $keyword = $_GET['search'];
    220             if($_GET['title']=='yes'){
    221         $searchtitle = "and CONVERT(`name` USING utf8) LIKE '%$keyword%'";
     220       
     221            if(preg_match("/\bor\b/i", $keyword, $matches1)){
     222    list($a, $b) = explode(' or ', $keyword);
     223        $keywordor = "1";
     224    }
     225        if(preg_match("/\band\b/i", $keyword, $matches1)){
     226    list($a, $b) = explode(' and ', $keyword);
     227        $keywordand = "1";
     228    }
     229    if($_GET['title']=='yes'){
     230        if($keywordor=="1"){
     231            $searchtitle = "CONVERT(`name` USING utf8) LIKE '%$a%' or CONVERT(`name` USING utf8) LIKE '%$b%'";
     232        } else if ($keywordand=="1"){
     233            $searchtitle = "(CONVERT(`name` USING utf8) LIKE '%$a%' and CONVERT(`name` USING utf8) LIKE '%$b%')";
     234        } else {
     235            $searchtitle = "CONVERT(`name` USING utf8) LIKE '%$keyword%'";
     236        }
    222237    }
    223238    if($_GET['description']=='yes'){
    224         if(isset($searchtitle)){
    225             $searchdescription = "or CONVERT(`description` USING utf8) LIKE '%$keyword%'";
     239        if($keywordor=="1"){
     240            if(isset($searchtitle)){
     241                $searchdescription = "or CONVERT(`description` USING utf8) LIKE '%$a%' or CONVERT(`name` USING utf8) LIKE '%$b%'";
     242            } else {
     243                $searchdescription = "CONVERT(`description` USING utf8) LIKE '%$a%' or CONVERT(`name` USING utf8) LIKE '%$b%'";
     244            }
     245        } else if ($keywordand=="1"){
     246            if(isset($searchtitle)){
     247                $searchdescription = "or (CONVERT(`description` USING utf8) LIKE '%$a%' and CONVERT(`name` USING utf8) LIKE '%$b%')";
     248            } else {
     249                $searchdescription = "CONVERT(`description` USING utf8) LIKE '%$a%' and CONVERT(`name` USING utf8) LIKE '%$b%'";
     250            }
    226251        } else {
    227             $searchdescription = "and CONVERT(`description` USING utf8) LIKE '%$keyword%'";
     252            if(isset($searchtitle)){
     253                $searchdescription = "or CONVERT(`description` USING utf8) LIKE '%$keyword%'";
     254            } else {
     255                $searchdescription = "CONVERT(`description` USING utf8) LIKE '%$keyword%'";
     256            }
    228257        }
    229258    }
    230259        $searchlink = "&search=".$keyword;
    231         $countquery=$wpdb->get_row("SELECT COUNT(DISTINCT ".$ttstoretable.".productID) as cnt FROM (".$ttstoretable.", ".$ttstorecattable.") where ".$ttstorecattable.".productID = ".$ttstoretable.".productID $searchtitle $searchdescription ".$searchcategorieselect." ".$searchxmlfeed." ");
     260        $countquery=$wpdb->get_row("SELECT COUNT(DISTINCT ".$ttstoretable.".productID) as cnt FROM (".$ttstoretable.", ".$ttstorecattable.") where ".$ttstorecattable.".productID = ".$ttstoretable.".productID and ($searchtitle $searchdescription) ".$searchcategorieselect." ".$searchxmlfeed." ");
    232261    } else {
    233262        $searchlink = "";
     
    414443if(isset($_GET['search']) && $_GET['search']!=""){
    415444    $keyword = $_GET['search'];
     445    if(preg_match("/\bor\b/i", $keyword, $matches1)){
     446    list($a, $b) = explode(' or ', $keyword);
     447        $keywordor = "1";
     448    }
     449        if(preg_match("/\band\b/i", $keyword, $matches1)){
     450    list($a, $b) = explode(' and ', $keyword);
     451        $keywordand = "1";
     452    }
    416453    if($_GET['title']=='yes'){
    417         $searchtitle = "CONVERT(`name` USING utf8) LIKE '%$keyword%'";
     454        if($keywordor=="1"){
     455            $searchtitle = "CONVERT(`name` USING utf8) LIKE '%$a%' or CONVERT(`name` USING utf8) LIKE '%$b%'";
     456        } else if ($keywordand=="1"){
     457            $searchtitle = "(CONVERT(`name` USING utf8) LIKE '%$a%' and CONVERT(`name` USING utf8) LIKE '%$b%')";
     458        } else {
     459            $searchtitle = "CONVERT(`name` USING utf8) LIKE '%$keyword%'";
     460        }
    418461    }
    419462    if($_GET['description']=='yes'){
    420         if(isset($searchtitle)){
    421             $searchdescription = "or CONVERT(`description` USING utf8) LIKE '%$keyword%'";
     463        if($keywordor=="1"){
     464            if(isset($searchtitle)){
     465                $searchdescription = "or CONVERT(`description` USING utf8) LIKE '%$a%' or CONVERT(`name` USING utf8) LIKE '%$b%'";
     466            } else {
     467                $searchdescription = "CONVERT(`description` USING utf8) LIKE '%$a%' or CONVERT(`name` USING utf8) LIKE '%$b%'";
     468            }
     469        } else if ($keywordand=="1"){
     470            if(isset($searchtitle)){
     471                $searchdescription = "or (CONVERT(`description` USING utf8) LIKE '%$a%' and CONVERT(`name` USING utf8) LIKE '%$b%')";
     472            } else {
     473                $searchdescription = "CONVERT(`description` USING utf8) LIKE '%$a%' and CONVERT(`name` USING utf8) LIKE '%$b%'";
     474            }
    422475        } else {
    423             $searchdescription = "CONVERT(`description` USING utf8) LIKE '%$keyword%'";
     476            if(isset($searchtitle)){
     477                $searchdescription = "or CONVERT(`description` USING utf8) LIKE '%$keyword%'";
     478            } else {
     479                $searchdescription = "CONVERT(`description` USING utf8) LIKE '%$keyword%'";
     480            }
    424481        }
    425482    }
  • tradetracker-store/trunk/readme.txt

    r2000173 r2000371  
    55Requires at least: 4
    66Tested up to: 5.0.2
    7 Stable tag: 4.6.48
     7Stable tag: 4.6.49
    88
    99A plugin that lets you import an XML productfeed from TradeTracker.
     
    4242
    4343== Changelog ==
     44= 4.6.49 =
     45- You can now use or while searching for items in item select example: beach or resort
     46- You can now use and while searching for items in item select example: beach and resort
     47
    4448= 4.6.48 =
    4549- Removed the search in extra fields in item select, mainly because it causes too much issues.
Note: See TracChangeset for help on using the changeset viewer.