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
  #11  
Old 07-24-2003, 08:31 AM
 
funkydunk funkydunk is offline
 

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

Default

yes - i know - i should get a life.
__________________
ex x-cart guru
Reply With Quote
  #12  
Old 07-24-2003, 08:33 AM
 
machnhed1 machnhed1 is offline
 

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

Default

Quote:
Code:
<?php
$marlboro_light_supply = 20;
while ($workrequired === "shedloads"){
$caffeine_level ++;
$sleepmode = "false";
$mummified_state = "true";
$chocolate ++;
$caffeine_level ++;
$marlboro_light_supply = $marlboro_light_supply - 1;
{if ($marlboro_light_supply < 2){
$panicMode = "true";
$go_to_Shops = "true";
$run_home_for_money = "true"
$marlboro_light_supply = 20;
}
}
$sleepmode = "true";
?>

OK guys, anyone who got that is now officially a code geek. Welcome to the club. :P
__________________
Following the signature guidelines : xcart pro 3.5.8 - [RedHat]
Reply With Quote
  #13  
Old 07-24-2003, 08:51 AM
 
funkydunk funkydunk is offline
 

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

Default

{assign var="horror" value="on"}
__________________
ex x-cart guru
Reply With Quote
  #14  
Old 07-24-2003, 08:53 AM
 
funkydunk funkydunk is offline
 

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

Default

do know what's worse - i just corrected the code cos i was missing a ;

arrrrrrrrrrrrrrrrrrrrrrrrrrrgggggggggghhhhhhhhhhhh hh
__________________
ex x-cart guru
Reply With Quote
  #15  
Old 07-24-2003, 12:03 PM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #16  
Old 07-24-2003, 12:29 PM
 
machnhed1 machnhed1 is offline
 

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

Default

Anyone figured out how to arrange the results of a search by price but have it go from most expensive to least expensive? I have modified my search so that I can order by add_date which is in DESC order, but I can't crack the price.

Just curious.

In return, I can post my add_date mod if someone requests it.

Thanks again
__________________
Following the signature guidelines : xcart pro 3.5.8 - [RedHat]
Reply With Quote
  #17  
Old 07-25-2003, 11:25 AM
 
machnhed1 machnhed1 is offline
 

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

Default

Nevermind, I figured it out.
__________________
Following the signature guidelines : xcart pro 3.5.8 - [RedHat]
Reply With Quote
  #18  
Old 07-25-2003, 12:46 PM
 
Cameron Cameron is offline
 

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

Default Looking for code clarity

Even though I did understand "funky's loop" I'm not getting this search mod to work.

To my categories.php file I added before the # Assign Smarty variables 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");
$categories_data2[$key][category] = strrchr($categories_data2[$key][category], "/");
}
...which I took from two of machnhed1's posts. I think that part is correct. In my advanced_search.tpl I replaced the lines
Quote:
<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=$categories_level_2}
{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|escape}
</option>{/if}
{/section}

{/section}
</select>
But what happens is that in advanced search, the categories list doesn't have any options in it. I saw that funky advised putting in this code: {$categories_level_2[cat_num][0][cat_num1].category_name|escape} but I'm not sure exactly where to put that in. I tried replacing
{ $categories_level_2[cat_num][0][cat_num1].categoryid}
with funky's line, but I still get the same results.

Can one of the wizards out there post the code I should use?

Thanks
Cameron
Reply With Quote
  #19  
Old 07-25-2003, 12:49 PM
 
machnhed1 machnhed1 is offline
 

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

Default

Cameron,

That code is going to go right in here:

Code:
{section name=cat_num1 loop=$categories_level_2} {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|escape} </option>{/if} {/section}

Replace the {$categories_level_2[cat_num][0][cat_num1].category|escape} with {$categories_level_2[cat_num][0][cat_num1].category_name|escape}.

Hope that helps.
__________________
Following the signature guidelines : xcart pro 3.5.8 - [RedHat]
Reply With Quote
  #20  
Old 07-25-2003, 01:16 PM
 
Cameron Cameron is offline
 

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

Default

Thanks for the fast reply

my advanced_search.tpl file now contains
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=$categories_level_2}
{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>
...but, the categories still don't show. I also tried changing
{$categories_level_1[cat_num].category|escape}
to
{$categories_level_1[cat_num].category_name|escape}
but that didn't help either.

I'm stumped. Could I have gone wrong with putting together the code for categories.php?
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 10:02 PM.

   

 
X-Cart forums © 2001-2020