X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Search Upgrade (https://forum.x-cart.com/showthread.php?t=3684)

funkydunk 07-24-2003 08:31 AM

yes - i know - i should get a life. :lol:

machnhed1 07-24-2003 08:33 AM

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

funkydunk 07-24-2003 08:51 AM

{assign var="horror" value="on"} :lol:

funkydunk 07-24-2003 08:53 AM

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

arrrrrrrrrrrrrrrrrrrrrrrrrrrgggggggggghhhhhhhhhhhh hh

shan 07-24-2003 12:03 PM

:lol:

machnhed1 07-24-2003 12:29 PM

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 :!:

machnhed1 07-25-2003 11:25 AM

Nevermind, I figured it out.

Cameron 07-25-2003 12:46 PM

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

machnhed1 07-25-2003 12:49 PM

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.

Cameron 07-25-2003 01:16 PM

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?


All times are GMT -8. The time now is 03:43 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.