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

V4 - auto search using vars in url

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #41  
Old 05-11-2006, 06:11 AM
 
dgreen dgreen is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 85
 

Default using 4.1 code in 4.0

Would I be able to put this code into 4.0.13 and if so, where would I put it and how would I use it?
__________________
X-Cart version 4.1.10
upgraded from 4.0.13 myself slowly and with help from xcart forums. Thanks all!

http://www.discountseforim.com
Hebrew Seforim and Jewish Books
Reply With Quote
  #42  
Old 08-08-2006, 05:25 AM
  carlisleglass's Avatar 
carlisleglass carlisleglass is offline
 

eXpert
  
Join Date: Aug 2003
Location: Carlisle, UK
Posts: 316
 

Default

Here's the URL format in v4.1.x (no need for any code modification)

Code:
https://www.cglass.co.uk/search.php?mode=search&substring=bosch
__________________
Darren Kierman
Carlisle Glass (http://www.carlisleglass.co.uk/)
... running X-Cart Gold 4.4.5 [unix]
Reply With Quote
  #43  
Old 12-29-2006, 11:22 AM
 
nfc5382 nfc5382 is offline
 

X-Adept
  
Join Date: Nov 2002
Posts: 477
 

Default Re: V4 - auto search using vars in url

Quote:
Originally Posted by intel352
4.1 already has the functionality, was looking at the code this morning, it crafts a "GET" url when search results are accessed. my assumption is it then redirects to that url or maybe provides a link in the content saying "link to these search results"

[/code]


I added the following with the BCSE free mod and that from 4.1:

BCSE mod: http://forum.x-cart.com/showthread.php?t=18488

search.php
Code:
x_session_register("search_data"); # BCSE begin if($search) { $search_data['products']['substring']=$search; $mode="search"; } # BCSE end if (!empty($search_data["products"])) { # only show fields we really care about $allowable_search_fields = array( "substring", "sort_field", "sort_direction" ); $search_url_args = array(); # from 4.1 foreach ($search_data["products"] as $k=>$v) { if (in_array($k, $allowable_search_fields) && !empty($v)) { if (is_array($v)) { foreach ($v as $k1=>$v1) $search_url_args[] = $k."[".$k1."]=".urlencode($v1); } else { $search_url_args[] = "$k=".urlencode($v); } } } # show page if needed if ($search_url_args && $page > 1) $search_url_args[] = "page=$page"; $search_url = "search.php?mode=search".(!empty($search_url_args) ? "&".implode("&", $search_url_args) : ""); $smarty->assign("search_url", $search_url); }

customer/main/search_results.tpl

paste this where you want the link to display:
Code:
<DIV align="right"><A href={$search_url}>This page URL</A></DIV>
__________________
-----------------------
x-cart v4.7.6 [LIVE]
x-cart v4.0.18 [retired 2004-2016]
x-cart v3.5.13 [retired]
x-cart v3.4.14 [retired]
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 01:33 PM.

   

 
X-Cart forums © 2001-2020