![]() |
random.php/random product listing modification needed...
i'm running the random products on our main page, 4 across, and i need to remove one category (and all subs) from being displayed in that random display. so, say for example the main category is "kids clothes" or cat id 123.
i tried a few things in the template but guess i'm way off on the way to do this one, so i'm asking here now. how can we either remove that from the query, or stop any of those products from being called into the loop of random preoducts in the template? thanks. here is random.php Code:
<? here is the template... Code:
{if $usertype eq "C" and $config.Appearance.products_per_row ne "" and $config.Appearance.products_per_row gt 0 and $config.Appearance.products_per_row lt 5 and ($featured eq "Y" or $config.Appearance.featured_only_multicolumn eq "N")} |
Re: random.php/random product listing modification needed...
bumping this since i can't get the syntax right on my own...
so, for this chunk in the PHP.... Code:
<? how can i exclude one cat, and all subcats. for example. the main category id is 274 wouldn't it be close to.... AND $sql_tbl[categories].categoryid ne "274" or something close that? what's another way to specify "not equal to" instead of the ne? thanks, j |
Re: random.php/random product listing modification needed...
*crickets.
anyone have any ideas? |
Re: random.php/random product listing modification needed...
use NOT in the mysql query
|
Re: random.php/random product listing modification needed...
On 4.1.8 the category information and the product information are seperated, and then connected with a join table called xcart_products_categories, so you have to add this table to the query and then tell the query not to show products in categoryid 274.
Try this: Code:
$query = "SELECT * FROM $sql_tbl[products],$sql_tbl[pricing],$sql_tbl[products_categories] WHERE forsale='Y' AND avail>0 AND $sql_tbl[products].productid=$sql_tbl[pricing].productid AND $sql_tbl[products_categories].productid=$sql_tbl[products].productid AND $sql_tbl[products_categories].categoryid!='274' ORDER BY RAND() LIMIT 4;"; |
Re: random.php/random product listing modification needed...
hey jon, tried that, and i get nothing. the items from that category are showing up still.
we're still running 4.1.7 so i'm not sure if that is the problem or not. any other ideas? thanks, j |
Re: random.php/random product listing modification needed...
*bump.
okay, i think it isn't working with the main parent category. i'm trying all the active subcats... so, would this be the right syntax to select mulitple subcats? sql_tbl[products_categories].categoryid != '255' || '252' || '258' thanks, |
All times are GMT -8. The time now is 11:46 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.