Cascading Categories lists

Questions about Version 3 phpList features (the answer is probably 'Yes!')
Forum rules
Please help the volunteers to help you by supplying the version of phpList you are using, browser & version and if possible, a link to your phpList installation.

Cascading Categories lists

Postby AlexGB » 5:29pm, Mon 26 May, 2014

I was curious if PHPLIst can be made to have cascading category lists. For example:

Code: Select all
All Sites ----> Site 1 ----> Customer type A
                       ----> Customer type B
                Site 2 ----> Customer type A
                       ----> Customer type B
                Site 3 ----> Customer type A
                       ----> Customer type B

Users would be subscribed to 'customer type A' or 'customer type B' for their respective site, and this way we could mass mail each customer type for each site, or we could mass mail for an entire site (all customers under that site) or we could mass mail the "all sites" lists and it goes to everyone.

Is this type of cascading possible with categories in PHPList?
AlexGB
phpList newbie
 
Posts: 1
Joined: 5:17pm, Mon 26 May, 2014

Re: Cascading Categories lists

Postby jimmyforsyth » 7:16am, Thu 12 Jun, 2014

I tried having the drop-down populated through an option group to handle both the Categories and Styles with a looped query, but only the Category headings show up with all of the Style sub-values showing up blank. My code is as follows:
$query1="SELECT categories.category_id, categories.Category_Name ";
$query1.="FROM categories ";
$query1.="ORDER BY categories.Category_Name ASC";
$category_result=mysql_query($query1, $connection);

if(!$category_result){
die("Database query failed: " . mysql_error());
}

$options="";

$con=0;

while ($category_row=mysql_fetch_array($category_result)) {
$category_name=$category_row["Category_Name"];
$CategoryID=$category_row["category_id"];

$options.="<OPTGROUP LABEL=\"$category_name\"> <br />";

$query2="SELECT categories.category_id, categories.Category_Name, ";
$query2.="styles.style_id, styles.Style_Name ";
$query2.="FROM categories, styles ";
$query2.="WHERE styles.Category_ID = $CategoryID ";
$style_result=mysql_query($query2, $connection);

if(!$style_result){
die("Database query failed: " . mysql_error());
}

while ($style_row=mysql_fetch_array($style_result)) {
$style_name=$row["Style_Name"];
$id=$row["style_id"];

$options.="<OPTION VALUE=\"$id\" <a href=\"#\" onClick=\"javascript:swapContent('$style_name');\" >".$style_name.'</OPTION>';
}
$options.='</OPTGROUP> <br />';
}
?>

<SELECT NAME="category_id">
<OPTION VALUE=0></OPTION>
<?php echo $options ?>choose
</SELECT>


india seo company
jimmyforsyth
phpList newbie
 
Posts: 1
Joined: 7:08am, Thu 12 Jun, 2014


Return to Does phpList do this?

Who is online

Users browsing this forum: No registered users and 2 guests

cron