Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Custom Search Redirects

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 07-06-2007, 04:10 PM
 
UPRJon UPRJon is offline
 

Advanced Member
  
Join Date: Apr 2006
Posts: 50
 

Default Custom Search Redirects

Basically this will allow you to customize where a search word goes on your site.

If someone searches for "Free Ground Shipping", you can redirect them them to a custom page if you wanted.

In /include/search.php:

FIND:

Code:
# # Update the session $search_data variable from $posted_data # if (!empty($posted_data)) { $need_advanced_options = false; foreach ($posted_data as $k=>$v) { if (!is_array($v) && !is_numeric($v)) $posted_data[$k] = stripslashes($v); if (in_array($k, $advanced_options) && $v !== "") $need_advanced_options = true; } # Update the search statistics if ($posted_data["substring"]) { db_query("INSERT INTO $sql_tbl[stats_search] (search, date) VALUES ('".addslashes($posted_data["substring"])."', '".time()."')"); }

AFTER, ADD:

Code:
$surprise_array = array( array("keyword" => "help me for the love of god", "url" => "home.php"), array("keyword" => "charlie the unicorn", "url" => "pages.php?pageid=5"), array("keyword" => "gift certificate", "url" => "product.php?id=16") , array("keyword" => "free shipping", "url" => "pages.php?pageid=5") ); $i=0; foreach ($surprise_array as $k) { if (strtolower($posted_data["substring"]) == $surprise_array[$i]["keyword"]) { $url_go = $surprise_array[$i]["url"]; } $i++; } if($url_go){ func_header_location($url_go); }

Basically add or change the "keyword" and "url" in the $surprise_array.

Tested in 4.1.7
__________________
www.upr.com
Xcart: 4.1.7
MySQL: 4.1.21-standard
PHP: 4.4.6
Unix Apache: 1.3.37
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:10 AM.

   

 
X-Cart forums © 2001-2020