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

Search Upgrade

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #31  
Old 07-25-2003, 02:26 PM
 
machnhed1 machnhed1 is offline
 

eXpert
  
Join Date: Feb 2003
Location: Illinois
Posts: 274
 

Default

Partly, if you could post the contents of the table (along with the headings) it would help. If you don't want that on the boards, pm me it in a CSV file and I can look on my own machine.
__________________
Following the signature guidelines : xcart pro 3.5.8 - [RedHat]
Reply With Quote
  #32  
Old 07-25-2003, 02:57 PM
 
Cameron Cameron is offline
 

eXpert
  
Join Date: Jan 2003
Location: Washington State, USA
Posts: 224
 

Default

This is crazy. I got an e-mail that you PM'd me, but the PM isn't in my inbox. I then PM'd you 3 times, but none of them show in my sent items. Can you e-mail me your e-mail address? I'm at cameron@cameron32.com
Reply With Quote
  #33  
Old 07-26-2003, 01:59 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

If you use the code that I posted on earlier on this thread for categories.php and use the following for advanced search - it works.

Code:
{* $Id: advanced_search.tpl,v 1.3 2002/10/08 12:01:17 alfiya Exp $ *} {include file="location.tpl" last_location=$lng.lbl_advanced_search} {capture name=adv_search} <table border=0> <form action="search.php" name="productsearchbyprice_form"> <tr> <td>{$lng.lbl_product_title}</td> <td> <input type="text" name="substring" size="30" value="{$smarty.get.substring}"> </td> </tr> <tr><td>{$lng.lbl_price}, {$config.General.currency_symbol}</td> <td><input type="text" name="price_search_1" size="6" value="{$smarty.get.price_search_1|escape}"> - <input type="text" name="price_search_2" size="6" value="{$smarty.get.price_search_2|escape}"></td></tr> <tr><td>{$lng.lbl_category}</td> <td> <select name="in_category"> <option value="">All</option> {section name=cat_num loop=$categories} <option value="{ $categories[cat_num].categoryid}">{ $categories[cat_num].category|escape }</option> {section name=cat_num1 loop=$allcategories} {if $allcategories[cat_num1].topcat eq $categories[cat_num].category_name} <option value="{ $allcategories[cat_num1].categoryid}">- { $allcategories[cat_num1].category_name|escape }</option> {/if} {/section} {/section} </select> </td> </tr> <tr><td></td></tr> <tr><th>{include file="buttons/search.tpl"}</th></tr> </form> </table> {/capture} {include file="dialog.tpl" title=$lng.lbl_advanced_search content=$smarty.capture.adv_search extra="width=100%"}
__________________
ex x-cart guru
Reply With Quote
  #34  
Old 07-26-2003, 09:03 AM
 
Cameron Cameron is offline
 

eXpert
  
Join Date: Jan 2003
Location: Washington State, USA
Posts: 224
 

Default

Unfortunately, I'm still on 3.3.5 so I can't use your categories.php -- What seems so odd is that it was mostly working, but it was only displaying the first 5 second level categories instead of all of them, but I can't see what in either categories.php or advanced_search.tpl is making that happen.
Reply With Quote
  #35  
Old 07-26-2003, 09:19 AM
 
Cameron Cameron is offline
 

eXpert
  
Join Date: Jan 2003
Location: Washington State, USA
Posts: 224
 

Default

I got it!!! Funky, I was looking at the advanced_search.tpl code you had and decided to try using $allcategories for the second level categories.

Machnhed1, I had replaced the whole drop down code with the $allcategories code that you had me put in before instead of only the 2nd level part. If I messed up there and was supposed to do it for just the 2nd level section, I apologize profusely for wasting your time.

Thank you both for helping me work this out!!!!!!!

So, for those who have made it this far through this thread and are using 3.3.x , here is what you need to do:

Store/include/categories.php
Before the lines for # Assign Smarty variables, add this code:
Quote:
#
# Mod: Get all main categories and level 1 subcatgories and store them in an array
#
$categories_data1 = func_query("select * from $sql_tbl[categories] where category NOT LIKE '%/%' and avail='Y' group by $sql_tbl[categories].categoryid order by order_by");

