Ecshop two times development--hot word search and display

Source: Internet
Author: User

1. Enter Upload->themes->degault->library->page_header.lbi to search for the following code

    {if $searchkeywords}         {$lang. Hot_search}:        {foreach from= $searchkeywords item=val}            <a href= "search.php?keywords={$val |escape: URL} ">{$val}</a>        {/foreach}    {/if}

2 replace the searched code with the code

         {$lang. Hot_search}:    {if $searchkeywords}        {foreach from= $searchkeywords item=val}            <a href= " search.php?keywords={$val |escape:url} ">{$val}</a>        {/foreach}{/if}//database ecs_keywords table Data         {if $ SearchEngine}                   {foreach from= $searchengine item=val}                            {foreach from= $val key=key item=v}                                     <a href= " search.php?keywords={$key |escape:url} ">{$key}</a>                            {/foreach}                   {/foreach}         {/if}

3. Go to upload->admin->searchengie_stats.php and copy the code.

    /* Time parameter */* TODO: Time needs to be changed */if (isset ($_post) &&!empty ($_post)) {$start _date = $_post[' star        T_date '];    $end _date = $_post[' end_date ');        } else {$start _date = local_date (' y-m-d ', Strtotime ('-1 week '));    $end _date = local_date (' y-m-d ');    }/*-------------------------------------*/*--integrated TRAFFIC/*-------------------------------------*/$max = 0; $general _xml = "<chart caption= ' $_lang[tab_keywords] ' shownames= ' 1 ' showvalues= ' 0 ' decimals= ' 0 ' numberprefix= ' out    Cnvbasefontsize= ' basefontsize= ' > ';            $sql = "Select keyword, count, searchengine".            "from". $ecs->table (' keywords ').    "WHERE date >= ' $start _date ' and date <= '". $end _date. "'";    if (Isset ($_post[' filter ')) {$sql. = ' and '. Db_create_in ($_post[' filter '), ' searchengine ');    } $res = $db->query ($sql);    $search = Array ();    $searchengine = Array ();    $keyword = Array (); while ($val = $db->fetchrow ($res)) {$keyword [$val [' keyword ']] = 1;    $searchengine [$val [' SearchEngine ']][$val [' keyword ']] = $val [' count ']; }


4. After you have copied the code into the upload->includes->lib_main.php after you find the Assign_template method, put the code you copied into the Assign_template

Note: The fourth step is that I have integrated the third code, so in the third part you can save yourself from writing.

The following code is the effect of putting the code I copied into the Assign_template method

function assign_template ($ctype = ", $catlist = Array ()) {Global $smarty;    $smarty->assign (' image_width ', $GLOBALS [' _cfg '] [' image_width ']);    $smarty->assign (' image_height ', $GLOBALS [' _cfg '] [' image_height ']);    $smarty->assign (' Points_name ', $GLOBALS [' _cfg '] [' integral_name ']);    $smarty->assign (' QQ ', explode (', ', $GLOBALS [' _cfg '] [' QQ ']));    $smarty->assign (' ww ', explode (', ', $GLOBALS [' _cfg '] [' ww ']));    $smarty->assign (' ym ', Explode (', ', $GLOBALS [' _cfg '] [' ym ']);    $smarty->assign (' MSN ', Explode (', ', $GLOBALS [' _cfg '] [' MSN ']);    $smarty->assign (' Skype ', explode (', ', $GLOBALS [' _cfg '] [' Skype ']);    $smarty->assign (' Stats_code ', $GLOBALS [' _cfg '] [' stats_code ']); $smarty->assign (' Copyright ', sprintf ($GLOBALS [' _lang '] [' copyright '], date (' Y '), $GLOBALS [' _cfg '] [' shop_name '])    );    $smarty->assign (' Shop_name ', $GLOBALS [' _cfg '] [' shop_name ']); $smarty->assign (' Service_email ', $globals[' _cfg ' [' service_email ']);    $smarty->assign (' Service_phone ', $GLOBALS [' _cfg '] [' service_phone ']);    $smarty->assign (' shop_address ', $GLOBALS [' _cfg '] [' shop_address ']);    $smarty->assign (' licensed ', License_info ());    $smarty->assign (' ecs_version ', version);    $smarty->assign (' Icp_number ', $GLOBALS [' _cfg '] [' icp_number ']);    $smarty->assign (' username ',!empty ($_session[' user_name '])? $_session[' user_name ']: ');    $smarty->assign (' Category_list ', cat_list (0, 0, True, 2, false));    $smarty->assign (' Catalog_list ', cat_list (0, 0, False, 1, false));  $smarty->assign (' Navigator_list ', Get_navigator ($ctype, $catlist)); Custom navigation Bar if (!empty ($GLOBALS [' _cfg '] [' search_keywords ']) {$searchkeywords = explode (', ', Trim ($GLOBALS [' _CF    G ' [' search_keywords ']));    } else {$searchkeywords = array ();    } $smarty->assign (' searchkeywords ', $searchkeywords); /* Time parameter */* TODO: Time needs to be changed */if (IsseT ($_post) &&!empty ($_post)) {$start _date = $_post[' start_date '];    $end _date = $_post[' end_date ');        } else {$start _date = local_date (' y-m-d ', Strtotime ('-1 week '));    $end _date = local_date (' y-m-d ');    }/*-------------------------------------*/*--integrated TRAFFIC/*-------------------------------------*/$max = 0; $general _xml = "<chart caption= ' $_lang[tab_keywords] ' shownames= ' 1 ' showvalues= ' 0 ' decimals= ' 0 ' numberprefix= ' O    Utcnvbasefontsize= ' basefontsize= ' > ';            $sql = "Select keyword, count, searchengine".            "from". $GLOBALS [' ECS ']->table (' keywords '). "WHERE date >= ' $start _date ' and date <= '". $end _date. "'    ORDER BY count Desc limit 5 ";    if (Isset ($_post[' filter ')) {$sql. = ' and '. Db_create_in ($_post[' filter '), ' searchengine ');    } $res = $GLOBALS [' db ']->query ($sql);    $search = Array ();    $searchengine = Array ();    $keyword = Array (); while ($vAl = $GLOBALS [' db ']->fetchrow ($res)) {$keyword [$val [' keyword ']] = 1;    $searchengine [$val [' SearchEngine ']][$val [' keyword ']] = $val [' count ']; } $smarty->assign ("SearchEngine", $searchengine);}

5. This completes the search.

The first case Demo:

Second Case Demo: (add directly from the background, the words you want to search)


Ecshop two times development--hot word search and display

Large-Scale Price Reduction
  • 59% Max. and 23% Avg.
  • Price Reduction for Core Products
  • Price Reduction in Multiple Regions
undefined. /
Connect with us on Discord
  • Secure, anonymous group chat without disturbance
  • Stay updated on campaigns, new products, and more
  • Support for all your questions
undefined. /
Free Tier
  • Start free from ECS to Big Data
  • Get Started in 3 Simple Steps
  • Try ECS t5 1C1G
undefined. /

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.