foreach ($categories_data1 as $key=>$value) {
$categories_data2[$key][] = func_query("select $sql_tbl[categories].*, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', -1) as category_name from $sql_tbl[categories] where category LIKE '".$value[category]."/%' and category NOT LIKE '".$value[category]."/%/%' and avail='Y' group by $sql_tbl[categories].categoryid order by order_by");
}
at the end of the file, add these lines:
Quote:
$smarty->assign("categories_level_1",$categories_data1);
$smarty->assign("categories_level_2",$categories_data2);
/store/skin1/customer/main/advanced_search.tpl
replace <select name="in_category">
<option value="">All</option>
{section name=cat_num loop=$categories}
<option value="{ $categories[cat_num].categoryid}" {if $smarty.get.in_category eq $categories[cat_num].categoryid or $cat eq $categories[cat_num].categoryid}selected{/if}>{$categories[cat_num].category|escape}</option>
{/section}
</select>

with this:
Quote:
<select name="in_category">
<option value="">All</option>
{section name=cat_num loop=$categories_level_1}
<option value="{ $categories_level_1[cat_num].categoryid}" {if $smarty.get.in_category eq $categories_level_1[cat_num].categoryid or $cat eq $categories_level_1[cat_num].categoryid}selected{/if}>
{$categories_level_1[cat_num].category|escape}
</option>

{section name=cat_num1 loop=$allcategories}
{if $categories_level_2[cat_num][0][cat_num1].categoryid ne ""}<option value="{ $categories_level_2[cat_num][0][cat_num1].categoryid}" {if $smarty.get.in_category eq $categories_level_2[cat_num][0][cat_num1].categoryid or $cat eq $categories_level_2[cat_num][0][cat_num1].categoryid}selected{/if}>
{$categories_level_2[cat_num][0][cat_num1].category_name|escape}
</option>{/if}
{/section}

{/section}
</select>
Reply With Quote
  #36  
Old 07-26-2003, 09:38 AM
 
Cameron Cameron is offline
 

eXpert
  
Join Date: Jan 2003
Location: Washington State, USA
Posts: 224
 

Default

Oops...I just hit another snag here. The search function, even though it is now showing all 2nd level categories is ONLY showing results within a category that has products in it as a "main category" The "category #1 #2 #3 & #4" assignments that you can make in the back office to have a product display in other categories aren't being searched.

As an example: Jogging Strollers has about 16 products in it when you browse directly to the category. However, all of those products are assigned to that category as "Category #3" and when I search Jogging Strollers for *anything* no results appear.

I am willing to pay for the solution to this so that the search will show results from my second level categories, even if the products in them aren't put in as the "main category" without creating a ton of duplicate searches when somebody doesn't drill down to a sub category.

Funky or anybody who can do this, please PM me with a quote. Wait, x-cart PM is being weird. Please *e-mail* me: cameron@cameron32.com

Thanks,
Cameron
Reply With Quote
  #37  
Old 07-27-2003, 09:41 AM
 
Mad Mad is offline
 

Advanced Member
  
Join Date: Jul 2003
Location: Brooklyn, NY
Posts: 60
 

Default

Used information within to make subcatagories to be listed at all times on the left side's catagory section. Great post, thank you!
Reply With Quote
  #38  
Old 11-16-2005, 03:38 PM
 
technicaldata technicaldata is offline
 

Advanced Member
  
Join Date: Feb 2005
Posts: 32
 

Default X-Cart 4.0.17?

Does anyone have a version of this mod that will work with X-Cart Pro 4.0.17?
__________________
X-Cart Version 4.0.17
Red Hat Enterprise Linux Host
Windows XP Pro running XAMPP Dev Platform
X-RMA 4.0.17
X-AOM 4.0.17
X-Configurator 4.0.17
Reply With Quote
  #39  
Old 11-16-2005, 03:41 PM
 
technicaldata technicaldata is offline
 

Advanced Member
  
Join Date: Feb 2005
Posts: 32
 

Default P.S.

I started a new thread for this for 4.0.x users:

http://forum.x-cart.com/viewtopic.php?p=115113

I dunno if this was the right idea or not but what the hey.
__________________
X-Cart Version 4.0.17
Red Hat Enterprise Linux Host
Windows XP Pro running XAMPP Dev Platform
X-RMA 4.0.17
X-AOM 4.0.17
X-Configurator 4.0.17
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 12:03 PM.

   

 
X-Cart forums © 2001-2020